Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set ccshared=-fPIC while executing ./configure?

Tags:

I am trying to build Python 2.6 for QGIS on RHEL 5. During the making of QGIS I get the following error:

Linking CXX shared library libqgispython.so
/usr/bin/ld: /usr/local/lib/python2.6/config/libpython2.6.a(abstract.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/python2.6/config/libpython2.6.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [src/python/libqgispython.so.1.0] Error 1
make[1]: *** [src/python/CMakeFiles/qgispython.dir/all] Error 2
make: *** [all] Error 2

What I figure out from this error is that I need to build Python 2.6 with some flag, -fPIC. OK, so I found it in the configure.in file but it checks several conditions and on the basis of those conditions it assigns -fPIC to the CCSHARED flag.

What I did was that after all conditions were checked I added the following line to deliberately use CCSHARED as -fPIC.

CCSHARED="-fPIC";

But it did not work..

How to specify while configuring that I want to set CCSHARED as -fPIC?

like image 619
ashishsony Avatar asked Mar 10 '09 12:03

ashishsony


3 Answers

Run configure with --enable-shared. Then -fPIC will be included as part of the shared flags.

like image 70
A. Coady Avatar answered Sep 22 '22 03:09

A. Coady


The following worked for me when I ran into this error:

make clean
./configure CFLAGS=-fPIC CXXFLAGS=-fPIC
like image 14
kgui Avatar answered Sep 19 '22 03:09

kgui


I got it working by adding -fPIC after CC= gcc -pthread, i.e CC= gcc -pthread -fPIC in the Makefile.

like image 6
ashishsony Avatar answered Sep 23 '22 03:09

ashishsony