[postgis-users] Linking to the PostGIS library

strk at refractions.net strk at refractions.net
Thu Nov 16 01:10:41 PST 2006


On Wed, Nov 15, 2006 at 10:57:50AM +0000, Nathaniel wrote:
> Dear all,
> 
> I'm writing some C-functions to plug into postgres. Some of these  
> functions need to manipulate PostGIS geometries, so I'm trying to  
> link my code against the postgis library liblwgeom.so to make use of  
> the postgis functions that untangle geometries (e.g.  
> lwpoint_deserialize, lwpoint_getPointXX_p etc)
> 
> Header files are included, so my code compiles cleanly, but loading  
> the functions into postgres brings up "Symbol not found:  
> _lwgeom_deserialize" errors as postgres tries to find symbols defined  
> in my code and doesn't know to look in the postgis shared library to  
> find them.
> 
> I'm running macos10.4, postgres 8.1.4, postgis 1.1.6.
> 
> Presently, my "build script" is taken straight out the postgres manual:
> 
>     cc -I/usr/local/pgsql/include/server/ -I./postgis-1.1.6/lwgeom/ - 
> c foo.c
> 
>     cc -bundle -flat_namespace -undefined suppress -o libfoo.so foo.o;

Missing -llwgeom ?
Also -rpath might be useful as liblwgeom is likely *not* in your
default path.
Check with 'ldd' (or whatever apple changed it to)

--strk;



More information about the postgis-users mailing list