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
Title: distutils test_build_ext's test_get_outputs fails in bootstrap environment
Type: compile error Stage: resolved
Components: Distutils, Distutils2 Versions: Python 3.1, Python 3.2, Python 2.7, 3rd party
process
Status: closed Resolution: duplicate
Dependencies: Superseder: test_distutils failure with --enable-shared
View: 10126
Assigned To: tarek Nosy List: Canfield, barry, eric.araujo, matejcik, sandro.tosi, tarek, valeo
Priority: normal Keywords:

Created on 2010-04-07 17:54 by matejcik, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (7)
msg102552 - (view) Author: jan matejek (matejcik) * Date: 2010-04-07 17:53
when running testsuite in a clean environment without pre-installed system python, test_distutils fail in test_build_ext, test_get_outputs:
/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/bin/ld: cannot find -lpython2.6
LinkError: command 'gcc' failed with exit status 1

full traceback is below.

this is most likely caused by change in r72637:
http://svn.python.org/view/python/branches/release26-maint/Lib/distutils/tests/test_build_ext.py?r1=72637&r2=72636&pathrev=72637
this changes compiler's working directory, so that it can no longer find libpython2.6.so with "-L."
(related to issue 6022 - the comments there point it out)

not sure about proper fix - personally, i don't care much about leaving one more file in builddir, whereas i do care about tests passing in clean env, so for SUSE i'm reverting r72637


full traceback:

test_distutils
/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/bin/ld: cannot find -lpython2.6
collect2: ld returned 1 exit status
test test_distutils failed -- Traceback (most recent call last):
  File "/usr/src/packages/BUILD/Python-2.6.5/Lib/distutils/tests/test_build_ext.py", line 261, in test_get_outputs
    cmd.run()
  File "/usr/src/packages/BUILD/Python-2.6.5/Lib/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/usr/src/packages/BUILD/Python-2.6.5/Lib/distutils/command/build_ext.py", line 449, in build_extensions
    self.build_extension(ext)
  File "/usr/src/packages/BUILD/Python-2.6.5/Lib/distutils/command/build_ext.py", line 531, in build_extension
    target_lang=language)
  File "/usr/src/packages/BUILD/Python-2.6.5/Lib/distutils/ccompiler.py", line 769, in link_shared_object
    extra_preargs, extra_postargs, build_temp, target_lang)
  File "/usr/src/packages/BUILD/Python-2.6.5/Lib/distutils/unixccompiler.py", line 259, in link
    raise LinkError, msg
LinkError: command 'gcc' failed with exit status 1
msg105995 - (view) Author: Dylan Canfield (Canfield) Date: 2010-05-18 18:10
I am having the exact same problem with test_distutils failing on a clean env. Did reverting the changes in r72637 fix your problem?
msg106454 - (view) Author: jan matejek (matejcik) * Date: 2010-05-25 17:45
yes, reverting r72637 fixes this problem for me

it reintroduces the original bug (there is some temporary file left behind), but i don't care about that
msg106472 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2010-05-25 20:14
Dylan, what is your platform ?

The only difference is that the test chdir in a new temporary directory.

Could anyone trace the test to step into the linker call to see its error output ? (can't reproduce here)
msg106537 - (view) Author: jan matejek (matejcik) * Date: 2010-05-26 15:46
Tarek,
the error output is this:
/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/bin/ld: cannot find -lpython2.6

the chdir is the problem - because in an environment where you don't have an existing Python installation, you will not find -lpython2.6.

the linker from unixccompiler.py:link() is this:
['gcc', '-pthread', '-shared', '/tmp/pythontest_eosQ1d/tempt/tmp/tmphIMDH2/foo.o', '-L.', '-lpython2.6', '-o', '/tmp/tmppAsk00/foo.so']

and since you're in new temporary directory, -L. does not include libpython2.6 (unless you copy it in that directory or change -L. to the right place)
msg119014 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-10-18 13:32
This may be solved by backporting the fix in #10126.  I’ll do it when my network gives me access to svn again :/
msg119028 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-10-18 15:17
Marking as duplicate, following Barry in msg119022
History
Date User Action Args
2022-04-11 14:56:59adminsetgithub: 52582
2010-10-18 15:17:23eric.araujosetstatus: open -> closed

superseder: test_distutils failure with --enable-shared

nosy: + barry
messages: + msg119028
resolution: duplicate
stage: resolved
2010-10-18 14:46:14eric.araujounlinkissue9539 superseder
2010-10-18 13:44:00eric.araujosetnosy: + sandro.tosi, valeo
2010-10-18 13:32:16eric.araujosetnosy: matejcik, tarek, eric.araujo, Canfield
messages: + msg119014
components: + Distutils2
versions: + 3rd party, Python 3.1, Python 2.7, Python 3.2, - Python 2.6
2010-10-18 13:29:05eric.araujolinkissue9539 superseder
2010-10-14 23:32:35eric.araujosetnosy: + eric.araujo
2010-05-26 15:46:11matejciksetmessages: + msg106537
2010-05-25 20:14:30tareksetmessages: + msg106472
2010-05-25 17:45:16matejciksetmessages: + msg106454
2010-05-18 18:10:51Canfieldsetnosy: + Canfield
messages: + msg105995
2010-04-07 17:54:00matejcikcreate