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
Uh oh!
There was an error while loading. Please reload this page.
-
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, usingclang12. Bothninjaandninja checkrun 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.
ccacheis applicable and incremental building is fast.Ubuntu on WSL 2, Windows
I have a
ubuntu 20.04running 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 usinggccis 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 theEnterpriseversion. The machine (AMD Ryzen 9 5950X 16 cores, 32G memory) takes 15 minutes to build and 25 minutes to test.Python3cmakeandninjaare windows binaries. That is to say, no other gnu/unix tools are needed for the pure windows build.ccacheis 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.
ccacheis applicable for them.I use MSYS2. It contains multiple environments to play with. Environment
MSYSis most likecygwin, a POSIX-compatible one, which is ignored in my experiments. The rest environments are based onMingw-w64, not POSIX-compatible. EnvironmentCLANG64is most interesting to me: it usesclangand links toUniversal CRT.I test with the environment
MINGW64, which usesgccto 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
3Canddynamic_checkingtests 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/clangofficial windows binary to buildcheckedc-clang, but I haven't succeeded yet.Experiment Conclusion
clangworks.ccache.ccacheyet.MSYS2/MINGW64works withccache. You can have noVisual Studioon windows.WSL 2can 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