Date: Thu, 06 Sep 2007 10:14:12 +0200 From: Karol Kwiatkowski <karol.kwiat@gmail.com> To: Jeremy Chadwick <koitsu@FreeBSD.org> Cc: Scot Hetzel <swhetzel@gmail.com>, freebsd-ports@freebsd.org Subject: Re: How to get a static binary from ports Message-ID: <46DFB6D4.10509@gmail.com> In-Reply-To: <20070905200553.GA95962@eos.sc1.parodius.com> References: <46DEF93B.5050902@gmail.com> <20070905200553.GA95962@eos.sc1.parodius.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig0BF21B16F576DB46A28B7FDD Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Jeremy Chadwick wrote: > 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 >> (...)/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 (0x2816d= 000) >> 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? >=20 > 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. Yes, I'm aware of this. I was asked to do that so that the binary can be run on other systems. That's not my idea but as I understand, they can use only static binaries on some hosts. > 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. As Scot pointed in another email, I've already got them (.a files) The only step I'm missing is hot to include them in final binary instead of linking to .so libraries. > 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. Hmm... I've looked at cvsup but it's using M3FLAGS. I'll take a look at other ports, thanks for the tip! Cheers, Karol --=20 Karol Kwiatkowski <karol.kwiat at gmail dot com> OpenPGP 0x06E09309 --------------enig0BF21B16F576DB46A28B7FDD 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 iQEVAwUBRt+22whgT0HIecD5AQgvKAgAs/twdxjP9UMuEwGWg8yDcTnW8V1y4734 a8ym2qHf2M9YAPSaVT+exGc0nDXynBuTRW5RIGvfgitKTMcIvShSw8XrcNysIXBy WVQjPrAygj5dFmfV42QeQ3oqh49x0DaLjfSkP3cxP29G1oxuuz8DspObO03E2mup 2f7erxThIES5+ba26sBh4qHS+JybHb8Xm6GBzkxfHbPstvEugwfFkAMzzXEM2t5z lKvSrqgJqKJmIbx/ZRjFk52+xKT3I3S1wfNfQh91Kl/yy6zQytbgII97vBqTceKz Ms13njqkYQyo8tZfhxtLjnkJwdh6TNq/QfU5jFaxDL9t4T7lH3ZNXQ== =HkX6 -----END PGP SIGNATURE----- --------------enig0BF21B16F576DB46A28B7FDD--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46DFB6D4.10509>