HOWTO Sneak GCC Switches Past Libtool

When you build a package whose build system relies on libtool, it could be a problem to specify GCC command-line options that libtool does not understand. A frequent case in point is that you want to specify -static-libgcc or -static-libstdc++, to avoid run-time dependencies on libgcc or libstdc++ DLLs.

The problem here is that libtool will not pass to GCC any switches it does not explicitly understand and support. So, for example, specifying LDFLAGS='-static-libgcc' during the configure step will not work: libtool will not pass that switch to GCC.

A work-around is to specify a custom value for the compiler that includes the switch you want to sneak in. Like this:

  CC='gcc -static-libgcc' ./configure ...

This work-around is documented in the "FAQ" chapter of the libtool Info manual, so it is "official".

Site Status

Site maintenance completed May 25th, 2012 at 12:38 UTC