[llvm-dev] Combining install-distribution with binary stripping

Shoaib Meenai via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 21 19:32:32 PST 2017


Hi all,

I want to use the LLVM_DISTRIBUTION_COMPONENTS support to create an installed
toolchain image (via the install-distribution target). I'd also like the
installed binaries to be stripped.

If you're invoking a cmake install script directly, you can pass
-DCMAKE_INSTALL_DO_STRIP=1 to cmake to request stripping. The install-*
targets set up by LLVM's build system don't seem to have any provision for
this though, as far as I can tell. I also can't figure out a way to pass cmake
this option apart from just putting it in the invocation (and the cmake
invocation here is controlled by the install-* target).

I could go ahead and change the cmake invocation in all the install-* targets
to (conditionally) enable stripping, but the creation of the various install-*
targets is spread throughout the build system (a quick grep shows at least 20
of them spread around LLVM, clang, LLD, and libcxx), so it's a bit ugly. It's
obviously not hard to do (just tedious), and I'll put up some patches for that
if I can't figure out anything better, but I wanted to ask for suggestions
before embarking down that route.

Other solutions I've considered:
* Strip the installed files manually after the installation. Also ugly.
* Abandon LLVM_DISTRIBUTION_COMPONENTS and just build the components
  individually and then invoke the installation scripts myself. The
  distribution component setup is much nicer though :(

Thanks,
Shoaib




More information about the llvm-dev mailing list