Some building experiments on different platforms #1173
arbipher
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I did some preliminary experiments on building checkedc-clang using more compilers on different platforms. I would like to share some results here.
Experiments are conducted on the recent latest commit on the master branch. They are not the same commits but it shouldn't matter too much.
Mac
On
macOS Big Sur
, usingclang
12. Bothninja
andninja check
run well. There are 13 failed tests in total: 10 on 3C tests, 2 on OCaml bindings, 1 on typechecking.The mac is a late 2019 model (Intel i9-9980hk 8 cores, 16G memory). The fresh compilation and testing take about 50 minutes each.
ccache
is applicable and incremental building is fast.Ubuntu on WSL 2, Windows
I have a
ubuntu 20.04
running on the Windows Subsystem for Linux (WSL 2). The compilation can never finish on the machine (AMD Ryzen 5 3600 6 cores, 32G memory). The compilation usinggcc
is extremely slow and it soon uses up all the memory then halts the virtual container.Conclusion: WSL 2 is not a good choice to build clang.
Visual Studio Community 2019, Windows
The only change is to load the community version of
vcvarsall.bat
. It works perfectly just like theEnterprise
version. The machine (AMD Ryzen 9 5950X 16 cores, 32G memory) takes 15 minutes to build and 25 minutes to test.Python3
cmake
andninja
are windows binaries. That is to say, no other gnu/unix tools are needed for the pure windows build.ccache
is not applicable.Mingw-w64 gcc, Windows
There is a group of approaches to make gnu/unix tools work on windows. The difference among them is whether one is POSIX-compatible and the C header files / dynamic libraries it uses. Or whether you would like your program to run also on linux or just run on Windows. For the project, I prefer the latter since we don't need to take its linux part on windows.
ccache
is applicable for them.I use MSYS2. It contains multiple environments to play with. Environment
MSYS
is most likecygwin
, a POSIX-compatible one, which is ignored in my experiments. The rest environments are based onMingw-w64
, not POSIX-compatible. EnvironmentCLANG64
is most interesting to me: it usesclang
and links toUniversal CRT
.I test with the environment
MINGW64
, which usesgcc
to build, and links tomsvcrt
(MS VC++ runtime) andlibstdc++
. The machine (AMD Ryzen 9 5950X 16 cores, 32G memory) takes 10 minutes to build and 20 minutes to test.I guess
3C
anddynamic_checking
tests are failed for no unix tools. The rest is just a few and probably also caused by lacking POSIX C headers. The result looks good to me.For all the previous experiments, I don't touch the source but for the
mingw
-based environments, I did this patch.The bug is caused in
ThreadPool.cpp
. In its header, it guards the code by an inaccurate macro_MSC_VER
(set bymsvc
) to detect the windows platform. Using__MINGW__
may be correct.Clang on Windows
I tried to use
llvm/clang
official windows binary to buildcheckedc-clang
, but I haven't succeeded yet.Experiment Conclusion
clang
works.ccache
.ccache
yet.MSYS2/MINGW64
works withccache
. You can have noVisual Studio
on windows.WSL 2
can hardly work.Extra
One resource for the building is the install scripts at each package management registry, e.g.
Beta Was this translation helpful? Give feedback.
All reactions