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: test_distutils failure with --enable-shared
Type: behavior Stage: resolved
Components: Distutils, Distutils2, Tests Versions: Python 3.1, Python 3.2, Python 3.3, Python 2.7, 3rd party
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: barry Nosy List: Canfield, barry, eric.araujo, matejcik, pitrou, python-dev, sandro.tosi, tarek, valeo
Priority: critical Keywords:

Created on 2010-10-16 20:25 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
10126-py27.txt barry, 2010-10-21 22:08 proposed fix for python 2.7
Messages (20)
msg118890 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-10-16 20:25
This happens on Python 3.1:

/usr/bin/ld: cannot find -lpython3.1
collect2: ld returned 1 exit status
test test_distutils failed -- Traceback (most recent call last):
  File "/srv/buildbot/buildarea/3.1.bolen-ubuntu/build/Lib/distutils/unixccompiler.py", line 254, in link
    self.spawn(linker + ld_args)
  File "/srv/buildbot/buildarea/3.1.bolen-ubuntu/build/Lib/distutils/ccompiler.py", line 909, in spawn
    spawn(cmd, dry_run=self.dry_run)
  File "/srv/buildbot/buildarea/3.1.bolen-ubuntu/build/Lib/distutils/spawn.py", line 34, in spawn
    _spawn_posix(cmd, search_path, dry_run=dry_run)
  File "/srv/buildbot/buildarea/3.1.bolen-ubuntu/build/Lib/distutils/spawn.py", line 138, in _spawn_posix
    % (cmd[0], exit_status))
distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/buildbot/buildarea/3.1.bolen-ubuntu/build/Lib/distutils/tests/test_build_ext.py", line 321, in test_get_outputs
    cmd.run()
  File "/srv/buildbot/buildarea/3.1.bolen-ubuntu/build/Lib/distutils/command/build_ext.py", line 347, in run
    self.build_extensions()
  File "/srv/buildbot/buildarea/3.1.bolen-ubuntu/build/Lib/distutils/command/build_ext.py", line 456, in build_extensions
    self.build_extension(ext)
  File "/srv/buildbot/buildarea/3.1.bolen-ubuntu/build/Lib/distutils/command/build_ext.py", line 543, in build_extension
    target_lang=language)
  File "/srv/buildbot/buildarea/3.1.bolen-ubuntu/build/Lib/distutils/ccompiler.py", line 719, in link_shared_object
    extra_preargs, extra_postargs, build_temp, target_lang)
  File "/srv/buildbot/buildarea/3.1.bolen-ubuntu/build/Lib/distutils/unixccompiler.py", line 256, in link
    raise LinkError(msg)
distutils.errors.LinkError: command 'gcc' failed with exit status 1

(from http://www.python.org/dev/buildbot/builders/x86%20Ubuntu%20Shared%203.1/builds/1132/steps/test/logs/stdio )

Since it is on one of the stable buildbots, it might be considered release-blocking.
msg118891 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-10-16 20:36
Similar failure on 2.7:

/usr/bin/ld: cannot find -lpython2.7
collect2: ld returned 1 exit status
test test_distutils failed -- Traceback (most recent call last):
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/distutils/tests/test_build_ext.py", line 269, in test_get_outputs
    cmd.run()
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/distutils/command/build_ext.py", line 449, in build_extensions
    self.build_extension(ext)
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/distutils/command/build_ext.py", line 531, in build_extension
    target_lang=language)
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/distutils/ccompiler.py", line 741, in link_shared_object
    extra_preargs, extra_postargs, build_temp, target_lang)
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/distutils/unixccompiler.py", line 258, in link
    raise LinkError, msg
LinkError: command 'gcc' failed with exit status 1
msg118893 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2010-10-16 20:43
I fixed this in py3k branch, so you just need to backport that.  I can do if you can't get to it in the next day or so.
msg118894 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-10-16 20:47
Le samedi 16 octobre 2010 à 20:43 +0000, Barry A. Warsaw a écrit :
> Barry A. Warsaw <barry@python.org> added the comment:
> 
> I fixed this in py3k branch, so you just need to backport that.  I can
> do if you can't get to it in the next day or so.

I don't know how to do it so, yes, it would be better if you do :)
Thanks for caring!
msg118948 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-10-17 16:06
If I understand correctly, only the changes you made to test_build_ext.py have to be backported.  I can do it if you want, just assign to me, or else do it and I’ll forward port to distutils2.

Note that I don’t fully understand the change, but I trust you that it is indeed the test that was faulty and not the code itself.
msg118986 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2010-10-17 22:15
Hi Eric, yes, that's basically what I did.  See _fix_command(), which *should* be the only thing that needs to be backported.  I do believe it's a faulty test and hopefully the comment explains why it's necessary.

