Subject: Re: bug#11064: CRITICAL: libtool makes static linking impossible

From: Roumen Petrov <[email-masked]>
Date: Mon, 02 Apr 2012 23:54:42 +0300

Peter O'Gorman wrote:
> [SNIP]
> Ok, yes, that's annoying. This workaround just worked for me:
>
> ./configure CFLAGS='-static' LDFLAGS='-Xcompiler -static'
> make
The case is not useful. It may work for some projects but is not generic.

I will show by example OpenSSH  build . Note that OpenSSH does not use 
libtool

So lets try to build OpenSSH with :
1) .../configure CFLAGS='-static' LDFLAGS='-static'

Result is:
...
xxxx.c:(.text+0xNNNN): warning: Using '<NAME>' in statically linked 
applications requires at runtime the shared libraries from the glibc 
version used for linking
dso_dlfcn.c:(.text+0x5d4): warning: Using 'dlopen' in statically linked 
applications requires at runtime the shared libraries from the glibc 
version used for linking
...
... error ....cannot found -lgcc_s ....
....
, i.e. build fail

So next step:

2) .../configure CFLAGS='-static' LDFLAGS='-static  -shared-libgcc'
Result executable are build fine but regression tests crash with:
ssh-keygen: ../sysdeps/unix/sysv/linux/getpagesize.c:32: __getpagesize: 
Assertion `_rtld_global_ro._dl_pagesize != 0' failed.

3) .../configure CFLAGS='-static' LDFLAGS='-static  -static-libgcc'
same as 2)

[SNIP]
> 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.
[SNIP]

May be bug in my version of glibc prevent a ssh executable to run.

I'm not sure that this report is a bug neither feature request .

The current libtool behavior is fine with me.

Roumen