[llvm-dev] Building SVN head with CMake - shared libraries?

Ismail Donmez via llvm-dev llvm-dev at lists.llvm.org
Mon Jan 18 03:27:50 PST 2016


Hi,

On Sun, Jan 17, 2016 at 9:53 PM, Dan Liew <dan at su-root.co.uk> wrote:
> @Brad: CC'ing you because I know you use
> ``llvm_map_components_to_libnames()`` so you will likely have
> something to say about it breaking.
>
> Okay Ismail, I took a much deeper look at this.

Thanks for the great analysis!

> In LLDB the problem occurs when ``cmake/modules/LLDBStandalone.cmake``
> tries to do
>
> ```
>   # Import CMake library targets from LLVM and Clang.
>   include("${LLDB_PATH_TO_LLVM_BUILD}/share/llvm/cmake/LLVMConfig.cmake")
> ```
>
> ``LLVMConfig.cmake`` will include ``LLVMExports.cmake`` which checks
> that the exported targets actually exist. The problem here is that you
> have removed those installed libraries from the install tree and the
> build system has know way of knowing that you were going to do this.
>
> The most obvious solution to me is to add an option to LLVM which
> informs CMake that you do not want to install the individual component
> libraries. If you don't need to install the component libraries that
> means you don't need to export the targets to ``LLVMExports.cmake`` in
> the install tree (note the ``LLVMExport.cmake`` in the build tree
> should still contain the targets).
>
> I tried implementing this by adding an extra option
> (LLVM_INSTALL_COMPONENT_LIBRARIES) which can be set to OFF in the
> attached patch (0001-Add-LLVM_INSTALL_COMPONENT_LIBRARIES-option-which-is.patch
> , apply against LLVM). It is a hack and I do not recommend using this
> in production. Instead it's more of a starting point for discussion. I
> ran into lots of problems because if the component libraries are not
> in the install tree then components that link against them and are
> installed can't be so I had hack some of the cmake macros/functions to
> link against libLLVM instead.

Indeed the correct solution would be such an option where we can skip
installing the components. The problem with installing the components
is that they are static libraries and in openSUSE we can't just ship
static libs to the end user. It would make updating libraries more
complicated and has security implications (even if it's less so for
llvm).

Regards,
ismail


More information about the llvm-dev mailing list