LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-25-2009, 12:23 PM   #1
Bascom49
LQ Newbie
 
Registered: Dec 2009
Posts: 2

Rep: Reputation: 0
Can someone help me understand how to fix my recompile with -fPIC error ?


I'm setting up a Mapserver installation on a 64 bit Linux machine and get the following error during make :

/projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/shp_vsi.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigeraltname.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigerarealandmarks.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigercompletechain.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigerentitynames.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigerfeatureids.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigerfilebase.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigeridhistory.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigerkeyfeatures.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigerlandmarks.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigeroverunder.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigerpip.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigerpoint.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigerpolychainlink.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigerpolygoncorrections.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigerpolygoneconomic.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigerpolygon.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigerspatialmetadata.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigertlidrange.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigerzerocellid.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigerzipcodes.o /projects/gdal-1.6.3/ogr/ogrsf_frmts/o/.libs/tigerzipplus4.o ./ogr/.libs/ogrgeometryfactory.o ./ogr/.libs/ogrpoint.o ./ogr/.libs/ogrcurve.o ./ogr/.libs/ogrlinestring.o ./ogr/.libs/ogrlinearring.o ./ogr/.libs/ogrpolygon.o ./ogr/.libs/ogrutils.o ./ogr/.libs/ogrgeometry.o ./ogr/.libs/ogrgeometrycollection.o ./ogr/.libs/ogrmultipolygon.o ./ogr/.libs/ogrsurface.o ./ogr/.libs/ogrmultipoint.o ./ogr/.libs/ogrmultilinestring.o ./ogr/.libs/ogr_api.o ./ogr/.libs/ogrfeature.o ./ogr/.libs/ogrfeaturedefn.o ./ogr/.libs/ogrfeaturequery.o ./ogr/.libs/ogrfeaturestyle.o ./ogr/.libs/ogrfielddefn.o ./ogr/.libs/ogrspatialreference.o ./ogr/.libs/ogr_srsnode.o ./ogr/.libs/ogr_srs_proj4.o ./ogr/.libs/ogr_fromepsg.o ./ogr/.libs/ogrct.o ./ogr/.libs/ogr_opt.o ./ogr/.libs/ogr_srs_esri.o ./ogr/.libs/ogr_srs_pci.o ./ogr/.libs/ogr_srs_usgs.o ./ogr/.libs/ogr_srs_dict.o ./ogr/.libs/ogr_srs_panorama.o ./ogr/.libs/ogr_srs_erm.o ./ogr/.libs/swq.o ./ogr/.libs/ogr_srs_validate.o ./ogr/.libs/ogr_srs_xml.o ./ogr/.libs/ograssemblepolygon.o ./ogr/.libs/ogr2gmlgeometry.o ./ogr/.libs/gml2ogrgeometry.o -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib /usr/local/lib/libtiff.so /usr/local/lib/libjpeg.so /usr/local/lib/libpng12.so -L/usr/local/lib /usr/local/lib/libcurl.so -L/usr/kerberos/lib64 -lidn -lrt -lssl -lcrypto -ldl -lz -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2 -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crtn.o -Wl,-soname -Wl,libgdal.so.1 -o .libs/libgdal.so.1.13.3
/usr/bin/ld: /usr/local/lib/libz.a(crc32.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libz.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [libgdal.la] Error 1
make[1]: Leaving directory `/projects/gdal-1.6.3'
make: *** [check-lib] Error 2


If someone could explain to me which library is the problem and how to recompile the library I would be most appreciative.

Thanks in advance
 
Old 12-25-2009, 02:07 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,514

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Welcome to LQ.
Quote:
/usr/bin/ld: /usr/local/lib/libz.a(crc32.o):
relocation R_X86_64_32 against ........
GDAL must link against ' libz.so '. And it will, if present.

So what happened to your system zlib ?
Example 32 - bit Linux :
ls -l /usr/lib/libz*
/usr/lib/libz.a*
/usr/lib/libz.so -> libz.so.1.2.3*
/usr/lib/libz.so.1 -> libz.so.1.2.3*
/usr/lib/libz.so.1.2.3 -> ../../lib/libz.so.1.2.3*

Which Linux are you using ?
The development package zlib1-dev or something like that
would be available in your 'Package Manager'.
Or should be build with : ./configure --shared
( The --shared option is a zlib option only, most other
libs use --enable-shared. .. Or "shared" is default.)
The command ' ./configure --help ' shows these options.
.....

Last edited by knudfl; 12-25-2009 at 02:25 PM.
 
Old 12-25-2009, 05:01 PM   #3
Bascom49
LQ Newbie
 
Registered: Dec 2009
Posts: 2

Original Poster
Rep: Reputation: 0
-fPIC

Thanks for the reply.

zlib has been updated

root@inf [/projects]# ls -l /usr/lib/libz*
-rwxr-xr-x 1 root root 92598 Jan 9 2007 /usr/lib/libz.a*
lrwxrwxrwx 1 root root 13 Dec 23 13:44 /usr/lib/libz.so -> libz.so.1.2.3*
lrwxrwxrwx 1 root root 13 Jan 9 2007 /usr/lib/libz.so.1 -> libz.so.1.2.3*
-rwxr-xr-x 1 root root 73580 Jan 9 2007 /usr/lib/libz.so.1.2.3*

I'm running centos linux, 64 bit.

The output gave the direction to relink using -fPIC. Is this something I can do globally, so that I do not have the same problem with other files ?

And how and where would I use the -fPIC option.

I'm more familiar with gentoo and have to admit that I'm feeling somewhat lost with installing packages on centos.
 
Old 12-26-2009, 05:57 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,514

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Use the -fPIC option ..

You don't .. I guess
unless compiling a file.c , you have just written,
and want to use it for a shared library.

Long story ..
The " gdal error " in question just tells, that whoever
created that odd zlib in /usr/local/ forgot to use an
option creating "shared object".
Short : 'forgot -fPIC'

If you have more than one file.c or a library with
many files, you would probably always use a makefile
or autotools.

Libraries .. shared , static , and about fpic.
http://www.sunmanagers.org/archives/1995/1602.html

http://en.wikipedia.org/wiki/Shared_...ared_libraries

http://www.yolinux.com/TUTORIALS/Lib...ndDynamic.html

http://tldp.org/HOWTO/Program-Librar...libraries.html

http://www.ibm.com/developerworks/li...ies/index.html

http://sourceware.org/ml/glibc-linux.../msg00067.html

http://sourceware.org/ml/glibc-linux.../msg00068.html
.....
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
trying to add fPIC as a flag for gcc mallas Linux - Software 4 01-14-2009 02:36 PM
Error recompile with fPIC, but fPIC is already as a compilation option eolmsan Linux - Software 4 12-03-2008 11:05 AM
I don't understand this error FowlProgrammer Linux - Newbie 4 02-18-2007 07:42 AM
about -fpic/-fPIC option for gcc George2 Programming 2 09-04-2006 01:38 AM
What does 'recompile with -fPIC' mean cocteau Linux - Software 1 03-31-2005 01:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration