summaryrefslogtreecommitdiff
path: root/unixccompiler.py
diff options
context:
space:
mode:
authorKevin Adler <kadler@us.ibm.com>2019-03-04 08:48:40 -0600
committerVictor Stinner <vstinner@redhat.com>2019-03-04 15:48:40 +0100
commit9d329c1bbe7e35a3a4b5810f90ff292d51d7a66d (patch)
tree5d1adf616b44347e299cbcf683cb95efad6b85e8 /unixccompiler.py
parent95d86241efd33f8db71e72352b31185389f4d68d (diff)
downloadpython-setuptools-git-9d329c1bbe7e35a3a4b5810f90ff292d51d7a66d.tar.gz
bpo-35198 Fix C++ extension compilation on AIX (GH-10437)
For C++ extensions, distutils tries to replace the C compiler with the C++ compiler, but it assumes that C compiler is the first element after any environment variables set. On AIX, linking goes through ld_so_aix, so it is the first element and the compiler is the next element. Thus the replacement is faulty: ld_so_aix gcc ... -> g++ gcc ... Also, it assumed that self.compiler_cxx had only 1 element or that there were the same number of elements as the linker has and in the same order. This might not be the case, so instead concatenate everything together.
Diffstat (limited to 'unixccompiler.py')
-rw-r--r--unixccompiler.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/unixccompiler.py b/unixccompiler.py
index ab4d4de1..d10a78da 100644
--- a/unixccompiler.py
+++ b/unixccompiler.py
@@ -188,7 +188,15 @@ class UnixCCompiler(CCompiler):
i = 1
while '=' in linker[i]:
i += 1
- linker[i] = self.compiler_cxx[i]
+
+ if os.path.basename(linker[i]) == 'ld_so_aix':
+ # AIX platforms prefix the compiler with the ld_so_aix
+ # script, so we need to adjust our linker index
+ offset = 1
+ else:
+ offset = 0
+
+ linker[i+offset] = self.compiler_cxx[i]
if sys.platform == 'darwin':
linker = _osx_support.compiler_fixup(linker, ld_args)