How to get a static binary from ports

Karol Kwiatkowski karol.kwiat at gmail.com
Wed Sep 5 12:14:12 PDT 2007


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?

longer version:

I'm trying to get a static binary out of the port. I thought it should
be straight and easy, but I'm lost right now.

The port in question is databases/rrdtool, uses libtool:15, gnu
configure, gmake, etc.

Normally, this port builds rrdtool binary which is dynamically linked
(full path removed for brevity):

# ldd (...)/work/rrdtool-1.2.23/src/.libs/rrdtool
(...)/work/rrdtool-1.2.23/src/.libs/rrdtool:
    librrd.so.2 => not found (0x0)
    libfreetype.so.9 => /usr/local/lib/libfreetype.so.9 (0x28085000)
    libpng.so.5 => /usr/local/lib/libpng.so.5 (0x280ef000)
    libz.so.4 => /lib/libz.so.4 (0x28115000)
    libart_lgpl_2.so.5 => /usr/local/lib/libart_lgpl_2.so.5 (0x28127000)
    libm.so.5 => /lib/libm.so.5 (0x2813c000)
    libc.so.7 => /lib/libc.so.7 (0x28151000)

With 'make CFLAGS+=-static' I get:

# ldd (...)/work/rrdtool-1.2.23/src/rrdtool
(...)/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?

Thanks in advance.

Karol

-- 
Karol Kwiatkowski   <karol.kwiat at gmail dot com>
OpenPGP 0x06E09309

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 542 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20070905/de081f1e/signature.pgp


More information about the freebsd-ports mailing list