gpt4 book ai didi

llvm - 无法从其源代码构建 LLVM

转载 作者:行者123 更新时间:2023-12-05 01:32:19 31 4
gpt4 key购买 nike

我指的是 https://llvm.org/docs/GettingStarted.html从其源代码构建 LLVM。我正在使用 Ubuntu 18.04。

$ cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo ../llvm
$ cmake --build .

错误如下:

[2978/2994] Linking CXX shared library lib/libLTO.so.12git
FAILED: lib/libLTO.so.12git
: && /usr/bin/c++ -fPIC -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -O2 -g -DNDEBUG -Wl,-z,defs -Wl,-z,nodelete -Wl,-rpath-link,/home/kumarpr/Praveer_LLVM/llvm-project/build/./lib -Wl,-O3 -Wl,--gc-sections -Wl,--version-script,"/home/kumarpr/Praveer_LLVM/llvm-project/build/tools/lto/LTO.exports" -shared -Wl,-soname,libLTO.so.12git -o lib/libLTO.so.12git tools/lto/CMakeFiles/LTO.dir/LTODisassembler.cpp.o tools/lto/CMakeFiles/LTO.dir/lto.cpp.o -Wl,-rpath,:::::::::::::: lib/libLLVMAArch64AsmParser.a lib/libLLVMAMDGPUAsmParser.a lib/libLLVMARMAsmParser.a lib/libLLVMAVRAsmParser.a lib/libLLVMBPFAsmParser.a lib/libLLVMHexagonAsmParser.a lib/libLLVMLanaiAsmParser.a lib/libLLVMMipsAsmParser.a lib/libLLVMMSP430AsmParser.a lib/libLLVMPowerPCAsmParser.a lib/libLLVMRISCVAsmParser.a lib/libLLVMSparcAsmParser.a lib/libLLVMSystemZAsmParser.a lib/libLLVMWebAssemblyAsmParser.a lib/libLLVMX86AsmParser.a lib/libLLVMAArch64CodeGen.a lib/libLLVMAMDGPUCodeGen.a lib/libLLVMARMCodeGen.a lib/libLLVMAVRCodeGen.a lib/libLLVMBPFCodeGen.a lib/libLLVMHexagonCodeGen.a lib/libLLVMLanaiCodeGen.a lib/libLLVMMipsCodeGen.a lib/libLLVMMSP430CodeGen.a lib/libLLVMNVPTXCodeGen.a lib/libLLVMPowerPCCodeGen.a lib/libLLVMRISCVCodeGen.a lib/libLLVMSparcCodeGen.a lib/libLLVMSystemZCodeGen.a lib/libLLVMWebAssemblyCodeGen.a lib/libLLVMX86CodeGen.a lib/libLLVMXCoreCodeGen.a lib/libLLVMAArch64Desc.a lib/libLLVMAMDGPUDesc.a lib/libLLVMARMDesc.a lib/libLLVMAVRDesc.a lib/libLLVMBPFDesc.a lib/libLLVMHexagonDesc.a lib/libLLVMLanaiDesc.a lib/libLLVMMipsDesc.a lib/libLLVMMSP430Desc.a lib/libLLVMNVPTXDesc.a lib/libLLVMPowerPCDesc.a lib/libLLVMRISCVDesc.a lib/libLLVMSparcDesc.a lib/libLLVMSystemZDesc.a lib/libLLVMWebAssemblyDesc.a lib/libLLVMX86Desc.a lib/libLLVMXCoreDesc.a lib/libLLVMAArch64Disassembler.a lib/libLLVMAMDGPUDisassembler.a lib/libLLVMARMDisassembler.a lib/libLLVMAVRDisassembler.a lib/libLLVMBPFDisassembler.a lib/libLLVMHexagonDisassembler.a lib/libLLVMLanaiDisassembler.a lib/libLLVMMipsDisassembler.a lib/libLLVMMSP430Disassembler.a lib/libLLVMPowerPCDisassembler.a lib/libLLVMRISCVDisassembler.a lib/libLLVMSparcDisassembler.a lib/libLLVMSystemZDisassembler.a lib/libLLVMWebAssemblyDisassembler.a lib/libLLVMX86Disassembler.a lib/libLLVMXCoreDisassembler.a lib/libLLVMAArch64Info.a lib/libLLVMAMDGPUInfo.a lib/libLLVMARMInfo.a lib/libLLVMAVRInfo.a lib/libLLVMBPFInfo.a lib/libLLVMHexagonInfo.a lib/libLLVMLanaiInfo.a lib/libLLVMMipsInfo.a lib/libLLVMMSP430Info.a lib/libLLVMNVPTXInfo.a lib/libLLVMPowerPCInfo.a lib/libLLVMRISCVInfo.a lib/libLLVMSparcInfo.a lib/libLLVMSystemZInfo.a lib/libLLVMWebAssemblyInfo.a lib/libLLVMX86Info.a lib/libLLVMXCoreInfo.a lib/libLLVMBitReader.a lib/libLLVMCore.a lib/libLLVMCodeGen.a lib/libLLVMLTO.a lib/libLLVMMC.a lib/libLLVMMCDisassembler.a lib/libLLVMSupport.a lib/libLLVMTarget.a lib/libLLVMMIRParser.a lib/libLLVMHexagonAsmParser.a lib/libLLVMLanaiAsmParser.a lib/libLLVMRISCVUtils.a lib/libLLVMGlobalISel.a lib/libLLVMCFGuard.a lib/libLLVMAsmPrinter.a lib/libLLVMDebugInfoDWARF.a lib/libLLVMSelectionDAG.a lib/libLLVMAArch64Desc.a lib/libLLVMAArch64Info.a lib/libLLVMAArch64Utils.a lib/libLLVMAMDGPUDesc.a lib/libLLVMAMDGPUInfo.a lib/libLLVMAMDGPUUtils.a lib/libLLVMARMDesc.a lib/libLLVMARMInfo.a lib/libLLVMARMUtils.a lib/libLLVMHexagonDesc.a lib/libLLVMHexagonInfo.a lib/libLLVMLanaiDesc.a lib/libLLVMLanaiInfo.a lib/libLLVMSystemZDesc.a lib/libLLVMSystemZInfo.a lib/libLLVMWebAssemblyDesc.a lib/libLLVMWebAssemblyInfo.a lib/libLLVMMCDisassembler.a lib/libLLVMCodeGen.a lib/libLLVMPasses.a lib/libLLVMTarget.a lib/libLLVMCoroutines.a lib/libLLVMipo.a lib/libLLVMScalarOpts.a lib/libLLVMVectorize.a lib/libLLVMFrontendOpenMP.a lib/libLLVMIRReader.a lib/libLLVMAsmParser.a lib/libLLVMInstrumentation.a lib/libLLVMHelloNew.a lib/libLLVMBitWriter.a lib/libLLVMAggressiveInstCombine.a lib/libLLVMExtensions.a lib/libLLVMInstCombine.a lib/libLLVMLinker.a lib/libLLVMObjCARCOpts.a lib/libLLVMTransformUtils.a lib/libLLVMAnalysis.a lib/libLLVMProfileData.a lib/libLLVMObject.a lib/libLLVMBitReader.a lib/libLLVMCore.a lib/libLLVMRemarks.a lib/libLLVMBitstreamReader.a lib/libLLVMMCParser.a lib/libLLVMMC.a lib/libLLVMDebugInfoCodeView.a lib/libLLVMDebugInfoMSF.a lib/libLLVMTextAPI.a lib/libLLVMBinaryFormat.a lib/libLLVMSupport.a -lrt -ldl -lpthread -lm /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libtinfo.so lib/libLLVMDemangle.a && :
collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
[2980/2994] Linking CXX executable bin/opt
FAILED: bin/opt
: && /usr/bin/c++ -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -O2 -g -DNDEBUG -Wl,--export-dynamic -Wl,-rpath-link,/home/kumarpr/Praveer_LLVM/llvm-project/build/./lib -Wl,-O3 tools/opt/CMakeFiles/opt.dir/AnalysisWrappers.cpp.o tools/opt/CMakeFiles/opt.dir/BreakpointPrinter.cpp.o tools/opt/CMakeFiles/opt.dir/GraphPrinters.cpp.o tools/opt/CMakeFiles/opt.dir/NewPMDriver.cpp.o tools/opt/CMakeFiles/opt.dir/PassPrinters.cpp.o tools/opt/CMakeFiles/opt.dir/PrintSCC.cpp.o tools/opt/CMakeFiles/opt.dir/opt.cpp.o -o bin/opt -Wl,-rpath,:::::::::::::: lib/libLLVMAArch64AsmParser.a lib/libLLVMAMDGPUAsmParser.a lib/libLLVMARMAsmParser.a lib/libLLVMAVRAsmParser.a lib/libLLVMBPFAsmParser.a lib/libLLVMHexagonAsmParser.a lib/libLLVMLanaiAsmParser.a lib/libLLVMMipsAsmParser.a lib/libLLVMMSP430AsmParser.a lib/libLLVMPowerPCAsmParser.a lib/libLLVMRISCVAsmParser.a lib/libLLVMSparcAsmParser.a lib/libLLVMSystemZAsmParser.a lib/libLLVMWebAssemblyAsmParser.a lib/libLLVMX86AsmParser.a lib/libLLVMAArch64CodeGen.a lib/libLLVMAMDGPUCodeGen.a lib/libLLVMARMCodeGen.a lib/libLLVMAVRCodeGen.a lib/libLLVMBPFCodeGen.a lib/libLLVMHexagonCodeGen.a lib/libLLVMLanaiCodeGen.a lib/libLLVMMipsCodeGen.a lib/libLLVMMSP430CodeGen.a lib/libLLVMNVPTXCodeGen.a lib/libLLVMPowerPCCodeGen.a lib/libLLVMRISCVCodeGen.a lib/libLLVMSparcCodeGen.a lib/libLLVMSystemZCodeGen.a lib/libLLVMWebAssemblyCodeGen.a lib/libLLVMX86CodeGen.a lib/libLLVMXCoreCodeGen.a lib/libLLVMAArch64Desc.a lib/libLLVMAMDGPUDesc.a lib/libLLVMARMDesc.a lib/libLLVMAVRDesc.a lib/libLLVMBPFDesc.a lib/libLLVMHexagonDesc.a lib/libLLVMLanaiDesc.a lib/libLLVMMipsDesc.a lib/libLLVMMSP430Desc.a lib/libLLVMNVPTXDesc.a lib/libLLVMPowerPCDesc.a lib/libLLVMRISCVDesc.a lib/libLLVMSparcDesc.a lib/libLLVMSystemZDesc.a lib/libLLVMWebAssemblyDesc.a lib/libLLVMX86Desc.a lib/libLLVMXCoreDesc.a lib/libLLVMAArch64Info.a lib/libLLVMAMDGPUInfo.a lib/libLLVMARMInfo.a lib/libLLVMAVRInfo.a lib/libLLVMBPFInfo.a lib/libLLVMHexagonInfo.a lib/libLLVMLanaiInfo.a lib/libLLVMMipsInfo.a lib/libLLVMMSP430Info.a lib/libLLVMNVPTXInfo.a lib/libLLVMPowerPCInfo.a lib/libLLVMRISCVInfo.a lib/libLLVMSparcInfo.a lib/libLLVMSystemZInfo.a lib/libLLVMWebAssemblyInfo.a lib/libLLVMX86Info.a lib/libLLVMXCoreInfo.a lib/libLLVMAggressiveInstCombine.a lib/libLLVMAnalysis.a lib/libLLVMAsmParser.a lib/libLLVMBitWriter.a lib/libLLVMCodeGen.a lib/libLLVMCore.a lib/libLLVMCoroutines.a lib/libLLVMExtensions.a lib/libLLVMipo.a lib/libLLVMIRReader.a lib/libLLVMInstCombine.a lib/libLLVMInstrumentation.a lib/libLLVMMC.a lib/libLLVMObjCARCOpts.a lib/libLLVMRemarks.a lib/libLLVMScalarOpts.a lib/libLLVMSupport.a lib/libLLVMTarget.a lib/libLLVMTransformUtils.a lib/libLLVMVectorize.a lib/libLLVMPasses.a -lpthread lib/libLLVMAArch64Utils.a lib/libLLVMCoroutines.a lib/libLLVMObjCARCOpts.a lib/libLLVMHelloNew.a lib/libLLVMAMDGPUUtils.a lib/libLLVMMIRParser.a lib/libLLVMARMUtils.a lib/libLLVMHexagonAsmParser.a lib/libLLVMHexagonDesc.a lib/libLLVMHexagonInfo.a lib/libLLVMLanaiAsmParser.a lib/libLLVMLanaiDesc.a lib/libLLVMLanaiInfo.a lib/libLLVMipo.a lib/libLLVMIRReader.a lib/libLLVMAsmParser.a lib/libLLVMInstrumentation.a lib/libLLVMFrontendOpenMP.a lib/libLLVMLinker.a lib/libLLVMVectorize.a lib/libLLVMRISCVUtils.a lib/libLLVMMCDisassembler.a lib/libLLVMGlobalISel.a lib/libLLVMCFGuard.a lib/libLLVMAsmPrinter.a lib/libLLVMDebugInfoDWARF.a lib/libLLVMSelectionDAG.a lib/libLLVMCodeGen.a lib/libLLVMBitWriter.a lib/libLLVMScalarOpts.a lib/libLLVMAggressiveInstCombine.a lib/libLLVMInstCombine.a lib/libLLVMTarget.a lib/libLLVMTransformUtils.a lib/libLLVMAnalysis.a lib/libLLVMProfileData.a lib/libLLVMObject.a lib/libLLVMMCParser.a lib/libLLVMMC.a lib/libLLVMDebugInfoCodeView.a lib/libLLVMDebugInfoMSF.a lib/libLLVMBitReader.a lib/libLLVMTextAPI.a lib/libLLVMCore.a lib/libLLVMRemarks.a lib/libLLVMBitstreamReader.a lib/libLLVMBinaryFormat.a lib/libLLVMSupport.a -lrt -ldl -lpthread -lm /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libtinfo.so lib/libLLVMDemangle.a && :
collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
[2982/2994] Linking CXX executable bin/llvm-isel-fuzzer
FAILED: bin/llvm-isel-fuzzer

有人知道吗?

最佳答案

如评论中所述,您很可能内存不足:默认情况下,所有可执行文件都是静态链接的,因此 ld 使用 大量 RAM。有几种方法可以解决这个问题:

  1. 通过 -DLLVM_PARALLEL_LINK_JOBS=1 减少链接并行度以避免并行启动太多链接(顺便说一下,对于通用代码库,可以使用 ld-limiter 来实现相同的目的)。

  2. 通过使用 -Wl,-no-keep-memory-Wl,--reduce-memory-overheads 链接器中的一个或两个来减少消耗的内存标志(将它们添加到 CMAKE_EXE_LINKER_FLAGS)。

  3. 切换到 Gold(通过 -fuse-ld=gold)或 lld(通过 -fuse-ld=lld)链接器(将开关添加到 CMAKE_EXE_LINKER_FLAGS)。

  4. 如果您计划频繁重建 Clang(例如为了调试),您可以使用 -DBUILD_SHARED_LIBS=ON 来使用共享链接而不是静态链接。您将不再有 OOM,而且增量 Clang 构建速度提高了 100 倍(代价是 Clang 运行时间降低了 2-3 倍)。

关于llvm - 无法从其源代码构建 LLVM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65633304/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com