classification
Title: RUNSHARED needs LDFLAGS
Type: compile error Stage: resolved
Components: Build Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: barry, belopolsky, eric.araujo, iritkatriel, phaering, rpetrov
Priority: normal Keywords: patch

Created on 2010-07-29 17:07 by phaering, last changed 2021-06-18 10:46 by iritkatriel. This issue is now closed.

Files
File name Uploaded Description Edit
Python-2.7-RUNSHARED.patch phaering, 2010-07-29 17:07
configure.log phaering, 2011-01-07 10:13
make.log phaering, 2011-01-07 10:13
test.log phaering, 2011-01-07 10:13
Messages (8)
msg111970 - (view) Author: Peter Häring (phaering) Date: 2010-07-29 17:07
test_distutils fails with 2.7 on a shared build (at least if building outside the source tree), 2.6 versions work. The reason for this is, that the test tries to link and doesn't find libpython-2.7.so.1.

A solution (or workaround) is to add LDFLAGS=-L`pwd` to the variable RUNSHARED, as I did in the attached file for SUNOS and GNU/Linux etc. Other systems probably need some similar patch.
msg125364 - (view) Author: Roumen Petrov (rpetrov) * Date: 2011-01-04 21:32
LDFLAGS make no sense for run time. The patch seems to me bogus.
msg125461 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2011-01-05 19:38
Peter, please explain exactly how you built Python to trigger this bug.  I.e. include the exact commands and directories you used.  I cannot reproduce this yet.
msg125639 - (view) Author: Peter Häring (phaering) Date: 2011-01-07 10:13
Following commands trigger the bug:

tar xf Python-2.7.tar.bz2
mkdir XXXXXXXX	(this is the build-directory outside the source tree)

CFLAGS="-O2 -march=i686"  ../Python-2.7/configure 
--prefix=/sw/Python-2.7-20110107/dest --enable-shared 2>&1 |tee configure.log
make 2>&1 | tee make.log
make test 2>&1 | tee test.log

!!! IMPORTANT !!! The bug is only seen, if there is no Python-2.7 library 
already installed in the standard places.

I have included the three log files configure.log, make.log, test.log
------------------------------------------------
Pfarrer Dr. Peter Häring
Dürmentinger Str. 15, 88521 Ertingen
Tel.: 07371/129361, Fax: 07371/129360
Email: p.haering@gmx.net
msg126054 - (view) Author: Roumen Petrov (rpetrov) * Date: 2011-01-12 00:04
Yes Peter, build outside source tree fail for,  fail for me and pass for python developers :). So no idea how to convince them to fix this issue.

Next is from my sources for python 2.7

Index: Lib/distutils/tests/test_build_ext.py
===================================================================
--- Lib/distutils/tests/test_build_ext.py       (revision 87946)
+++ Lib/distutils/tests/test_build_ext.py       (working copy)
@@ -91,6 +91,9 @@
             sys.stdout = StringIO()
         try:
             cmd.ensure_finalized()
+            #Broken after issue 7712(r78136) : add a temp_cwd context manager to test_support ...
+            #Without current working dir: "...cannot find -lpython27"
+            cmd.library_dirs.insert(0, test_support.SAVEDCWD)
             cmd.run()
         finally:
             sys.stdout = old_stdout
@@ -284,6 +287,12 @@
         # returns wrong result with --inplace
         other_tmp_dir = os.path.realpath(self.mkdtemp())
         old_wd = os.getcwd()
+        print >> sys.stderr, "...TRACE test_build_ext.py:test_get_outputs old_wd=%s" %(old_wd)
+        #Without current working dir: "...cannot find -lpython27"
+        #NOTE: After issue #7712(r78136) test cannot use old_wd !
+        #cmd.library_dirs.insert(0, old_wd)
+        cmd.library_dirs.insert(0, test_support.SAVEDCWD)
+        #?#cmd.library_dirs.insert(0, old_wd)
         os.chdir(other_tmp_dir)
         try:
             cmd.inplace = 1
=================================
msg126058 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2011-01-12 00:28
> build outside source tree fail for me and pass for python
> developers :). So no idea how to convince them to fix this issue.

I am collecting out of tree build failures in issue 9860.  One issue that is easily reproducible is triggered when there are object files in the tree from another build, but it looks like you see something else.

As for convincing developers to fix a bug, the best approach is to propose a patch! :-)
msg126061 - (view) Author: Roumen Petrov (rpetrov) * Date: 2011-01-12 00:36
Alexander, I already answer to you case.
About the patch it is part of issue3871 ;)
msg396043 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-06-18 10:46
Closing as 2.7 is past EOL and distutils is deprecated. Please create a new issue, and include complete reproduction instructions, if you are seeing this problem on an up to date version (3.9+).
History
Date User Action Args
2021-06-18 10:46:41iritkatrielsetstatus: open -> closed

nosy: + iritkatriel
messages: + msg396043

resolution: out of date
stage: resolved
2013-11-10 19:37:29barrysetassignee: barry ->
2011-01-12 00:36:44rpetrovsetnosy: barry, belopolsky, eric.araujo, rpetrov, phaering
messages: + msg126061
2011-01-12 00:28:27belopolskysetnosy: + belopolsky
messages: + msg126058
2011-01-12 00:04:11rpetrovsetmessages: + msg126054
2011-01-09 01:21:21eric.araujosetnosy: + eric.araujo
2011-01-07 10:13:33phaeringsetfiles: + configure.log, make.log, test.log

messages: + msg125639
2011-01-05 19:38:33barrysetmessages: + msg125461
2011-01-04 21:32:26rpetrovsetmessages: + msg125364
2011-01-04 01:57:23pitrousetassignee: barry

nosy: + barry
2010-07-29 22:56:41rpetrovsetnosy: + rpetrov
2010-07-29 17:07:00phaeringcreate