[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Building all static
From: |
Bill Moseley |
Subject: |
Re: Building all static |
Date: |
Wed, 3 Nov 2004 11:14:47 -0800 |
User-agent: |
Mutt/1.5.6+20040907i |
> Libtool, however, is certainly doing the wrong thing wrt -static. We
> haven't quite figured out what the right thing is though. Yet.
I'm not following the details of this discussion, but I'll add my
comment as an end-user and a casual developer.
As a developer I don't really care about the option names as long as
they are documented as to what they generate.
Our project has a shared library, a convenience library and links with
libz and libxml2.
So, I use -static to build all the code I control statically for
debugging (that's libswish-e and our convenience library). Then maybe
use -all-static to link in libxml2 and libz into a stand alone program
that can be copied places that may not have libxml2 and libz. People
sometimes ask about building a *completely* static binary (which I
guess is -all-static now), but as Bob Friesenhahn commented that may
not be that good of an idea these days.
>From our user's point of view, it's a bit confusing having a
--disable-shared configure option, but also have -static and
-all-static that are specified at make time. My guess is people
expect that configure should be used to control the entire build process.
It's also a bit confusing since it seems --disable-shared does
something different than -static.
As I mentioned, we link with libxml2 and libz our own shared lib and a
convenience lib. Normally it looks like this:
$ ldd /usr/local/bin/swish-e
libxml2.so.2 => /usr/lib/libxml2.so.2 (0x40027000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40122000)
libz.so.1 => /usr/lib/libz.so.1 (0x40132000)
libswish-e.so.2 => /usr/local/lib/libswish-e.so.2 (0x40144000)
libm.so.6 => /lib/tls/libm.so.6 (0x4017a000)
libc.so.6 => /lib/tls/libc.so.6 (0x4019d000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
Here's using -static:
$ ./configure >/dev/null && make LDFLAGS=-static >/dev/null && file src/swish-e
src/swish-e: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for
GNU/Linux 2.2.0, dynamically linked (uses shared libs), not stripped
$ ldd src/swish-e
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40027000)
libz.so.1 => /usr/lib/libz.so.1 (0x40036000)
libm.so.6 => /lib/tls/libm.so.6 (0x40049000)
libc.so.6 => /lib/tls/libc.so.6 (0x4006c000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
I don't really understand why libxml2 got linked in statically and not
libz. I assume that's an issue in my Makefile.am file or how we setup
libz and libxml2 in our configure script.
And using --disable-shared only just links in our library (libswish-e)
statically.
$ ./configure --disable-shared >/dev/null && make >/dev/null && file src/swish-e
src/swish-e: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for
GNU/Linux 2.2.0, dynamically linked (uses shared libs), not stripped
$ ldd src/swish-e
libxml2.so.2 => /usr/lib/libxml2.so.2 (0x40027000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40122000)
libz.so.1 => /usr/lib/libz.so.1 (0x40132000)
libm.so.6 => /lib/tls/libm.so.6 (0x40144000)
libc.so.6 => /lib/tls/libc.so.6 (0x40167000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
--
Bill Moseley
address@hidden
- Re: Building all static, (continued)
- Re: Building all static, Peter O'Gorman, 2004/11/03
- Re: Building all static, Gary V. Vaughan, 2004/11/03
- Re: Building all static, Bob Friesenhahn, 2004/11/03
- Re: Building all static, Peter O'Gorman, 2004/11/03
- Re: Building all static, Gary V. Vaughan, 2004/11/03
- Re: Building all static, Peter O'Gorman, 2004/11/03
- Re: Building all static, Gary V. Vaughan, 2004/11/02
- Re: Building all static, Bob Friesenhahn, 2004/11/02
Re: Building all static, Bill Moseley, 2004/11/03