Skip to content

Instantly share code, notes, and snippets.

@rkitover
Created April 9, 2016 00:20
Show Gist options
  • Save rkitover/552e0ad79714b1e7b182ed8c2823445b to your computer and use it in GitHub Desktop.
Save rkitover/552e0ad79714b1e7b182ed8c2823445b to your computer and use it in GitHub Desktop.
llvm won't link
[ 89%] Built target not
[ 89%] Built target yaml-bench
[ 89%] Built target gtest
[ 89%] Built target gtest_main
[ 89%] Built target LTO_exports
[ 90%] Linking CXX shared library ../../lib/libLTO.so
../../lib/libLLVMScalarOpts.a: could not read symbols: Memory exhausted
collect2: error: ld returned 1 exit status
*** Error 1 in . (tools/lto/CMakeFiles/LTO.dir/build.make:255 'lib/libLTO.so')
*** Error 1 in . (CMakeFiles/Makefile2:12494 'tools/lto/CMakeFiles/LTO.dir/all')
*** Error 1 in /home/rkitover/src/llvm/build (Makefile:150 'all')
@Devyani1305
Copy link

I am doing : cmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_USE_LINKER=gold -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ../
I am getting this error:
[ 86%] Linking CXX executable ../../../../bin/clang
/usr/bin/ld.gold: error: cannot find -lLLVMExtensions
collect2: error: ld returned 1 exit status
tools/clang/tools/driver/CMakeFiles/clang.dir/build.make:313: recipe for target 'bin/clang-10' failed
make[2]: *** [bin/clang-10] Error 1

@rileyrg
Copy link

rileyrg commented Mar 1, 2021

Just hit the same on Debian bullseye with 32gb of memory.

This worked.

@BhargavJayswal
Copy link

I am doing : cmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_USE_LINKER=gold -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ../
I am getting this error:
[ 86%] Linking CXX executable ../../../../bin/clang
/usr/bin/ld.gold: error: cannot find -lLLVMExtensions
collect2: error: ld returned 1 exit status
tools/clang/tools/driver/CMakeFiles/clang.dir/build.make:313: recipe for target 'bin/clang-10' failed
make[2]: *** [bin/clang-10] Error 1

HI Devyani,

Have you resolved this problem ?
I am facing same issue.

@rileyrg
Copy link

rileyrg commented Apr 22, 2021

I am doing : cmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_USE_LINKER=gold -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ../
I am getting this error:
[ 86%] Linking CXX executable ../../../../bin/clang
/usr/bin/ld.gold: error: cannot find -lLLVMExtensions
collect2: error: ld returned 1 exit status
tools/clang/tools/driver/CMakeFiles/clang.dir/build.make:313: recipe for target 'bin/clang-10' failed
make[2]: *** [bin/clang-10] Error 1

HI Devyani,

Have you resolved this problem ?
I am facing same issue.

See here https://gist.github.com/rkitover/552e0ad79714b1e7b182ed8c2823445b#gistcomment-3649767

@tamasgal
Copy link

tamasgal commented May 21, 2021

Thanks, -DLLVM_USE_LINKER=gold -DCMAKE_BUILD_TYPE=Release fixed this on my MacBook M1 (16GB). I even had problems on my 8 Core Xeon with 64GB RAM, that's quite insane...

@gcasa
Copy link

gcasa commented Sep 14, 2021

Hello,

Not sure if somebody could help here on priority !
I am unable to build the LLVm 10.0.0 with GCC 9.3.0 version.
On running or executing the "make -j6" command it throws an error at 24%
The last few errors are pasted as below :

      |                                                     ^
/root/rpmbuild/BUILD/llvm-10.0.0rc6.src/tools/clang/utils/TableGen/NeonEmitter.cpp: In member function ‘void {anonymous}::NeonEmitter::runFP16(llvm::raw_ostream&)’:
/root/rpmbuild/BUILD/llvm-10.0.0rc6.src/tools/clang/utils/TableGen/NeonEmitter.cpp:2566:33: error: ‘less_ptr’ is not a member of ‘llvm’; did you mean ‘less_first’?
 2566 |   llvm::stable_sort(Defs, llvm::less_ptr<Intrinsic>());
      |                                 ^~~~~~~~
      |                                 less_first
/root/rpmbuild/BUILD/llvm-10.0.0rc6.src/tools/clang/utils/TableGen/NeonEmitter.cpp:2566:51: error: expected primary-expression before ‘>’ token
 2566 |   llvm::stable_sort(Defs, llvm::less_ptr<Intrinsic>());
      |                                                   ^
/root/rpmbuild/BUILD/llvm-10.0.0rc6.src/tools/clang/utils/TableGen/NeonEmitter.cpp:2566:53: error: expected primary-expression before ‘)’ token
 2566 |   llvm::stable_sort(Defs, llvm::less_ptr<Intrinsic>());
      |                                                     ^
make[2]: *** [tools/clang/utils/TableGen/CMakeFiles/obj.clang-tblgen.dir/NeonEmitter.cpp.o] Error 1
make[1]: *** [tools/clang/utils/TableGen/CMakeFiles/obj.clang-tblgen.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 24%] Building CXX object projects/compiler-rt/lib/xray/CMakeFiles/RTXray.x86_64.dir/xray_utils.cpp.o
[ 24%] Building CXX object projects/compiler-rt/lib/xray/CMakeFiles/RTXray.x86_64.dir/xray_x86_64.cpp.o
[ 24%] Building CXX object tools/llvm-cxxfilt/CMakeFiles/llvm-cxxfilt.dir/llvm-cxxfilt.cpp.o
[ 24%] Built target RTGwpAsanTest.x86_64
[ 24%] Building ASM object projects/compiler-rt/lib/xray/CMakeFiles/RTXray.x86_64.dir/xray_trampoline_x86_64.S.o
[ 24%] Building CXX object projects/compiler-rt/lib/xray/CMakeFiles/RTXrayPROFILING.x86_64.dir/xray_profiling_flags.cpp.o
[ 24%] Built target RTXrayPROFILING.x86_64
[ 24%] Built target RTXray.x86_64
[ 24%] Linking CXX executable ../../bin/llvm-cxxfilt
[ 24%] Built target llvm-cxxfilt
[ 24%] Linking CXX executable ../../bin/llvm-config
[ 24%] Built target llvm-config
make: *** [all] Error 2

It is UNBELIEVABLE that clang / ld.gold would take THAT much memory just to link. 7GB is an OUTRAGOUSLY large amount of memory for something like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment