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

Justin Bogner via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 27 13:24:07 PST 2017

Shoaib Meenai via llvm-dev <llvm-dev at lists.llvm.org> writes:
> 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.

I was pretty sure this "Just Works", in that I use this and get stripped
executables already. It turns out that's because I use
-DLLVM_EXTERNALIZE_DEBUGINFO, which actually strips the binaries in the
build's bin/ before install targets even happen. Could that work for you?

> 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