Clang build error: lib/CheckerDependencyHandlingAnalyzerPlugin.so] Error 1

Clang build error: lib/CheckerDependencyHandlingAnalyzerPlugin.so] Error 1

llvm-project 源代码是从最新的 github repo 克隆而来的。
构建命令:make -j8
Clang 构建错误,错误信息为:

collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
make[2]: *** [tools/clang/lib/Analysis/plugins/CheckerDependencyHandling/CMakeFiles/CheckerDependencyHandlingAnalyzerPlugin.dir/build.make:146: lib/CheckerDependencyHandlingAnalyzerPlugin.so] Error 1
make[2]: *** Deleting file 'lib/CheckerDependencyHandlingAnalyzerPlugin.so'
make[1]: *** [CMakeFiles/Makefile2:34906: tools/clang/lib/Analysis/plugins/CheckerDependencyHandling/CMakeFiles/CheckerDependencyHandlingAnalyzerPlugin.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 67%] Building CXX object tools/clang/lib/Tooling/CMakeFiles/obj.clangTooling.dir/RefactoringCallbacks.cpp.o
[ 67%] Building CXX object tools/clang/lib/Tooling/CMakeFiles/obj.clangTooling.dir/StandaloneExecution.cpp.o
[ 67%] Building CXX object tools/clang/lib/Tooling/CMakeFiles/obj.clangTooling.dir/NodeIntrospection.cpp.o
[ 67%] Building CXX object lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/SpeculativeExecution.cpp.o
[ 67%] Building CXX object tools/clang/lib/Tooling/CMakeFiles/obj.clangTooling.dir/Tooling.cpp.o
[ 67%] Building CXX object lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/StraightLineStrengthReduce.cpp.o
[ 67%] Building CXX object lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/StructurizeCFG.cpp.o
[ 69%] Building CXX object lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/TailRecursionElimination.cpp.o
[ 69%] Building CXX object lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/WarnMissedTransforms.cpp.o
[ 69%] Linking CXX static library ../../libLLVMScalarOpts.a
[ 69%] Built target obj.clangTooling
[ 69%] Built target LLVMScalarOpts
[ 69%] Built target SampleAnalyzerPlugin
[ 69%] Built target CheckerOptionHandlingAnalyzerPlugin
make: *** [Makefile:171: all] Error 2

其他信息:

$ cmake --version
cmake version 3.18.2
$ gcc --version
gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5)
$ uname -a
Linux VM-82-98-centos 5.4.32-1-tlinux4-0001 #1 SMP Tue Jul 21 14:24:37 CST 2020 x86_64 x86_64 x86_64 GNU/Linux

任何帮助将不胜感激!

ld terminated with signal 9 表示您的计算机 运行 内存 (RAM) 不足,无法编译项目。

您应该尝试的第一件事是减少线程数。因此,请尝试使用 make -j4.

而不是 make -j8

如果即使使用单线程也无法编译,那么您可能需要增加计算机上的交换大小。