[llvm-dev] Correctly linking against libLLVM (single shared library build)
Michal Srb via llvm-dev
llvm-dev at lists.llvm.org
Mon Oct 23 07:19:08 PDT 2017
Hi,
In SUSE we have recently switched from building LLVM as multiple shared
libraries (using BUILD_SHARED_LIBS) to building it as a single shared library
(using LLVM_BUILD_LLVM_DYLIB).
The multiple shared libraries build was causing issues and apparently it is
only meant for LLVM developers. Our guidelines prohibit linking against static
libraries unless there is no other option.
After this change, some external tools failed building because they try to
link against libraries given by the cmake function
`llvm_map_components_to_libnames`. This function returns library names as if
each component was in its own library. (LLVMSupport, LLVMCore, ...)
Usage of this function comes from documentation:
https://llvm.org/docs/CMake.html#embedding-llvm-in-your-project
1) Is `llvm_map_components_to_libnames` working as expected? Shouldn't it
return just "LLVM" if LLVM_BUILD_LLVM_DYLIB was used?
2) I saw that there is a `add_llvm_library` function that chooses between
using `llvm_map_components_to_libnames` or just using "LLVM" directly based on
LLVM_BUILD_LLVM_DYLIB. Is this function suitable for use by external projects?
It doesn't seem to be documented. Is there also equivalent for executables?
Thank you,
Michal Srb
More information about the llvm-dev
mailing list