[llvm] [offload] Fix link issues when LLVM_LINK_LLVM_DYLIB on (PR #106583)
Joseph Huber via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 30 08:40:20 PDT 2024
jhuber6 wrote:
> > This is confusing, why would it be firing the constructors multiple times? If we link it statically then there should be no dynamic module. Are we somehow doing both?
>
> Yes. That is what I observed. The `target_link_libraries` calls modified by this commit add the static libs. The dynamic `LLVM` lib also ends up in the list of libraries to link against.
>
> LLVM provided functions such as `add_llvm_library` do the right thing and add either the `LLVM` dynamic lib or the provided static libs (see [llvm/cmake/modules/AddLLVM.cmake:741](https://github.com/llvm/llvm-project/blob/fab925651685505906416dca48469fd9f69ba39a/llvm/cmake/modules/AddLLVM.cmake#L741)).
>
> It seems we run into trouble when doing things ourselves.
I thought we did use `add_llvm_library`. We should probably just move the libraries there if so.
https://github.com/llvm/llvm-project/pull/106583
More information about the llvm-commits
mailing list