FS#77691 - [llvm] Compile broken after update...
Attached to Project:
Arch Linux
Opened by Jordan Malek (jakjm) - Wednesday, 01 March 2023, 15:07 GMT
Last edited by Evangelos Foutras (foutrelis) - Saturday, 25 March 2023, 12:25 GMT
Opened by Jordan Malek (jakjm) - Wednesday, 01 March 2023, 15:07 GMT
Last edited by Evangelos Foutras (foutrelis) - Saturday, 25 March 2023, 12:25 GMT
|
Details
Description: Problem when compiling with clang and
llvm-15.0.7-2
Receiving the following errors following the update from llvm-15.0.7-1 to 15.0.7-2 when I compile my project. /usr/bin/ld: cannot find -lLLVMBitWriter: No such file or directory /usr/bin/ld: cannot find -lLLVMCore: No such file or directory Steps to reproduce: invoke clang or g++ using the -lLLVMBitWriter and -lLLVMCore library options. Additional info: * package version(s) * config and/or log files etc. * link to upstream bug report, if any Steps to reproduce: |
This task depends upon
Closed by Evangelos Foutras (foutrelis)
Saturday, 25 March 2023, 12:25 GMT
Reason for closing: Won't fix
Additional comments about closing: Please try using the "llvm_config(foo USE_SHARED <list-of-components>)" macro in your CMake project.
Saturday, 25 March 2023, 12:25 GMT
Reason for closing: Won't fix
Additional comments about closing: Please try using the "llvm_config(foo USE_SHARED <list-of-components>)" macro in your CMake project.
$ llvm-config --libs Core
-lLLVM-15
$ llvm-config --libs BitWriter
-lLLVM-15
The libs are there. Try running:
g++ `llvm-config --libs Core BitWriter`
The project uses CMake and I believe it's using the files inside /usr/lib/cmake/llvm (which I see is also provided by the llvm package) in order to generate the flags it uses somehow,
such as LLVMConfig.cmake
I am going to do a little snooping to see if I might stumble upon where the flag is being added - I don't have any experience with cmake so I won't be very efficient.
is it possible that one the of the files in the package (such as the files inside /usr/lib/cmake/llvm) adds the BitWriter and Core flag? Or is it the project that is at fault?
FS#77644(note especially the last comment in that ticket). Also note PM's commit message "Let's see if anything breaks after we remove them." It seems likely that projects will need to adapt.Most projects using CMake likely implement workarounds to be able to successfully link to libLLVM (instead of the individual component libraries).
[1] https://bugs.llvm.org/show_bug.cgi?id=35245
```
llvm_map_components_to_libnames(llvm_libs support core irreader)
```
Source: https://llvm.org/docs/CMake.html#embedding-llvm-in-your-project
I believe this should work for most cases: llvm_config(foo USE_SHARED <list-of-components>)
Again, the upstream issue for this is: https://github.com/llvm/llvm-project/issues/34593