Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regarding compiling clang tools #169

Closed
norhh opened this issue Mar 11, 2020 · 5 comments
Closed

Regarding compiling clang tools #169

norhh opened this issue Mar 11, 2020 · 5 comments
Labels
build-problem clang:tooling LibTooling question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

Comments

@norhh
Copy link

norhh commented Mar 11, 2020

I wanted to use LibTooling, so I tried out building clang as mentioned in https://clang.llvm.org/docs/LibASTMatchersTutorial.html . For some reason even with 16GB RAM and a lot of swap space, the build crashes either by segfault or it gets killed(on both Mac and Ubuntu). Is there any way to build it with 16GB RAM?
Does anyone have a docker container for running LibTooling and LibASTMatchers?

@Lekensteyn
Copy link
Contributor

How much CPUs do you have? Linking can be very expensive, and ninja by default runs these processes in parallel.

When you build with CMake, try setting a lower number of parallel linker jobs. E.g.

cmake -DLLVM_PARALLEL_LINK_JOBS=2

This option is documented at https://llvm.org/docs/CMake.html

@norhh
Copy link
Author

norhh commented Mar 12, 2020

Gave it 8 CPUs in both Mac and Ubuntu.

@norhh
Copy link
Author

norhh commented Mar 12, 2020

It crashed with 2 parallel jobs or 1 parallel job.

@androm3da
Copy link
Member

on both Mac and Ubuntu

You might have better luck using lld or gold as your linker on Ubuntu.

@Lekensteyn Lekensteyn added the question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead! label Mar 14, 2020
@Lekensteyn
Copy link
Contributor

Can you share your build output? As suggested above, you can also try a more memory-efficient linker with -DLLVM_USE_LINKER=lld or -DLLVM_USE_LINKER=gold.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-problem clang:tooling LibTooling question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Projects
None yet
Development

No branches or pull requests

5 participants