[postgis-devel] linkage against libpq.so (Sandro Santilli)

Sandro Santilli strk at keybit.net
Fri Oct 5 10:00:13 PDT 2012


On Fri, Oct 05, 2012 at 09:48:42AM -0700, Jeff Janes wrote:
> (Sandro Santilli wrote:)
> >
> > On Thu, Oct 04, 2012 at 07:42:42PM -0700, Jeff Janes wrote:
> >
> >> ticket: http://trac.osgeo.org/postgis/ticket/1830
> >
> > [..]
> >
> >> What I don't understand is why it is linking against an ancient libpq
> >> in the first place.  There is a perfectly modern libpq on my system,
> >> and it is located right where pg_config says it is.  So why isn't that
> >> one getting preferentially used?  postgis seems to be using pg_config
> >> to pick up other configuration settings, just not this one.
> >>
> >> I poked around in the Makefiles, but I can't figure it out.
> >
> > Are you saying that PGSQL_FE_LDFLAGS in loader/Makefile is wrong ?
> 
> I think that it is set properly:
> 
> PGSQL_FE_LDFLAGS=-L/usr/local/pgsql/lib -lpq
> 
> lrwxrwxrwx. 1 root root 12 Sep 26 11:06
> /usr/local/pgsql/lib/libpq.so.5 -> libpq.so.5.4
> 
> But for some reason, it does not seem to be taking effect.  If I do a
> "make install" (despite make check failing), then run the link
> debugger:
> 
> ldd /usr/local/pgsql/bin/pgsql2shp| fgrep pq
>         libpq.so.5 => /usr/lib64/libpq.so.5 (0x0000003660800000)
> 
> lrwxrwxrwx. 1 root root 12 Oct  4 11:18 /usr/lib64/libpq.so.5 -> libpq.so.5.2
> 
> So it is linking against the old version anyway.

In that case it's a system configuration issue, not a PostGIS one.
I think it is a feature that the postgis binaries and scripts adapt
to whatever library the linker provides. It's up to you to instruct
your linker. Try export LD_LIBRARY_PATH=/usr/local/pgsql/lib

> 
> If I remove the rpm which is providing /usr/lib64/libpq.so.5 and then
> redo the config, make, and make install from scratch, it still doesn't
> link the appropriate libpq, now it links nothing at all:
> 
> ldd /usr/local/pgsql/bin/pgsql2shp| fgrep pq
>         libpq.so.5 => not found

Did you ldconfig after the removal (I'm hoping in an rpm bug).
Or do you see any -rpath line in the loader's Makefile ?

--strk;

 http://www.cartodb.com - Map, analyze and build applications with your data

                                       ~~ http://strk.keybit.net 




More information about the postgis-devel mailing list