From owner-freebsd-ports@FreeBSD.ORG Fri Sep 7 11:42:31 2007 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60E4516A419 for ; Fri, 7 Sep 2007 11:42:31 +0000 (UTC) (envelope-from karol.kwiat@gmail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.185]) by mx1.freebsd.org (Postfix) with ESMTP id E01B213C468 for ; Fri, 7 Sep 2007 11:42:30 +0000 (UTC) (envelope-from karol.kwiat@gmail.com) Received: by nf-out-0910.google.com with SMTP id k4so362322nfd for ; Fri, 07 Sep 2007 04:42:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:user-agent:mime-version:to:subject:references:in-reply-to:x-enigmail-version:openpgp:content-type; bh=MulzyfykYJ/GnNgw8O9JdV3fLmsZa68mFFF+YNRimKQ=; b=nyrbXK8wumnEhYQkWMLVBaJAEqRDttpdIGN0RxPsiWyOKoYM3/hS3RdHiztTGOqtY/cbo0kBJ6hwQXG0+J2JJtQtItmK/GQwI8YZlMBq0aitAUYxdn2mvMWW454VrTqOeWI5NIodmfCIYUwRYtfihTyoZ19DnGgUDYVB8qxNMXw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:reply-to:user-agent:mime-version:to:subject:references:in-reply-to:x-enigmail-version:openpgp:content-type; b=J3HRfsOGja3+12fCh73fj+/2SMuKnrsSjDo2TwuAW9J3vPjL2qnpIRQH3fAAvyeNWeTlmTx6cVDucPPCSE3rihOk6g4lO1ls9XtGqT+ClR4xKh5DQtFfCwbjjYUsdgHpMNEfZCxvdeyVEUkUBMWrLZENYfs1Ny8nkmrEEANP6dE= Received: by 10.78.204.7 with SMTP id b7mr715941hug.1189165348935; Fri, 07 Sep 2007 04:42:28 -0700 (PDT) Received: from persephone.orchid.homeunix.org ( [84.10.173.180]) by mx.google.com with ESMTPS id c18sm239114hub.2007.09.07.04.42.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 07 Sep 2007 04:42:28 -0700 (PDT) Message-ID: <46E13922.4060004@gmail.com> Date: Fri, 07 Sep 2007 13:42:26 +0200 From: Karol Kwiatkowski User-Agent: Thunderbird 2.0.0.6 (X11/20070803) MIME-Version: 1.0 To: freebsd-ports@freebsd.org References: <46DEF93B.5050902@gmail.com> In-Reply-To: <46DEF93B.5050902@gmail.com> X-Enigmail-Version: 0.95.2 OpenPGP: id=06E09309; url=http://www.orchid.homeunix.org/carlos/gpg/0x06E09309.asc Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigBBAD6BB49E258888BB520B0C" Subject: Re: How to get a static binary from ports X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: karol.kwiat@gmail.com List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2007 11:42:31 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigBBAD6BB49E258888BB520B0C Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable Karol Kwiatkowski wrote: > Hi all, >=20 > to keep it short: >=20 > is there any ports knob to statically link binaries? > If not, what steps should I take to modify a port? >=20 > longer version: >=20 > 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. >=20 > The port in question is databases/rrdtool, uses libtool:15, gnu > configure, gmake, etc. >=20 > Normally, this port builds rrdtool binary which is dynamically linked > (full path removed for brevity): >=20 > # 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 (0x281270= 00) > libm.so.5 =3D> /lib/libm.so.5 (0x2813c000) > libc.so.7 =3D> /lib/libc.so.7 (0x28151000) >=20 > With 'make CFLAGS+=3D-static' I get: >=20 > # 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 (0x2816d0= 00) > libm.so.5 =3D> /lib/libm.so.5 (0x28182000) > libc.so.7 =3D> /lib/libc.so.7 (0x28197000) >=20 > 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. >=20 > How can I include the rest of the libraries in the binary? OK, it seems it's a problem with rrdtool's build suite, and not only I've got problems with it[1]. For the archives, in case of rrdtool's port, a simple workaround is to patch src/Makefile (exists after 'configure' part, so those patches are host's dependent): # cat src_Makefile.patch --- src/Makefile.orig 2007-09-06 14:01:07.000000000 +0200 +++ src/Makefile 2007-09-06 15:13:15.000000000 +0200 @@ -183,7 +183,7 @@ INSTALL_PROGRAM =3D install -s -o root -g wheel -m 555 INSTALL_SCRIPT =3D install -o root -g wheel -m 555 INSTALL_STRIP_PROGRAM =3D ${SHELL} $(install_sh) -c -s -LDFLAGS =3D -L/usr/local/lib +LDFLAGS =3D -all-static -L/usr/local/lib LIBOBJS =3D LIBS =3D LIBTOOL =3D $(SHELL) /usr/local/bin/libtool And while we're here it might be worth changing path to default font so the binary can work as a 'standalone' (here to 'current'): @@ -301,7 +301,7 @@ # #ACLOCAL_M4 =3D $(top_srcdir)/config/aclocal.m4 #AUTOHEADER =3D ${SHELL} /mnt/big/FreeBSD/work/usr/ports/databases/rrdtool/work/rrdtool-1.2.23/mis= sing --run autoheader --localdir=3D$(top_srcdir)/config -fontsdir =3D $(datadir)/rrdtool/fonts +fontsdir =3D . fonts_DATA =3D DejaVuSansMono-Roman.ttf AM_CPPFLAGS =3D -DRRD_DEFAULT_FONT=3D\"$(RRD_DEFAULT_FONT)\" -DNUMVERS=3D= 1.2023 UPD_C_FILES =3D \ Cheers and thanks for the pointers. Karol [1] http://ramblingfoo.blogspot.com/2007/08/softfloat-rrdtool-sequel.html= --=20 Karol Kwiatkowski OpenPGP 0x06E09309 --------------enigBBAD6BB49E258888BB520B0C 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 iQEVAwUBRuE5IghgT0HIecD5AQjaLwf+NIw0pb+QGSlwMgL65TTZP8WmQDrvgi2Z Fb76QUaJwXYClrnXgC5Rhf038Ns3MDMyeoE/jEEwbGQAhCfDgOGI3BKSuY9m5J7Z KSMt8Kihp3S36wGDWpWqE1z8AxdGSnTTbvO7u5VCVtAIviAqIujnTirXxGUAg4KP 2kQw3n7C1it0leqNB9Ce1N848UZbisMiKjF/mcbKHZ8Vcu8giVvGe/EnYlaD5j55 SD0WIpZTtRJut5/sC4w8dwrwKoAICL5T9yqS1A0PH126X2xDSMBly8+HQuAdVDIx 3tC4PeOQIT95xTG910Xd09+smpLNIrEIzjhLHIl7WYMuMM0Hm786mw== =M8SZ -----END PGP SIGNATURE----- --------------enigBBAD6BB49E258888BB520B0C--