[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Building all static
From: |
Gary V. Vaughan |
Subject: |
Re: Building all static |
Date: |
Tue, 02 Nov 2004 12:39:10 +0000 |
User-agent: |
Mozilla Thunderbird 0.8 (X11/20040913) |
Hi Bill,
Bill Moseley wrote:
> Sorry for the cross post, not sure which is the correct list.
>
> My project builds a library and then builds a binary and links to that
> library. Someone has asked how to build a completely static binary.
$ libtool --help --mode=link | grep static
-all-static do not do any dynamic linking at all
-static do not do any dynamic linking of libtool libraries
> 1) The configure option --disable-shared works at linking our binary
> with our library statically, but still links the binary dynamically
> with other libraries. I assume that's correct behavior. What does
> the --enable-static option do (or suppose to do)? It seems to have no
> effect when I use it.
>From libtool.info(The `AC_PROG_LIBTOOL' macro):
- Macro: AC_DISABLE_STATIC
- Macro: AM_DISABLE_STATIC
Change the default behaviour for `AC_PROG_LIBTOOL' to disable
static libraries. The user may still override this default by
specifying `--enable-static'.
> 2) Is there a "standard" way to run configure that should build a
> completely static binary?
Assuming libtool is doing all your linking:
./configure LDFLAGS='-all-static'
You can find out what the magic flag for your compiler is by looking at
the AC_LIBTOOL_PROG_COMPILER_PIC in libtool.m4 (_LT_COMPILER_PIC in 2.0
alpha releases). And then you could add that manually with:
make LDFLAGS=flag-from-libtool.m4
> Another message which seems related:
>
> http://lists.gnu.org/archive/html/bug-libtool/2002-07/msg00055.html
This raises a good point. And although the static link issue comes up
occasionally, I don't use it myself and handn't thought too deeply about
it.
Does anyone use libtool's -static flag to deliberately link statically
against libtool libraries only? I would have thought that it is far
more common to want all-static behaviour.
Unless someone shouts me down, then according to the principle of least
surprise, I'm inclined to change the semantics to:
-static do not do any dynamic linking at all
-lt-static do not do any dynamic linking of libtool libraries
(We can keep -all-static as an alias to -static).
Cheers,
Gary.
--
Gary V. Vaughan ())_. address@hidden,gnu.org}
Research Scientist ( '/ http://tkd.kicks-ass.net
GNU Hacker / )= http://www.gnu.org/software/libtool
Technical Author `(_~)_ http://sources.redhat.com/autobook
signature.asc
Description: OpenPGP digital signature
Re: Building all static, Bob Friesenhahn, 2004/11/02