How to get a static binary from ports
koitsu at FreeBSD.org
Wed Sep 5 13:06:00 PDT 2007
On Wed, Sep 05, 2007 at 08:45:15PM +0200, Karol Kwiatkowski wrote:
> Hi all,
> to keep it short:
> is there any ports knob to statically link binaries?
> If not, what steps should I take to modify a port?
> # ldd (...)/work/rrdtool-1.2.23/src/rrdtool
> libfreetype.so.9 => /usr/local/lib/libfreetype.so.9 (0x280cb000)
> libpng.so.5 => /usr/local/lib/libpng.so.5 (0x28135000)
> libz.so.4 => /lib/libz.so.4 (0x2815b000)
> libart_lgpl_2.so.5 => /usr/local/lib/libart_lgpl_2.so.5 (0x2816d000)
> libm.so.5 => /lib/libm.so.5 (0x28182000)
> libc.so.7 => /lib/libc.so.7 (0x28197000)
> librrd.so.2 is now included statically, but the rest is not. I tried
> various configure options like --enable-static, --disable-shared, also
> added '-static' to CFLAGS and/or LDFLAGS in Makefile plus various
> combinations of the above but that doesn't make a difference.
> How can I include the rest of the libraries in the binary?
Why do you need this suite of applications statically-linked? There
are many downsides to using statically-linked binaries, and many
positives to using shared libraries. If you want to know the pros and
cons to static (the cons outweigh the pros), I will be more than happy
to provide you a detailed explanation.
To directly answer your question: you need to build all the rest of
those libraries as static as well; that is to say, you need
libfreetype.a, libpng.a, libart_lgpl_2.a and so on.
AFAIK, there is no "easy" way to do this. Each port has to be built
with static capabilities. I believe an example port which does this
is net/cvsup, using either the STATIC or WITH_STATIC knob.
| Jeremy Chadwick jdc at parodius.com |
| Parodius Networking http://www.parodius.com/ |
| UNIX Systems Administrator Mountain View, CA, USA |
| Making life hard for others since 1977. PGP: 4BD6C0CB |
More information about the freebsd-ports