[lfs-dev] Stripping libraries

Tobias Gasser lfs at ebp-gasser.ch
Fri Aug 31 02:42:27 PDT 2012

Ragnar Thomsen schrieb:
> It is stated in LFS that --strip-unneeded should not be used on
> libraries, as the static ones will be destroyed.
> I found this page:
> http://www.technovelty.org/linux/
> Which states that --strip-unneeded is safe to use on both shared and
> static libraries, while --strip-all is only safe for shared ones.
> Being a minimalist, I am tempted to use --strip-unneeded on all
> libraries. Has anyone tried to see if this breaks a LFS system?

i use the following now for years:

if [ ! -L "$FILE" ]
  OK=$( file "$FILE" )
  if [ ! -z "$( echo $OK | grep ELF )" ]
    [ ! -z "( echo $OK | grep 'shared object') ] &&
        strip -p --strip-unneeded "$FILE"
    [ ! -z "( echo $OK | grep 'LSB executable' )" ] &&
        strip -p --strip-all "$FILE"

i install with DESTDIR and process all files with the above snippet
before building the installation-package. my script additionally
compresses all info files with gz (as bz2 or xz are not supported) and
all man files with xz.

More information about the lfs-dev mailing list