Thanks for giving the backport a shot!
msg119325 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2010-10-21 18:10
Hi Éric, what's the status on the backport?
msg119328 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-10-21 18:54
Done in r85779 and r85780, please test.
msg119339 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-10-21 21:46
The backport fixed test_build_ext (the method) but not test_get_outputs.  Barry and I are on it.
msg119343 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2010-10-21 22:08
It's possible the proposed patch for 2.7 should be used in python 3 also.  Or as __ap__ suggestions in irc, os.path.dirname(sys.executable)
msg119344 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2010-10-21 22:13
Fixed in 2.7 by r85784
msg119354 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-10-21 23:44
Applied on py3k in r85784.  I had no bug with 3.1, so I left things alone.
msg119355 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-10-21 23:45
That was actually r85786.
msg119376 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-10-22 09:58
You broke many 2.7, 3.1 and 3.x buildbots.
msg119394 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2010-10-22 17:36
I believe all known failures in 2.7, 3.1, and 3.2 both with and without --enable-shared are now fixed.  Let's see what the buildbots say.
msg136247 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-05-18 15:47
distutils2 has been converted to 3.x and will be merged into 3.3 under the name packaging shortly.  The fix has not been ported; I applied the patch for build_ext and its test but didn’t succeed.
msg136557 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2011-05-22 18:29
I am trying to fix this by backporting the distutils fix, but --enabled-share does not work for me ?!

$ make distclean && ./configure --enable-shared --with-pydebug && make
$ ./python
libpython3.3dm.so.1.0: cannot open shared object file: No such file or directory

The so file is present in the srcdir though.

Investigating...
msg136558 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-05-22 18:30
Tarek, you must use LD_LIBRARY_PATH.
msg136563 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-05-22 19:22
New changeset 3d822e1ca930 by Tarek Ziade in branch 'default':
Issue 10126 - backported distutils fix for the enable-share mode into packaging
http://hg.python.org/cpython/rev/3d822e1ca930
msg136564 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2011-05-22 19:23
Fixed in packaging. It seems that all fronts are OK, so closing this
History
Date User Action Args
2022-04-11 14:57:07adminsetgithub: 54335
2011-05-22 19:23:15tareksetstatus: open -> closed

messages: + msg136564
2011-05-22 19:22:14python-devsetnosy: + python-dev
messages: + msg136563
2011-05-22 18:30:43pitrousetmessages: + msg136558
2011-05-22 18:29:55tareksetmessages: + msg136557
2011-05-22 17:19:45eric.araujolinkissue12143 superseder
2011-05-18 15:47:39eric.araujosetstatus: closed -> open

messages: + msg136247
versions: + Python 3.3
2010-10-22 17:36:10barrysetstatus: open -> closed
resolution: fixed
messages: + msg119394
2010-10-22 15:31:21barrysetassignee: eric.araujo -> barry
2010-10-22 09:58:55pitrousetstatus: closed -> open
priority: high -> critical
resolution: fixed -> (no value)
messages: + msg119376
2010-10-21 23:45:35eric.araujosetstatus: open -> closed
resolution: fixed
stage: resolved
2010-10-21 23:45:09eric.araujosetmessages: + msg119355
2010-10-21 23:44:14eric.araujosetmessages: + msg119354
2010-10-21 22:13:54barrysetmessages: + msg119344
2010-10-21 22:08:53barrysetfiles: + 10126-py27.txt

messages: + msg119343
2010-10-21 21:46:23eric.araujosetresolution: fixed -> (no value)
messages: + msg119339
stage: resolved -> (no value)
2010-10-21 18:54:00eric.araujosetcomponents: + Distutils
versions: + Python 3.2
nosy: + sandro.tosi, Canfield, valeo, matejcik

messages: + msg119328
resolution: fixed
stage: needs patch -> resolved
2010-10-21 18:10:01barrysetmessages: + msg119325
2010-10-18 15:17:23eric.araujolinkissue8335 superseder
2010-10-18 14:46:14eric.araujolinkissue9539 superseder
2010-10-17 22:15:58barrysetassignee: eric.araujo
messages: + msg118986
2010-10-17 16:07:09eric.araujosetassignee: tarek -> (no value)
2010-10-17 16:06:37eric.araujosetversions: + 3rd party
nosy: barry, pitrou, tarek, eric.araujo
messages: + msg118948

assignee: tarek
components: + Distutils2
2010-10-16 20:47:12pitrousetmessages: + msg118894
2010-10-16 20:43:50barrysetmessages: + msg118893
2010-10-16 20:36:58pitrousetmessages: + msg118891
versions: + Python 2.7
2010-10-16 20:25:50pitroucreate