This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.

Please visit our production wiki at https://wiki.gentoo.org

Project:LLVM/Shared libraries

From Gentoo Wiki (test)
Jump to:navigation Jump to:search

This page provides the rationale for installing LLVM with shared split libraries.

Kinds of library installs supported by LLVM

LLVM supports building and installing two kinds of libraries: the split libraries and an additional combined library.

The split libraries are separate for each subcomponent of LLVM. They can be built either as static or shared libraries (but not both). Upstream defaults to using static libraries. They names are like libLLVMFoo.a or libLLVMFoo.so.X.

The combined library (dylib) is an optional library that combines all subcomponents of LLVM. It is always a shared library, and its name differs across systems, and is e.g. libLLVM-X.Y.so on Linux.

Build system support for different kinds of libraries

Today, llvm-config can output correct library lists both for split and combined library variants, respecting requested linkage mode (static or shared). However, many build systems still support only split variant of libraries, i.e. hardcode specific libraries. This is partially related to the fact that for a long time LLVM lacked proper exposure of the dylib name, and e.g. Mesa had to guess/reconstruct it from LLVM version.

Gentoo install layout

The recent LLVM versions in Gentoo install split libraries as shared libraries, and do not install the dylib since it is redundant to the split shared libraries. No static libraries are installed.

This matches the needs of most of the build systems out there. Build systems that do not support the dylib explicitly will still find split libraries, and since they are installed in shared variant only there will be no accidental static linkage. This is in the best interest of code reuse and security. Furthermore, it encourages using correct dependencies.

Static linking to LLVM is not supported on Gentoo. Most of the need for static linking should be satisfiable by slotted LLVM packages.

While upstream officially discourages using split shared libraries, they keep that layout working and accept all patches needed for it to work.