[llvm-dev] Installing selected subset of LLVM Tools with shared build

Marcin SÅ‚owik via llvm-dev llvm-dev at lists.llvm.org
Sat Jul 1 08:37:06 PDT 2017

Hi all,

I have an application that requires a select subset of LLVM tools to be
installed into a custom-built sysroot. Until recently, I've been building
LLVM statically and everything seemed fine, but recently, due to disk space
limits, I have decided to give shared build a try.

The problem I encountered, however, is that when I ask `ninja` to only
build and install a specific component, its dependencies are being built,
but not installed. In particular:

cmake $sources_path/llvm \
             -G Ninja \
             -DBUILD_SHARED_LIBS=On \
             -DCMAKE_BUILD_TYPE=Release \
             -DCMAKE_INSTALL_PREFIX=$target_path \

cmake --build $build_dir --target llvm-ar
cmake --build $build_dir --target install-llvm-ar

This compiles all the required shared libraries, but installs only the
llvm-ar executable, which causes:

$target_path/bin/llvm-ar --version
build-env/sysroot/bin/llvm-ar: error while loading shared libraries:
libLLVMX86CodeGen.so.5: cannot open shared object file: No such file or

Is there a way to force the existing build system to also install
dependencies, when using `install-$tool` target? AFAIK, plain `install`
builds and installs everything, which would require a manual search through
the output directory in order to clean up the unneeded tools.

Alternatively, is there an easy way to list the targets required by a
specific component in such a way, a proper collection of install targets
can be invoked later?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170701/58904e2a/attachment.html>

More information about the llvm-dev mailing list