我的电脑:4G内存+ 4G交换
我的cmake参数:
cmake -G "Ninja" \
-DCMAKE_C_COMPILER=/usr/local/bin/gcc-8.3.0 \
-DCMAKE_CXX_COMPILER=/usr/local/bin/g++-8.3.0 \
-DCMAKE_INSTALL_PREFIX=/usr/local/llvm-7.0.1 \
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;libcxx;libcxxabi;libunwind;lldb;compiler-rt;lld;polly" \
-DCMAKE_C_FLAGS="-march=native -mtune=native -O3 -pipe -fstack-protector-strong -fno-plt -fuse-ld=gold -ffat-lto-objects" \
-DCMAKE_CXX_FLAGS="-march=native -mtune=native -O3 -pipe -fstack-protector-strong -fno-plt -fuse-ld=gold -ffat-lto-objects" \
-DLLVM_TARGETS_TO_BUILD="X86" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_OPTIMIZED_TABLEGEN=ON \
-DLLVM_CCACHE_BUILD=ON \
-DLLVM_ENABLE_LTO=ON \
-DLLVM_USE_LINKER=gold \
-DLLVM_BUILD_LLVM_DYLIB=OFF \
-DLLVM_LINK_LLVM_DYLIB=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DLLVM_ENABLE_DOXYGEN=OFF \
-DLLVM_ENABLE_SPHINX=OFF ../llvm
当我编译LLVM 9时,/ usr / local / bin / ar占用大量线程,内存不足,并发生以下错误:
[138/6015] Linking CXX static library lib/libLLVMTableGen.a
FAILED: lib/libLLVMTableGen.a
: && /usr/local/cmake/bin/cmake -E remove lib/libLLVMTableGen.a && /usr/local/bin/ar qc lib/libLLVMTableGen.a lib/TableGen/CMakeFiles/LLVMTableGen.dir/Error.cpp.o lib/TableGen/CMakeFiles/LLVMTableGen.dir/JSONBackend.cpp.o lib/TableGen/CMakeFiles/LLVMTableGen.dir/Main.cpp.o lib/TableGen/CMakeFiles/LLVMTableGen.dir/Record.cpp.o lib/TableGen/CMakeFiles/LLVMTableGen.dir/SetTheory.cpp.o lib/TableGen/CMakeFiles/LLVMTableGen.dir/StringMatcher.cpp.o lib/TableGen/CMakeFiles/LLVMTableGen.dir/TableGenBackend.cpp.o lib/TableGen/CMakeFiles/LLVMTableGen.dir/TGLexer.cpp.o lib/TableGen/CMakeFiles/LLVMTableGen.dir/TGParser.cpp.o && /usr/bin/ranlib lib/libLLVMTableGen.a && :
Error running /usr/local/bin/ar: vfork
[139/6015] Linking CXX static library lib/libLLVMSupport.a
FAILED: lib/libLLVMSupport.a
: && /usr/local/cmake/bin/cmake -E remove lib/libLLVMSupport.a && /usr/local/bin/ar qc lib/libLLVMSupport.a lib/Support/CMakeFiles/LLVMSupport.dir/AArch64TargetParser.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ARMTargetParser.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/AMDGPUMetadata.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/APFloat.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/APInt.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/APSInt.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ARMAttributeParser.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ARMWinEH.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Allocator.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/BinaryStreamError.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/BinaryStreamReader.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/BinaryStreamRef.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/BinaryStreamWriter.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/BlockFrequency.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/BranchProbability.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/BuryPointer.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/CachePruning.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/circular_raw_ostream.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Chrono.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/COM.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/CodeGenCoverage.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/CommandLine.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Compression.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ConvertUTF.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ConvertUTFWrapper.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/CrashRecoveryContext.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/DataExtractor.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Debug.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/DebugCounter.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/DeltaAlgorithm.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/DAGDeltaAlgorithm.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/DJB.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Error.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ErrorHandling.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/FileCheck.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/FileUtilities.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/FileOutputBuffer.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/FoldingSet.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/FormattedStream.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/FormatVariadic.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/GlobPattern.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/GraphWriter.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Hashing.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/InitLLVM.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/IntEqClasses.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/IntervalMap.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ItaniumManglingCanonicalizer.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/JamCRC.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/JSON.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/KnownBits.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/LEB128.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/LineIterator.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Locale.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/LockFileManager.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/LowLevelType.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ManagedStatic.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/MathExtras.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/MemoryBuffer.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/MD5.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/NativeFormatting.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Optional.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Options.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Parallel.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/PluginLoader.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/PrettyStackTrace.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/RandomNumberGenerator.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Regex.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ScaledNumber.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ScopedPrinter.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/SHA1.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Signposts.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/SmallPtrSet.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/SmallVector.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/SourceMgr.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/SpecialCaseList.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Statistic.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/StringExtras.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/StringMap.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/StringPool.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/StringSaver.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/StringRef.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/SymbolRemappingReader.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/SystemUtils.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/TarWriter.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/TargetParser.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ThreadPool.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Timer.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ToolOutputFile.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/TrigramIndex.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Triple.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Twine.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Unicode.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/UnicodeCaseFold.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/VersionTuple.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/VirtualFileSystem.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/WithColor.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/YAMLParser.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/YAMLTraits.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/raw_os_ostream.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/raw_ostream.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/regcomp.c.o lib/Support/CMakeFiles/LLVMSupport.dir/regerror.c.o lib/Support/CMakeFiles/LLVMSupport.dir/regexec.c.o lib/Support/CMakeFiles/LLVMSupport.dir/regfree.c.o lib/Support/CMakeFiles/LLVMSupport.dir/regstrlcpy.c.o lib/Support/CMakeFiles/LLVMSupport.dir/xxhash.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Atomic.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/DynamicLibrary.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Errno.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Host.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Memory.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Mutex.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Path.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Process.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Program.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/RWMutex.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Signals.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/TargetRegistry.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ThreadLocal.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Threading.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Valgrind.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Watchdog.cpp.o && /usr/bin/ranlib lib/libLLVMSupport.a && :
Error running /usr/local/bin/ar: vfork
[140/6015] Linking CXX static library lib/libLLVMDemangle.a
FAILED: lib/libLLVMDemangle.a
: && /usr/local/cmake/bin/cmake -E remove lib/libLLVMDemangle.a && /usr/local/bin/ar qc lib/libLLVMDemangle.a lib/Demangle/CMakeFiles/LLVMDemangle.dir/Demangle.cpp.o lib/Demangle/CMakeFiles/LLVMDemangle.dir/ItaniumDemangle.cpp.o lib/Demangle/CMakeFiles/LLVMDemangle.dir/MicrosoftDemangle.cpp.o lib/Demangle/CMakeFiles/LLVMDemangle.dir/MicrosoftDemangleNodes.cpp.o && /usr/bin/ranlib lib/libLLVMDemangle.a && :
Error running /usr/local/bin/ar: vfork
ninja: build stopped: subcommand failed.
我试图在网上搜索此错误代码:
Error running /usr/local/bin/ar: vfork
但是我什么也没发现。
我的gcc版本是:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc-8.3.0/libexec/gcc/x86_64-pc-linux-gnu/8.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/usr/local/gcc-8.3.0 --disable-bootstrap --disable-checking --disable-multilib --enable-threads=posix --enable-languages=c,c++
Thread model: posix
gcc version 8.3.0 (GCC)
我的Cmake版本:
cmake version 3.13.4
CMake suite maintained and supported by Kitware (kitware.com/cmake).
These are pictures that are monitored with htop: