Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Sep 2007 20:45:15 +0200
From:      Karol Kwiatkowski <karol.kwiat@gmail.com>
To:        freebsd-ports@freebsd.org
Subject:   How to get a static binary from ports
Message-ID:  <46DEF93B.5050902@gmail.com>

next in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigDC08E5FF3F3275098E2ED5BA
Content-Type: text/plain; charset=ISO-8859-2
Content-Transfer-Encoding: quoted-printable

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 =3D> not found (0x0)
    libfreetype.so.9 =3D> /usr/local/lib/libfreetype.so.9 (0x28085000)
    libpng.so.5 =3D> /usr/local/lib/libpng.so.5 (0x280ef000)
    libz.so.4 =3D> /lib/libz.so.4 (0x28115000)
    libart_lgpl_2.so.5 =3D> /usr/local/lib/libart_lgpl_2.so.5 (0x28127000=
)
    libm.so.5 =3D> /lib/libm.so.5 (0x2813c000)
    libc.so.7 =3D> /lib/libc.so.7 (0x28151000)

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

# ldd (...)/work/rrdtool-1.2.23/src/rrdtool
(...)/work/rrdtool-1.2.23/src/rrdtool:
    libfreetype.so.9 =3D> /usr/local/lib/libfreetype.so.9 (0x280cb000)
    libpng.so.5 =3D> /usr/local/lib/libpng.so.5 (0x28135000)
    libz.so.4 =3D> /lib/libz.so.4 (0x2815b000)
    libart_lgpl_2.so.5 =3D> /usr/local/lib/libart_lgpl_2.so.5 (0x2816d000=
)
    libm.so.5 =3D> /lib/libm.so.5 (0x28182000)
    libc.so.7 =3D> /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

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


--------------enigDC08E5FF3F3275098E2ED5BA
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQEVAwUBRt75QwhgT0HIecD5AQicAgf+LUExwBWb21DOg2NV8JtfaJWtUQ5slPn8
s9d35U8kLuYzZwd+ekV0GYAdAkd4vkEIcKRBBZlQNqj4eznt4u86OYrIqX7nqSVo
sNWxGKyw94yq8l4LTpBtY2utLdG+tlVB/wM1GC7zeYLU3CQ4tEYCAGJfWmtmQmYE
i/tZoAPQpcFs4xPLG+209qaYTcYEQfb++VjSHLhvYYiuvQbwgrdUO2rKMqqRln8/
Bm4iA8BwecVBoUZLS00npiXgNTUiQgKPxJxTAvF04Tk/v5EhG43hGhzd9wUbFpyg
eYdujWJC6pe2SRq/l861/xNHgK7fmhaAcWVML7ZRcC3K1OMmMTu4mQ==
=jmmZ
-----END PGP SIGNATURE-----

--------------enigDC08E5FF3F3275098E2ED5BA--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46DEF93B.5050902>