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".

This wiki is not a forum for discussion of usage issues. Please use the list instead. We do not allow creation of comments by anonymous or untrusted users, on any page.
Site Status

Site maintenance performed successfully, site online Dec 13th 12:00 AM Eastern.