Clang build is extremely slow and hangs up in the middle

▼魔方 西西 提交于 2020-01-05 07:13:29

问题


I am getting started with writing my own clang tools. These are the steps I have followed so far:

  1. Checked out llvm 7.0 release build
  2. Checked out clang 7.0 release build
  3. Built clang and llvm using ninja with following flags (It was hanging up on me constantly without these)

    -DLLVM_USE_LINKER=gold -DLLVM_PARALLEL_LINK_JOBS=1 -DLLVM_LINK_LLVM_DYLIB=true -DLLVM_USE_SPLIT_DWARF=ON -DBUILD_SHARED_LIBS=ON

  4. Installed clang

Now I want to set clang as it's own compiler. So I have set these flags in config file using 'ccmake ../llvm'. I'm not sure if that was the right thing to do though? Now that I try to build clang it says linker detected is GNU ld. How can I reset my config file and actually change the linker so it will be faster? I have 8GB RAM.

Secondly, would I have to build clang again and again every time I write a tool? As in would it take 3-4 hours every single time?

Update As suggested by sandthorn in comments I limited parallel jobs to 1 by using ninja -j 1. However, the build failed again with following error:

[3840/4138] Linking CXX shared library lib/libLTO.so.7
FAILED: lib/libLTO.so.7 
: && /usr/bin/c++ -fPIC -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=gold   -Wl,-O3 -Wl,--gc-sections  -Wl,--version-script,/home/tehreem/clang-llvm/build/tools/lto/LTO.exports -shared -Wl,-soname,libLTO.so.7 -o lib/libLTO.so.7 tools/lto/CMakeFiles/LTO.dir/LTODisassembler.cpp.o tools/lto/CMakeFiles/LTO.dir/lto.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib" lib/libLLVM-7.so && :

And after this there are about a 100 other undefined reference errors.

来源:https://stackoverflow.com/questions/53736152/clang-build-is-extremely-slow-and-hangs-up-in-the-middle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!