bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11064: CRITICAL: libtool makes static linking impossible


From: Peter O'Gorman
Subject: bug#11064: CRITICAL: libtool makes static linking impossible
Date: Thu, 22 Mar 2012 16:18:52 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.22) Gecko/20110906 Fedora/3.1.14-1.fc14 Thunderbird/3.1.14

Hi,

[added back the bug email to track this]

On 03/22/2012 11:06 AM, Rich Felker wrote:
On Thu, Mar 22, 2012 at 10:45:06AM -0500, Peter O'Gorman wrote:

does:
../configure CC='gcc -static' CXX='g++ -static' ...

work around this for you?

I think the -static, -all-static etc libtool flags were meant for
Makefiles, not really for user LDFLAGS.

No, it does not. My situation is trying to compile static-linked GNU
binutils. I tried putting -static in CC (like you suggested), CFLAGS,
and LDFLAGS. Each time, it appeared on the libtool command line and
disappeared on the second command line where libtool invoked gcc.

Ok, yes, that's annoying. This workaround just worked for me:

./configure CFLAGS='-static' LDFLAGS='-Xcompiler -static'
make

But my gcc does not error for the unrecognized option during configure, it's possible that newer gccs will. That binutils runs configure in subdirs during the build makes it even more annoying to work around. If your gcc errors out with the -Xcompiler flag, you'll have to make a wrapper script for the compiler (one that takes a flag that libtool doesn't remove from the link line). Ick.


I also tried -Wl,-Bstatic and that failed because gcc was unaware of
the static option and passed -lgcc_s to the linker instead of
-lgcc_eh.

You could have tried -static-libgcc, but ...


The fundamental problem is that libtool has commandeered a command
line option that's meant for user LDFLAGS (to request a static binary)
and redefined it to mean "I only want project-internal libraries to be
linked statically, but I still want my binary dynamic-linked to system
libraries." And in the process, it's made it completely impossible to
build static binaries.

I agree this is a problem, will go looking for the history of the -static libtool flag and see what we can do.

Peter






reply via email to

[Prev in Thread] Current Thread [Next in Thread]