问题
I am trying to build the latest llvm/clang code on my ubuntu 14.04 vm, which has 2GB memory.
What I did is a normal configure/make procedure, without any parameters to these two commands.
at last, I have the following error:
llvm[4]: Linking Debug+Asserts executable clang
/usr/bin/ld: failed to set dynamic section sizes: Memory exhausted
collect2: error: ld returned 1 exit status
make[4]: *** [/home/alex/Downloads/llvm_build/Debug+Asserts/bin/clang] Error 1
make[4]: Leaving directory/home/alex/Downloads/llvm_build/tools/clang/tools/driver' make[3]: *** [driver/.makeall] Error 2 make[3]: Leaving directory
/home/alex/Downloads/llvm_build/tools/clang/tools'
make[2]: * [all] Error 1
make[2]: Leaving directory/home/alex/Downloads/llvm_build/tools/clang' make[1]: *** [clang/.makeall] Error 2 make[1]: Leaving directory
/home/alex/Downloads/llvm_build/tools'
make: *** [all] Error 1
Does anyone know how to resolve this?
回答1:
You need to do one of the following:
- Add more RAM to your VM, or
- Use gold instead of ld as a linker, or
- Build Release(-DCMAKE_BUILD_TYPE=Release), not Debug build
回答2:
Another consideration: If you have Make running parallel jobs (e.g., make -j8
), the concurrently executing jobs may require too much memory.
来源:https://stackoverflow.com/questions/25197570/llvm-clang-compile-error-with-memory-exhausted