On 01/30/2012 01:16 PM, David Narvaez wrote:
CompilationError:
returncode: 1
compiling: gcc -o /tmp/tmpzNKYHi/module_with_type.so
-I/usr/include/python2.7 -I/usr/include/python2.7 -fno-strict-aliasing
-march=athlon64 -O2 -pipe -fwrapv -DNDEBUG -Wall -Werror -shared
/tmp/tmpzNKYHi/module_with_type.c
Stdout:
Stderr:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.2/../../../../x86_64-pc-linux-gnu/bin/ld:
/tmp/cco3TFC3.o: relocation R_X86_64_32 against `.rodata.str1.1' can
not be used when making a shared object; recompile with -fPIC
/tmp/cco3TFC3.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
Can anybody give any input on this? Would it hurt to add the -fPIC
flag to the compilation?
As shared libraries are loaded to varying addresses, unknown at build
time, they generally need to contain position independent code. (I
would group the -fPIC with -shared rather than with the -I switches.)
Stephan