[issue10520] Build with --enable-shared fails

Stefan Krah report at bugs.python.org
Wed Nov 24 15:05:56 CET 2010

New submission from Stefan Krah <stefan-usenet at bytereef.org>:

Building the modules fails if --enable-shared is used. The linker picks
up an existing library from /usr/local/lib, which has not been compiled
with -fPIC:

gcc -pthread -shared build/temp.linux-x86_64-3.2/home/stefan/svn/py3k/Modules/_struct.o -L/usr/local/lib -L. -lpython3.2m -o build/lib.linux-x86_64-3.2/_struct.cpython-32m.so
/usr/bin/ld: /usr/local/lib/libpython3.2m.a(abstract.o): relocation R_X86_64_32S against `_PyObject_NextNotImplemented' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython3.2m.a: could not read symbols: Bad value
collect2: ld returned 1 exit status

Linking works if the order of the flags is changed to "-L. L/usr/local/lib".

components: +Build
nosy: +pitrou, tarek
priority: normal -> critical
type:  -> behavior
versions: +Python 2.7, Python 3.1, Python 3.2

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list