Open mbelda opened 8 months ago
I guess that you can pass -DLLVM_ENABLE_RTTI=ON
to cmake
to address this problem.
See also https://llvm.org/docs/CMake.html#llvm-related-variables.
I still got the same error.
I am sorry I cannot reproduce the linker error on the trunk version.
Probably I am missing some libraries or packages required because I have a fresh ubuntu 20.04. Do you know any library that is used by llvm that I should install?
I also tried following the Quick Start of the guide https://llvm.org/docs/CMake.html#quick-start and it gives me this error. So it might not be because of the options I used.
[ 98%] Linking CXX executable ../../bin/opt
collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
make[2]: *** [tools/opt/CMakeFiles/opt.dir/build.make:268: bin/opt] Error 1
make[2]: *** Deleting file 'bin/opt'
make[1]: *** [CMakeFiles/Makefile2:41476: tools/opt/CMakeFiles/opt.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
I also tried following the Quick Start of the guide https://llvm.org/docs/CMake.html#quick-start and it gives me this error. So it might not be because of the options I used.
[ 98%] Linking CXX executable ../../bin/opt collect2: fatal error: ld terminated with signal 9 [Killed] compilation terminated. make[2]: *** [tools/opt/CMakeFiles/opt.dir/build.make:268: bin/opt] Error 1 make[2]: *** Deleting file 'bin/opt' make[1]: *** [CMakeFiles/Makefile2:41476: tools/opt/CMakeFiles/opt.dir/all] Error 2 make: *** [Makefile:156: all] Error 2
It seems that you ran out of memory during linking. -DLLVM_PARALLEL_LINK_JOBS=1
or setting up a swap space may help.
It works with that flag.
I will try to figure out why with the project options it does not work.
The build with only the clang and clang tools extra options works and also with the polly option. So it is the compiler-rt option the one causing the error.
I always build shared libraries for LLVM. Could you please try with -DBUILD_SHARED_LIBS=ON
?
If it still doesn't work, I am sorry I cannot be more help.
I still get the same error. Thank you. I will post the solution when it works.
I'm getting the same error when I try to build compiler-rt.
This is a nix flake with the build I'm using: https://github.com/spaceandtimelabs/blitzar/blob/980857697abe388d99c3a183817a0b133b48051c/nix/clang.nix
If I uncomment this line to include compiler-rt, it fails with the similar message
/nix/store/74y3751gsixaz9797ib0hp7c658sp1y5-binutils-2.40/bin/ld: /build/llvm-project-6768a3d/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp:178: undefined reference to `typeinfo for __cxxabiv1::__vmi_class_type_info'
/nix/store/74y3751gsixaz9797ib0hp7c658sp1y5-binutils-2.40/bin/ld: /build/llvm-project-6768a3d/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp:178: undefined reference to `__dynamic_cast'
I tried some other options, but keep getting the same erorr. It looks like it's not linking libc++abi.
I am installing llvm in a clean build and I got a linker error when building it.
I have configured it with the following options.
And then when building it executing
cmake --build build
the following error appears.