[issue11570] Lib/test/test_distutils.py tries to mix 32 and 64 bits object files, doesn't obey LDFLAGS

Jesús Cea Avión report at bugs.python.org
Wed Mar 16 13:22:51 CET 2011


New submission from Jesús Cea Avión <jcea at jcea.es>:

Example of faulting build: http://www.python.org/dev/buildbot/all/builders/AMD64%20OpenIndiana%203.1/builds/297

Problem: "test_distutils.py" tests the generation of shared libraries. It correctly compile the ".c" to ".o" as 64 bits, but when linking the resulting file object, it tries to link in 32 bits mode, failing miserably.

Manually adding:

"""
--- a/Lib/distutils/unixccompiler.py    Wed Mar 16 12:48:54 2011 +0200
+++ b/Lib/distutils/unixccompiler.py    Wed Mar 16 12:14:37 2011 +0000
@@ -251,6 +252,8 @@
                 if sys.platform == 'darwin':
                     linker = _darwin_compiler_fixup(linker, ld_args)
 
+                print("*****************", repr(linker + ld_args))
+                ld_args = ["-m64"]+ld_args
                 self.spawn(linker + ld_args)
             except DistutilsExecError as msg:
                 raise LinkError(msg)

"""

solves the issue.

Notes:

- Python is compiled with this configuration:

  ./configure --with-pydebug --with-computed-gotos "CFLAGS=-I/usr/local/include/ncursesw -m64" LDFLAGS=-m64

- "test_distutils.py" compilation step works OK, and obey CFLAGS. The command line used is "['gcc', '-I/usr/local/include/ncursesw', '-m64', '-g', '-Wall', '-Wstrict-prototypes', '-fPIC', '-IInclude', '-I/tmp/z/3.1', '-c', '/tmp/tmp8M7aOH/xxmodule.c', '-o', '/tmp/tmp8M7aOH/tmp/tmp8M7aOH/xxmodule.o']".

- "test_distutils.py" linking steps fails. The command line used is "'gcc', '-shared', '/tmp/tmp8M7aOH/tmp/tmp8M7aOH/xxmodule.o', '-o', '/tmp/tmp8M7aOH/xx.so'". It doesn't include the "LDFLAGS" parameter we want.

- Modifying the source code to add a "-m64" to the linking step solved the issue.

- Python 2.7, 3.2 and 3.x works ok.

----------
components: Tests
keywords: easy
messages: 131106
nosy: jcea
priority: normal
severity: normal
stage: needs patch
status: open
title: Lib/test/test_distutils.py tries to mix 32 and 64 bits object files, doesn't obey LDFLAGS
type: compile error
versions: Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11570>
_______________________________________


More information about the Python-bugs-list mailing list