From owner-freebsd-amd64@FreeBSD.ORG Tue Mar 17 13:04:44 2009 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 805CD106566B for ; Tue, 17 Mar 2009 13:04:44 +0000 (UTC) (envelope-from gdt@ir.bbn.com) Received: from fnord.ir.bbn.com (fnord-f.ir.bbn.com [IPv6:2001:4978:1fb:6240::47]) by mx1.freebsd.org (Postfix) with ESMTP id 0AA158FC1A for ; Tue, 17 Mar 2009 13:04:43 +0000 (UTC) (envelope-from gdt@ir.bbn.com) Received: by fnord.ir.bbn.com (Postfix, from userid 10853) id 80FAB53E7; Tue, 17 Mar 2009 09:04:42 -0400 (EDT) From: Greg Troxel To: PostGIS Users Discussion References: <49BEC13A.1000401@forestinformatics.com> X-Hashcash: 1:20:090317:postgis-users@postgis.refractions.net::KJoWVxjyxhidFfkW:0000000000000000000000000yYA X-Hashcash: 1:20:090317:freebsd-amd64@freebsd.org::KJoWVxjyxhidFfkW:0000000000000000000000000000000000006vMD Date: Tue, 17 Mar 2009 09:04:42 -0400 In-Reply-To: <49BEC13A.1000401@forestinformatics.com> (Jeff Hamann's message of "Mon, 16 Mar 2009 14:14:34 -0700") Message-ID: User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Mailman-Approved-At: Tue, 17 Mar 2009 13:53:26 +0000 Cc: freebsd-amd64@freebsd.org Subject: Re: [postgis-users] PostGIS+FreeBSD 6.0 (AMD64) and Shared object "libpq.so.5" not found X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Mar 2009 13:04:44 -0000 --=-=-= Content-Transfer-Encoding: quoted-printable Paul's suggestion of LD_LIBRARY_PATH should work, but for BSD shlib linking troubles there's a cleaner, although much harder, solution. I maintain the postgis package in pkgsrc, native to NetBSD and Dragonfly, often used on Darwin and Solaris, and usable on FreeBSD, OpenBSD, Linux, and assorted retrocomputing flavors like AIX - all to warn you that I'm being a a bit normative from the pkgsrc viewpoint. I'm also assuming an ELF world, even though I grew up on a.out. =2DL is used at link time to find the shared object, but this path information isn't used at runtime. There are several approaches to run-time linking, which are basically putting everything in /usr/lib, setting LD_LIBRARY_PATH to include places where libraries live, and using -rpath or -R to store run-time search paths in the binary. Linux seems to use a mix of 98% /usr/lib and 2% cope via LD_LIBRARY_PATH, and probably as a result autoconf and a lot of packages don't support -R very well. pkgsrc fixes this up by patching a lot of Makefiles and pkg-config files, and also passes -L/usr/pkg/lib =2DR/usr/pkg/lib to builds. In pkgsrc, libpq shows up as /usr/pkg/lib/libpq.la /usr/pkg/lib/libpq.a /usr/pkg/lib/libpq.so /usr/pkg/lib/libpq.so.4 /usr/pkg/lib/libpq.so.4.0.1 So I am presuming that you built pgsql with --prefix=3D/usr/local/pgsql and are perhaps building postgis with a different prefix. If you don't really need different prefixes, use the same one for postfix and pgsql. If you can use ports or pkgsrc, use that - others have already addressed your issue, plus the ones you haven't hit yet :-)q So ideally postgis's build procedure should, when processing the =2D-with-pgsql directive, add not only -L but also -R on systems that use =2DR. This is not a postgis-specific issue - just adding -L is the dominant paradigm - so I can't call this a postgis bug. It's really a bug in autoconf that doesn't have "figure out if rpath is used" and a "add lib to link line" constructs. This was long-winded, but basically LDFLAGS=3D"-L/usr/local/pgsql/lib -R/usr/local/pgsql/lib" ./configure should go a long way towards helping you out. In general you need to add CPPFLAGS and LDFLAGS in the environment to configure when you are using non-default paths. Or, you can grab pkgsrc and build pgsql and postgis from it, or spiff up FreeBSD ports to do the same (probably it does 99% already). random details from my system and config.status/config.log: gdt 2 ~ > ldd /usr/pkg/bin/pgsql2shp /usr/pkg/bin/pgsql2shp: -lc.12 =3D> /usr/lib/libc.so.12 -lintl.0 =3D> /usr/lib/libintl.so.0 -lcrypt.0 =3D> /usr/lib/libcrypt.so.0 -lcrypto.4 =3D> /usr/lib/libcrypto.so.4 -lssl.6 =3D> /usr/lib/libssl.so.6 -lresolv.1 =3D> /usr/lib/libresolv.so.1 -lpq.4 =3D> /usr/pkg/lib/libpq.so.4 How config.status sets up to re-execute configure: exec /bin/sh "./configure" '--enable-rpath' '--datadir=3D/usr/pkg/share/p= ostgresql/contrib' '--without-libintl-prefix' '--without-libiconv-prefix' '= --prefix=3D/usr/pkg' '--host=3Di386--netbsdelf' '--mandir=3D/usr/pkg/man' '= host_alias=3Di386--netbsdelf' 'CC=3Dcc' 'CFLAGS=3D-O2 -I/usr/pkg/include -I= /usr/include' 'LDFLAGS=3D-L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-= R/usr/lib' 'CPPFLAGS=3D-I/usr/pkg/include -I/usr/include' 'CXX=3Dc++' 'CXXF= LAGS=3D-O2 -I/usr/pkg/include -I/usr/include' $ac_configure_extra_args --no= -create --no-recursion ac_cv_env_LDFLAGS_value=3D'-L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl= ,-R/usr/lib' It was created by configure, which was generated by GNU Autoconf 2.60. Invocation command line was $ ./configure --enable-rpath --datadir=3D/usr/pkg/share/postgresql/contri= b --without-libintl-prefix --without-libiconv-prefix --prefix=3D/usr/pkg --= host=3Di386--netbsdelf --mandir=3D/usr/pkg/man configure:6699: result: SUMMARY configure:6701: result: --------------------------------------------------= ----- configure:6703: result:=20=20 configure:6705: result: HOST_OS: netbsdelf configure:6707: result:=20=20 configure:6709: result: PGSQL: /n0/gdt/NetBSD-current/pkgsrc/geography/p= ostgresql81-postgis/work/.buildlink/bin/pg_config configure:6719: result: GEOS: /usr/pkg/bin/geos-config (with C-API) configure:6721: result: (ldflags: -L/usr/pkg/lib -Wl,-R/usr/pkg/l= ib) configure:6727: result: PROJ: prefix=3D/usr/pkg libdir=3D/usr/pkg/lib configure:6731: result: ICONV: 1 -liconv configure:6734: result:=20=20=20 configure:6736: result: PORTNAME: netbsd configure:6738: result: PREFIX: /usr/pkg configure:6740: result: EPREFIX: ${prefix} configure:6742: result: DOC: ${prefix}/share/doc configure:6744: result: DATA: /usr/pkg/share/postgresql/contrib configure:6746: result: MAN: /usr/pkg/man configure:6748: result: BIN: ${exec_prefix}/bin configure:6754: result: EXT: ${exec_prefix}/lib (${exec_prefix}/lib) configure:6758: result: --------------------------------------------------= ----- --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (NetBSD) iEYEARECAAYFAkm/n+oACgkQ+vesoDJhHiVibwCfSpMGcL2COVYpY8Pc9t3LZNV0 1lUAn1V2JMdH9WB/v3p360KUQCupN4GG =rZeY -----END PGP SIGNATURE----- --=-=-=--