Ticket #88 (closed enhancement: fixed)

Opened 2 years ago

Last modified 9 months ago

Stripping

Reported by: bjorn@bringert.net Assigned to:
Priority: high Milestone: Cabal-1.4
Component: Cabal library Version:
Severity: normal Keywords:
Cc: dons@galois.com Difficulty: very easy (<1 hour)
GHC Version: 6.4.2 Platform:

Description

Cabal should include facilities for stripping executables, since this can substantially reduce their size. It would have to locate a "strip" program, and there could be a build information field controlling whether to strip or not, e.g.:

Strip: True | False

Maybe there should be more precise control over what symbols to remove.

Change History

07/17/06 13:04:18 changed by guest

  • type changed from defect to enhancement.

08/02/06 10:03:50 changed by duncan

I don't think it should go in the .cabal file, but perhaps as an argument to install it'd be ok.

Example: runhaskell Setup.hs install --strip

Note that we should not necessarily make it the default, or if we do allow striping to be turned off as some packaging systems prefer to do the striping themselves or strip symbols and install them seperately for debugging purposes.

Also note the stripping makes no sense for some Haskell implementations (eg hugs and yhc).

05/24/07 06:52:02 changed by guest

  • priority changed from normal to high.

01/14/08 12:47:08 changed by duncan

It seems that we cannot portably strip .a files. On solaris doing so removes the symbol index which is required for linking:

     If   strip  is  executed  on  a  common  archive  file  (see
     ar(3HEAD)) in addition to processing the members, strip will
     remove the archive symbol table. The  archive  symbol  table
     must  be restored by executing the ar(1) command with the -s
     option before the archive can be linked by  the  ld(1)  com-
     mand.  strip  will produce appropriate warning messages when
     this situation arises.

With GNU strip it seems to be ok and only remove stuff from within the individual .o files within the .a archive. The install program that automake uses only seems to strip binary executables, not library archives so we should probably do the same. If you think otherwise then complain now.

So I suggest we only strip on installation, that we do it by default and add an install flag to turn it off (eg some distro packaging systems prefer to manage striping themselves).

01/24/08 07:52:15 changed by duncan

  • platform deleted.
  • milestone set to Cabal-1.4.

02/11/08 16:46:26 changed by dons

  • cc set to dons@galois.com.

03/17/08 12:49:45 changed by duncan

  • difficulty changed from normal to very easy (<1 hour).

Partly done:

Mon Mar 17 19:32:14 GMT 2008  Duncan Coutts <duncan@haskell.org>
  * Strip executables during installation for ghc
  Does not yet have a configure flag to turn this behaviour on and off.
  That can wait until after the command line flag infrastructure changes.

As the commit message says, we still need to add a command line flag to enable/disable. It'll be enabled by default but we do need to make it possible to disable if for no other reason than some distros prefer to handle stripping themselves.

The flag will be a configure flag --enable/disable-executable-stripping. The rationale for it being a configure rather than install flag is that we would in any case need it as a flag for cabal-install's install command, which takes all the flags for the underlying configure command.

It'll also need documenting.

Once the command line changes are done, the remaining task is easy. Marking as such.

03/19/08 15:25:13 changed by duncan

  • status changed from new to closed.
  • resolution set to fixed.

Done. The option to turn it on/off has been added and it's documented in the user guide:

Wed Mar 19 12:09:24 GMT 2008  Duncan Coutts <duncan@haskell.org>
  * Add --enable/disable-executable-stripping option
  The default is enabled

Wed Mar 19 12:12:12 GMT 2008  Duncan Coutts <duncan@haskell.org>
  * Documentation the --enable/disable-executable-stripping options