[postgis-devel] postgis' lwgeom needs -fPIC to compile on amd64

Vincent Schut schut at sarvision.com
Mon Nov 8 02:51:15 PST 2004


When compiling postgis from cvs, I get the following error on my amd64 
(gentoo linux) system:

<snip>
ranlib liblwgeom.a
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith 
-Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -g 
-fexceptions -I. -DFRONTEND -DSYSCONFDIR='"/usr//etc/postgresql"' 
-DUSE_VERSION=80 -DPOSTGIS_LIB_VERSION='"1.0.0"' 
-DPOSTGIS_SCRIPTS_VERSION='"0.1.0"' -I/usr/local/include -DUSE_GEOS 
-I/usr/local/include -DUSE_PROJ  -DUSE_STATS -fpic -shared 
-Wl,-soname,liblwgeom.so.1  misures.o box2d.o ptarray.o lwgeom_api.o 
lwgeom.o lwpoint.o lwline.o lwpoly.o lwmpoint.o lwmline.o lwmpoly.o 
lwcollection.o lwgeom_geos_wrapper.o wktunparse.o lwgparse.o 
wktparse.tab.o lex.yy.o vsprintf.o liblwgeom.o lwgeom_pg.o 
lwgeom_debug.o lwgeom_spheroid.o lwgeom_ogc.o 
lwgeom_functions_analytic.o lwgeom_geos.o lwgeom_inout.o 
lwgeom_estimate.o lwgeom_functions_basic.o lwgeom_gist.o lwgeom_btree.o 
lwgeom_transform.o stringBuffer.o lwgeom_box.o lwgeom_box3d.o 
lwgeom_box2dfloat4.o lwgeom_chip.o lwgeom_svg.o lwgeom_gml.o 
-L/usr/local/src/postgresql-8.0.0beta4/contrib/postgis-cvs/../../src/port 
-L/usr/local/src/postgresql-8.0.0beta4/contrib/postgis-cvs/../../src/port 
  -lstdc++ -L/usr/local/lib -lgeos -L/usr/local/lib -lproj 
-Wl,-rpath,/usr/lib -o liblwgeom.so.1.0
/usr/lib/gcc-lib/x86_64-pc-linux-gnu/3.3.4/../../../../x86_64-pc-linux-gnu/bin/ld: 
lwgeom_geos_wrapper.o: relocation R_X86_64_32S can not be used when 
making a shared object; recompile with -fPIC
lwgeom_geos_wrapper.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [liblwgeom.so.1.0] Error 1
make[1]: Leaving directory 
`/usr/local/src/postgresql-8.0.0beta4/contrib/postgis-cvs/lwgeom'
make: *** [liblwgeom] Error 2

This can be solved by adding -fPIC to the CFLAGS/CXXFLAGS in the 
Makefile in the lwgeom directory ('override CFLAGS += -fPIC')

Cheers,
Vincent.



More information about the postgis-devel mailing list