<div dir="ltr">Hi all,<div><br></div><div>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.</div><div><br></div><div>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:<br></div><div><br></div><div><div><font face="monospace, monospace">cmake $sources_path/llvm \</font></div><div><font face="monospace, monospace">             -G Ninja \</font></div><div><font face="monospace, monospace">             -DBUILD_SHARED_LIBS=On \</font></div><div><font face="monospace, monospace">             -DCMAKE_BUILD_TYPE=Release \</font></div><div><font face="monospace, monospace">             -DCMAKE_INSTALL_PREFIX=$target_path \</font></div><div><font face="monospace, monospace">             -DLLVM_ENABLE_ASSERTIONS=On \</font></div><div><font face="monospace, monospace">             -DLLVM_TARGETS_TO_BUILD=X86</font></div></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">cmake --build $build_dir --target llvm-ar<br></font></div><div><div><font face="monospace, monospace">cmake --build $build_dir --target install-llvm-ar</font><br></div></div><div><br></div><div>This compiles all the required shared libraries, but installs only the llvm-ar executable, which causes:</div><div><br></div><div><div><font face="monospace, monospace">$target_path/bin/llvm-ar --version</font></div><div><font face="monospace, monospace">build-env/sysroot/bin/llvm-ar: error while loading shared libraries: libLLVMX86CodeGen.so.5: cannot open shared object file: No such file or directory</font></div></div><div><br></div><div>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.</div><div><br></div><div>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?</div><div><br></div><div>Cheers,</div><div>Marcin</div></div>