Issue 10520: Build with --enable-shared fails - Python tracker

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: barry Nosy List: barry, benjamin.peterson, doko, eric.araujo, lukasz.langa, pitrou, rpetrov, skrah, tarek
Priority: high Keywords:

Created on 2010-11-24 14:00 by skrah, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (10)
msg122278 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2010-11-24 14:05
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".
msg122282 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2010-11-24 15:31
So, you must have done a 'make install' or 'make altinstall' to get a build into /usr/local, right?  Without that of course it works fine.

You're probably still right about changing the order so it picks up the local copy first.
msg122283 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2010-11-24 15:32
I'm bumping the status down since this likely won't affect the average user, only developers who do their own source installs.
msg122286 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2010-11-24 16:18
-L. should appear before -L/usr/local/lib.
msg122291 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2010-11-24 17:03
Since I'm on Linux, I did a prior install into /usr/local. But I'm pretty
sure that BSD ports (which you might view as the system install) also use
/usr/local.
msg122307 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2010-11-24 20:30
r86734
msg122308 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2010-11-24 20:30
BTW, I am not sure it's worth backporting this to 3.1 and 2.7.  It seems like a corner case that will not affect most users.
msg122407 - (view) Author: Roumen Petrov (rpetrov) * Date: 2010-11-25 20:40
It is wort to fix regression if all directories are absolute. 

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -54,7 +54,8 @@
     for i, path in enumerate(dirlist):
         if not os.path.isabs(path):
             dirlist.insert(i + 1, dir)
-            break
+            return
+    dirlist.insert(0, dir)
msg122540 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2010-11-27 18:44
Roumen's patch fixes a regression where readline extension would fail to build on Mac OS X 10.6.5.
msg122546 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2010-11-27 20:03
r86837