classification
Title: _sysconfigdata.py wrong on AIX installations
Type: behavior Stage: patch review
Components: Build Versions: Python 3.7, Python 3.6, Python 3.5, Python 2.7
process
Status: open Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: David.Edelsohn, Michael.Felt, aixtools@gmail.com, eric.araujo, ericvw, haubi, larry, lemburg, martin.panter, pelson, python-dev
Priority: normal Keywords: patch

Created on 2013-06-17 00:33 by David.Edelsohn, last changed 2017-01-24 17:37 by ericvw.

Files
File name Uploaded Description Edit
issue18235.patch David.Edelsohn, 2013-10-19 18:48 review
Messages (54)
msg191301 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2013-06-17 00:33
_sysconfigdata.py includes information about how to build extension modules. On AIX this requires a wrapper script to build shared libraries.  The file includes definitions like:

 'BLDSHARED': './Modules/ld_so_aix gcc -pthread -bI:./Modules/python.exp',
 'LDSHARED': './Modules/ld_so_aix gcc -pthread -bI:./Modules/python.exp',
 'LINKCC': './Modules/makexp_aix Modules/python.exp . libpython3.4dm.a;  gcc '
           '-pthread',
 'MAKESETUP': './Modules/makesetup',

which is correct in the build directory, but is not correct for the install directory.  The paths do not correspond to the installed location of ld_so_aix and makexp_aix in lib/pythonX.Y/config .
msg191385 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2013-06-18 01:26
This is the cause of the failures in test_distutils.
msg191598 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2013-06-21 17:15
Can you suggest how to fix this?
msg191624 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2013-06-22 00:35
It looks like someone already tried to fix part of this, but reversed the assignment

diff -r a089a8b1f93d Lib/sysconfig.py
--- a/Lib/sysconfig.py  Fri Jun 21 18:37:02 2013 -0400
+++ b/Lib/sysconfig.py  Fri Jun 21 22:33:15 2013 -0700
@@ -368,7 +368,7 @@
     # -- these paths are relative to the Python source, but when installed
     # the scripts are in another directory.
     if _PYTHON_BUILD:
-        vars['LDSHARED'] = vars['BLDSHARED']
+        vars['BLDSHARED'] = vars['LDSHARED']
 
     # There's a chicken-and-egg situation on OS X with regards to the
     # _sysconfigdata module after the changes introduced by #15298:


BLDSHARED is relative to srcdir and LDSHARED is relative to the install directory BINLIBDEST.

LDSHARED=       $(BINLIBDEST)/config/ld_so_aix $(CC) -bI:$(BINLIBDEST)/config/python.exp $(PY_LDFLAGS)
BLDSHARED=      $(srcdir)/Modules/ld_so_aix $(CC) -bI:$(srcdir)/Modules/python.exp $(PY_LDFLAGS)
msg200476 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2013-10-19 18:48
Patch against current trunk
msg200479 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2013-10-19 19:02
With my patch applied, _sysconfig.py looks like

 'BLDSHARED': '/usr/local/lib/python3.4/config/ld_so_aix gcc -pthread '
              '-bI:/usr/local/lib/python3.4/config/python.exp',
 'LDSHARED': '/usr/local/lib/python3.4/config/ld_so_aix gcc -pthread '
             '-bI:/usr/local/lib/python3.4/config/python.exp',
msg200488 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-19 20:00
Ha, that code dates back to 2000 and 2001 (f1e40abbedb3 and c958678720fd, respectively).
msg200491 - (view) Author: Roundup Robot (python-dev) Date: 2013-10-19 20:07
New changeset c554194240fc by Antoine Pitrou in branch '3.3':
Issue #18235: Fix the sysconfig variables LDSHARED and BLDSHARED under AIX.
http://hg.python.org/cpython/rev/c554194240fc

New changeset e3ac917fcf9c by Antoine Pitrou in branch 'default':
Issue #18235: Fix the sysconfig variables LDSHARED and BLDSHARED under AIX.
http://hg.python.org/cpython/rev/e3ac917fcf9c
msg200492 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-19 20:08
Committed the patch. I trust you that you got it right!
msg200875 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2013-10-22 04:18
I think I see the source of the confusion. test_distutils fails because it runs in the build tree and without files installed. The test does not use the installed version of sysconfig, so it looks for ./Modules/ld_so_aix, which fails. The kludge from 2000 was trying to make the test work. But after installation, the kludge defines variables incorrectly to build Modules after Python is installed.

Because the distutils test is testing in tree and not the installed version of Python, it is not testing what the end user will experience. I am unsure about the best way to make the test pass.
msg202427 - (view) Author: Michael Haubenwallner (haubi) * Date: 2013-11-08 15:24
Actually, ld_so_aix is autogenerated from ld_so_aix.in into builddir, while makexp_aix is not.

Attached patch eventually might fix the test too?
msg202436 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2013-11-08 16:46
+1
msg205297 - (view) Author: Michael Haubenwallner (haubi) * Date: 2013-12-05 13:51
Kindly ping. Do you prefer another report for the aix-absbuilddir patch as this one is already closed?
msg205310 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2013-12-05 16:26
Do you want me to open a new issue or do you want to open a new issue?
msg205315 - (view) Author: Michael Haubenwallner (haubi) * Date: 2013-12-05 17:57
Erm, question target was the python committers. And I'd create the new issue if they prefer.
msg219670 - (view) Author: Michael Haubenwallner (haubi) * Date: 2014-06-03 08:42
issue#10656 is the out-of-source part already.
msg219888 - (view) Author: Michael Haubenwallner (haubi) * Date: 2014-06-06 15:23
Hmm... instead of reversing the order while keeping in _generate_posix_vars(), feels like it would have been better to move the code from 2000 back to _init_posix() where it originally was, without changing the order - because now for sysconfig within Python build, the working B-value of LDSHARED is lost.

Something like (note the function names):

--- a/Lib/sysconfig.py  Fri Jun 06 01:23:53 2014 -0500
+++ b/Lib/sysconfig.py  Fri Jun 06 17:11:02 2014 +0200
@@ -364,11 +364,6 @@ def _generate_posix_vars():
         if hasattr(e, "strerror"):
             msg = msg + " (%s)" % e.strerror
         raise OSError(msg)
-    # On AIX, there are wrong paths to the linker scripts in the Makefile
-    # -- these paths are relative to the Python source, but when installed
-    # the scripts are in another directory.
-    if _PYTHON_BUILD:
-        vars['BLDSHARED'] = vars['LDSHARED']
 
     # There's a chicken-and-egg situation on OS X with regards to the
     # _sysconfigdata module after the changes introduced by #15298:
@@ -409,6 +404,11 @@ def _init_posix(vars):
     # _sysconfigdata is generated at build time, see _generate_posix_vars()
     from _sysconfigdata import build_time_vars
     vars.update(build_time_vars)
+    # On AIX, we have different paths for building the Python modules
+    # relative to the Python source, and building third party modules
+    # after installing the Python dist.
+    if _PYTHON_BUILD:
+        vars['LDSHARED'] = vars['BLDSHARED']
 
 def _init_non_posix(vars):
     """Initialize the module as appropriate for NT"""
msg230257 - (view) Author: Phil Elson (pelson) * Date: 2014-10-30 09:38
FWIW - this doesn't appear to have been backported to v2.7.x. As a result, the ./Modules/ld_so_aix reference still exists in _sysconfigdata.py in v2.7.8 (and therefore I was unable to build numpy). The workaround is easy enough, it is just something that is worth noting.
msg277741 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-09-30 06:38
It might have been good to get this reopened to attract more attention to it. Anyway, Issue 28311 has now been opened for 2.7, and it seems to be about the same problem.
msg277745 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-09-30 07:03
Reopening this to fix the original bug in 2.7, and to improve things for Python 3.

Michael Felt (or anyone else): Can you confirm if Michael Haubenwallner’s suggested patch from <https://bugs.python.org/issue18235#msg219888> is appropriate? It looks like that patch won’t apply directly to 2.7, but the spirit of that patch looks sensible to me for Python 2 and 3. I.e. don’t mess with the variables in _generate_posix_vars(), which writes them to a data file, but overwrite LDSHARED in _init_posix(), which happens at run time.
msg277769 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2016-09-30 18:45
Michael,

Are you suggesting to move the code fragment *AND* revert or change the reversal of LDSHARED?  The Python code seems to be setting and reversing the value in multiple places.

This also relates to Issue25825.

Repeatedly flipping this around is not making progress.
msg277780 - (view) Author: Michael Felt (Michael.Felt) * Date: 2016-09-30 22:33
I am not suggesting anything. I am only trying to report what I experience.

The first observation was that I could not build python when src != build directory. I believe that was the original complaint as well.

The second observation came when I tried to use pip install, and also make of the mercurial "addition". That module consistently failed until I editted, manually, the _sysconf*.py file to make LDwhatever the same as LDCXXwhatever.

With study I  could figure out what they stand for - I would guess they are related, if not derived from, to some "autotool" conventions.

To be honest, I do not understand what is meant by "flipping", so I am neither for nor against.

For me to test a patch - which I am very willing to do - I would be grateful for the mercurial command(s) to test it normally (now that I finally have it working - I figured out how to make the SSL part work this evening).

In short, please do not shoot me, the messenger :)
msg277783 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2016-09-30 23:13
Michael Felt,

The patch was from Michael Haubenwallner.  I was addressing Michael Haubenwallner.
msg277944 - (view) Author: Michael Haubenwallner (haubi) * Date: 2016-10-03 09:31
...a long time since I've been in this area...

David, I'm not completely sure which code fragments you're talking about for "revert or change".

Anyway: If I remember correctly, the confusion here is about the idea behind LDSHARED and BLDSHARED.
As far as I understand, this idea originally was:

LDSHARED: The "command to create shared modules". Used as variable in the "Makefile (and similar) templates to build python modules" for both in-python and third party modules. Initialized to hold the value which works for third party modules to link against the _installed_ python.

BLDSHARED: Read as "Buildtime-LDSHARED". Holds the value to override LDSHARED with while building python itself (_PYTHON_BUILD=True), which works for building in-python modules to link against the _builddir_ python.

So there's no point in ever setting BLDSHARED to the value of LDSHARED.

Actually there is no point in having BLDSHARED visible at all in an installed python, nor using its value while building third party modules - there's just no code yet that prunes BLDSHARED from the installed _sysconfigdata.py.

HTH,
/haubi/
msg278674 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-10-14 23:23
This is my understanding:

We are talking about the code at <https://hg.python.org/cpython/annotate/v3.6.0b2/Lib/sysconfig.py#l377> that switches the values of LDSHARED and/or BLDSHARED.

Yes, Michael H. was suggesting to both move and change (revert) back to overwriting LDSHARED with the value of BLDSHARED. Since he is moving the code into _init_posix(), which I think only gets called at run time, the state of _PYTHON_BUILD won’t affect the value of LDSHARED saved in the installed config file.
msg279279 - (view) Author: Michael Felt (aixtools@gmail.com) Date: 2016-10-23 19:54
The value that works for LDSHARED is the value that LDCXXSHARED has. 
BLDSHARED is also broken (currently).

  'BLDSHARED': './Modules/ld_so_aix xlc_r -bI:./Modules/python.exp 
-L/opt/lib',

  'LDCXXSHARED': '/opt/lib/python2.7/config/ld_so_aix xlc_r 
-bI:/opt/lib/python2.7/config/python.exp',

except neither BLDSHARED nor LDCXXSHARED have taken the extra LDFLAG 
that was exported before configure was called (in this case -L/opt/lib)

In short: LDSHARED needs to be a full path, not relative and should 
include -L flags used during the build, if any.

LDCXXSHARED should also add LDFLAGS -L entries (and perhaps, where 
relevant -R flags).

BLDSHARED does not work when "builddir" is . and source_dir is 
../src/python-X.W.Y because Modules/ld_so_aix is not in ".", but is at 
../src/python-X.X.Y/Modules/ld_so_aix

On 15-Oct-16 00:23, Martin Panter wrote:
> Martin Panter added the comment:
>
> This is my understanding:
>
> We are talking about the code at <https://hg.python.org/cpython/annotate/v3.6.0b2/Lib/sysconfig.py#l377> that switches the values of LDSHARED and/or BLDSHARED.
>
> Yes, Michael H. was suggesting to both move and change (revert) back to overwriting LDSHARED with the value of BLDSHARED. Since he is moving the code into _init_posix(), which I think only gets called at run time, the state of _PYTHON_BUILD won’t affect the value of LDSHARED saved in the installed config file.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue18235>
> _______________________________________
msg279281 - (view) Author: Michael Felt (aixtools@gmail.com) Date: 2016-10-23 19:56
correction:

On 23-Oct-16 20:54, Michael Felt wrote:
> except neither BLDSHARED nor LDCXXSHARED have taken the extra LDFLAG
except neither LDSHARED nor LDCXXSHARED have taken the extra LDFLAG
like BLDSHARED has.
> that was exported before configure was called (in this case -L/opt/lib)
msg279472 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-10-26 00:43
Michael F.: It sounds like you have three separate but related problems:

1. Confusion between LDSHARED and BLDSHARED referring to the in-source build tree vs final installed files. I think this is what David and Michael H. were originally trying to fix here.

2. Only BLDSHARED has an extra -L flag. Where is the code that adds it? I can’t find it in configure.ac in either Python 3 or 2 versions.

3. BLDSHARED also fails to work for out-of-tree builds, because it refers to the build tree (.) rather than the source tree. This sounds like another bug to me; do you want to make a patch?
msg279482 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-10-26 02:09
Regarding out-of-tree builds (Problem 3), see Issue 10656, which already has a potential patch.
msg280991 - (view) Author: Michael Felt (Michael.Felt) * Date: 2016-11-16 21:12
As this is the issue still open with regard to issues with ld_so_aix...

The current release Python3-3.5.2 does not include ld_so_aix in the "make install DESTDIR=xxx output ("make install" also neglects to install ld_so_aix)

Installation Summary
--------------------
Name                        Level           Part        Event       Result
-------------------------------------------------------------------------------
aixtools.python3.rte        3.5.2.0         USR         APPLY       SUCCESS
root@x064:[/data/prj/python3/python3-3.5.2]find /opt -name ld_so_aix
root@x064:[/data/prj/python3/python3-3.5.2]grep ld_so_aix /opt/lib/py*/_sys*.py
 'BLDSHARED': '/opt/lib/python3.5/config/ld_so_aix xlc_r '
 'LDCXXSHARED': '/opt/lib/python3.5/config/ld_so_aix xlc_r '
 'LDSHARED': '/opt/lib/python3.5/config/ld_so_aix xlc_r '

So, the last two variables are correct - BLDSHARED is not correct in _sysconfigdata.py because the file does not exist during the build process. However, the build succeeds, so apparently this value for BLDSHARED is not used during the build.
msg281024 - (view) Author: Michael Felt (Michael.Felt) * Date: 2016-11-17 07:14
FYI: after manually creating the .../libpython3.5/config directory and copying three files (see below) I was able to "pip3 install cython" as test.

 At the packing area:
michael@x071:[/data/prj/python3/python3-3.5.2]ls Xany/opt/lib/python3.5/config
ld_so_aix   makexp_aix  python.exp

in the package:
michael@x071:[/data/prj/python3/python3-3.5.2]restore -Tqf installp/ppc/*.I | grep lib/python3.5/config
New volume on installp/ppc/aixtools.python3.3.5.2.0.I:
Cluster size is 51200 bytes (100 blocks).
The volume number is 1.
The backup date is: Wed Nov 16 21:48:37 UTC 2016
Files are backed up by name.
The user is root.
./opt/lib/python3.5/config
./opt/lib/python3.5/config/ld_so_aix
./opt/lib/python3.5/config/python.exp
./opt/lib/python3.5/config/makexp_aix
./opt/lib/python3.5/configparser.py
./opt/lib/python3.5/config-3.5m
./opt/lib/python3.5/config-3.5m/libpython3.5m.a
./opt/lib/python3.5/config-3.5m/Setup
./opt/lib/python3.5/config-3.5m/python-config.py
./opt/lib/python3.5/config-3.5m/config.c
./opt/lib/python3.5/config-3.5m/Setup.local
./opt/lib/python3.5/config-3.5m/config.c.in
./opt/lib/python3.5/config-3.5m/makesetup
./opt/lib/python3.5/config-3.5m/Setup.config
./opt/lib/python3.5/config-3.5m/install-sh
./opt/lib/python3.5/config-3.5m/Makefile
./opt/lib/python3.5/config-3.5m/python.o
The number of archived files is 7390.

Results:

+-----------------------------------------------------------------------------+
                         Installing Software...
+-----------------------------------------------------------------------------+

installp:  APPLYING software for:
        aixtools.python3.rte 3.5.2.0

Restoring files, please wait.
4250 files restored.
Finished processing all filesets.  (Total time:  1 mins 1 secs).

+-----------------------------------------------------------------------------+
                                Summaries:
+-----------------------------------------------------------------------------+

Installation Summary
--------------------
Name                        Level           Part        Event       Result
-------------------------------------------------------------------------------
aixtools.python3.rte        3.5.2.0         USR         APPLY       SUCCESS

root@x064:[/data/prj/python3/python3-3.5.2]export OBJECT_MODE=64

root@x064:[/data/prj/python3/python3-3.5.2]pip3 install cython
Collecting cython
  Using cached Cython-0.25.1.tar.gz
Installing collected packages: cython
  Running setup.py install for cython ... done
Successfully installed cython-0.25.1
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Question: if there is a patch since 3.5.2 was released - how do I pick this up in order to test (and maybe patch)? I am a bit lost in the hg/git discussion about where to go to get current status.
msg285306 - (view) Author: Michael Felt (aixtools@gmail.com) Date: 2017-01-12 11:18
OK - just looked at what happens with Python3-3.6

new file name: _sysconfigdata_m_aix5_.py

values:
root@x064:[/data/prj/python/python3-3.6.0/X64/opt/lib/python3.6]grep SHARED _sysconf*.py | grep LD
 'BLDSHARED': '/opt/lib/python3.6/config-3.6m/ld_so_aix xlc_r '
 'LDCXXSHARED': '/opt/lib/python3.6/config-3.6m/ld_so_aix xlc_r '
 'LDSHARED': '/opt/lib/python3.6/config-3.6m/ld_so_aix xlc_r '


The 'build' worked, so I am guessing that BLDSHARED had a different value that what it shows here. 

The full pathname for ld_so_aix is correct.

As I mentioned in https://bugs.python.org/issue28311#msg277692 - still broken for Python2-2.7(.13) - shall try your patch above (once I figure out how to grab it)
msg285314 - (view) Author: Michael Felt (aixtools@gmail.com) Date: 2017-01-12 12:04
The "key" bit of the patch is to move the code AND make this assignment:

    if _PYTHON_BUILD:
        vars['LDSHARED'] = vars['BLDSHARED']

Besides, imho, skipping around the problem that LDSHARED is not correctly assigned - it cannot work because BLDSHARED is not set to the 'installed' value.

And, frankly I am amazed (in Python3-3.6.0) both are equal AND both pointing at the 'installed' location.

OOPS: I just looked and the patch above is NOT in the Python3-3.6 branch, and as both variables are identical now in _sysconfigdata_m_aix5.py - neither assignment has any affect.

Again: comparing python2 and python3 it seems the latest Python3 now have the fullpath - and equal definitions - for both variables WHILE Python2 use 'relative' pathnames - BUT both are equal.

As far as the patch goes - it is irrevalant and can be removed in Python3 while a quick hack for Python2 would be to use (in the new location!)

    if _PYTHON_BUILD:
        vars['LDSHARED'] = vars['LDCXXSHARED']

Details:
root@x064:[/data/prj/python]grep SHARED python*/X64/opt/lib/python*/_sysconfig*.py | grep LD
python-2.7.12.0/X64/opt/lib/python2.7/_sysconfigdata.py: 'BLDSHARED': './Modules/ld_so_aix xlc_r -bI:./Modules/python.exp',
python-2.7.12.0/X64/opt/lib/python2.7/_sysconfigdata.py: 'LDCXXSHARED': '/opt/lib/python2.7/config/ld_so_aix xlc_r -bI:/opt/lib/python2.7/config/python.exp',
python-2.7.12.0/X64/opt/lib/python2.7/_sysconfigdata.py: 'LDSHARED': './Modules/ld_so_aix xlc_r -bI:./Modules/python.exp',
python-2.7.13/X64/opt/lib/python2.7/_sysconfigdata.py: 'BLDSHARED': 'Modules/ld_so_aix xlc_r -bI:Modules/python.exp -L/opt/lib',
python-2.7.13/X64/opt/lib/python2.7/_sysconfigdata.py: 'LDCXXSHARED': '/opt/lib/python2.7/config/ld_so_aix xlc_r -bI:/opt/lib/python2.7/config/python.exp',
python-2.7.13/X64/opt/lib/python2.7/_sysconfigdata.py: 'LDSHARED': 'Modules/ld_so_aix xlc_r -bI:Modules/python.exp -L/opt/lib',
python3-3.5.2/X64/opt/lib/python3.5/_sysconfigdata.py: 'BLDSHARED': '/opt/lib/python3.5/config/ld_so_aix xlc_r '
python3-3.5.2/X64/opt/lib/python3.5/_sysconfigdata.py: 'LDCXXSHARED': '/opt/lib/python3.5/config/ld_so_aix xlc_r '
python3-3.5.2/X64/opt/lib/python3.5/_sysconfigdata.py: 'LDSHARED': '/opt/lib/python3.5/config/ld_so_aix xlc_r '
python3-3.6.0/X64/opt/lib/python3.6/_sysconfigdata_m_aix5_.py: 'BLDSHARED': '/opt/lib/python3.6/config-3.6m/ld_so_aix xlc_r '
python3-3.6.0/X64/opt/lib/python3.6/_sysconfigdata_m_aix5_.py: 'LDCXXSHARED': '/opt/lib/python3.6/config-3.6m/ld_so_aix xlc_r '
python3-3.6.0/X64/opt/lib/python3.6/_sysconfigdata_m_aix5_.py: 'LDSHARED': '/opt/lib/python3.6/config-3.6m/ld_so_aix xlc_r '
msg285443 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2017-01-13 21:30
So are you saying you tried patching Python 2 and/or 3, but did not see any relevant change at all?
msg285449 - (view) Author: Michael Felt (Michael.Felt) * Date: 2017-01-13 23:38
I did not go through a whole build process.

Changing:


    if _PYTHON_BUILD:
        vars['BLDSHARED'] = vars['LDSHARED']
to

    if _PYTHON_BUILD:
        vars['LDSHARED'] = vars['BLDSHARED']

is not going to help if both variables are wrong in _sysconfigdata*.py

Also,

The patch is not applied in any version - yet the values in _sysconfigdata*.py are different, i.e., version dependent (without the patch).

If I errored in my assumption that the file being patched is reading _sysconfigdata*.py then I will need to patch and build from scratch to see the effect on _sysconfigdata.py
msg285487 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2017-01-14 15:13
Michael, you need to build from scratch. The values are set and tweaked in various phases of configure and then written to _sysconfigdata.py for installation.

The values in the file reflect the values used during the build, but many of them are not used in an installed version of Python.

Three important phases are:

1) Building modules in the tree during the build process.
2) In-tree testing of build module feature.
3) Building and installing modules with an installed version of Python.

The initial configuration scripts must match the location where the export files will be installed. And the _sysconfigdata.py definitions used to build external modules in an installed version of Python must refer to the proper location.

All of the pieces are interconnected and must be tested in a wholistic manner. A partial rebuild does not test the impact of the patch.
msg285502 - (view) Author: Michael Felt (Michael.Felt) * Date: 2017-01-14 23:41
Ok. I shall rebuild from scratch.

When I do, I start from a "clean" system - only the compiler and my mkinstallp helper script.

I am adding the latest zlib for what I would package but I shall forgoe that for this test.
msg286088 - (view) Author: Michael Felt (Michael.Felt) * Date: 2017-01-23 14:50
This is "only" for Python-2.7 (for now). The others will be tested as I am able.

Working with the patch submitted 2013-10-19 (aka https://bugs.python.org/file32229/issue18235.patch)

A) Without/before the patch:

root@x064:[/data/prj/python/Python-2.7.13.0]grep LDSHARED ./build/lib.aix-5.3-2.7/_sysconfigdata.py
 'BLDSHARED': 'Modules/ld_so_aix xlc_r -bI:Modules/python.exp',
 'LDSHARED': 'Modules/ld_so_aix xlc_r -bI:Modules/python.exp',

B) Apply the patch:
diff -r 0a26ef834a49 Lib/sysconfig.py
--- a/Lib/sysconfig.py	Sat Oct 19 14:24:44 2013 +0200
+++ b/Lib/sysconfig.py	Sat Oct 19 11:46:10 2013 -0700
@@ -368,7 +368,7 @@
     # -- these paths are relative to the Python source, but when installed
     # the scripts are in another directory.
     if _PYTHON_BUILD:
-        vars['LDSHARED'] = vars['BLDSHARED']
+        vars['BLDSHARED'] = vars['LDSHARED']

After the patch:

root@x064:[/data/prj/python/Python-2.7.13.0]grep LDSHARED ./build/lib.aix-5.3-2.7/_sysconfigdata.py
 'BLDSHARED': '/opt/lib/python2.7/config/ld_so_aix xlc_r -bI:/opt/lib/python2.7/config/python.exp',
 'LDSHARED': '/opt/lib/python2.7/config/ld_so_aix xlc_r -bI:/opt/lib/python2.7/config/python.exp',

Which makes me think - maybe NOTHING is needed - as 'BLDSHARED' should be Modules/ld_so_aix,
while  'LDSHARED' should be '/opt/lib/python2.7/config/ld_so_aix

Rather than actual deletes: commented out to (after patch was applied)

C: if: statement and assignment - commented out
diff -ru Python-2.7.13/Lib/sysconfig.py Python-2.7.13.0/Lib/sysconfig.py
--- Python-2.7.13/Lib/sysconfig.py      2016-12-17 20:05:06 +0000
+++ Python-2.7.13.0/Lib/sysconfig.py    2017-01-23 14:39:31 +0000
@@ -310,8 +310,8 @@
     # On AIX, there are wrong paths to the linker scripts in the Makefile
     # -- these paths are relative to the Python source, but when installed
     # the scripts are in another directory.
-    if _PYTHON_BUILD:
-        vars['LDSHARED'] = vars['BLDSHARED']
+#    if _PYTHON_BUILD:
+#        vars['BLDSHARED'] = vars['LDSHARED']

root@x064:[/data/prj/python/Python-2.7.13.0]grep LDSHARED ./build/lib.aix-5.3-2.7/_sysconfigdata.py
 'BLDSHARED': 'Modules/ld_so_aix xlc_r -bI:Modules/python.exp',
 'LDSHARED': '/opt/lib/python2.7/config/ld_so_aix xlc_r -bI:/opt/lib/python2.7/config/python.exp',
root@x064:[/data/prj/python/Python-2.7.13.0]

So, perhaps the best patch 'today', versus what may have been best in 2013 - is to remove the 5 lines starting with # On AIX, ...
msg286114 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2017-01-23 20:56
If the assignment is completely removed, won’t this break the test when run from the source or build tree (as opposed to when installed)? Or at least make the situation worse: the AIX buildbot is already failing test_distutils, but at least it is looking for Modules/ld_so_aix locally rather than in the yet-to-be-installed location.
msg286115 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2017-01-23 21:01
I completely agree with Martin's concern.  As I expressed before, this needs to work in three contexts:

1) Building modules in the tree during the build process.
2) In-tree testing of build module feature (test_distutils).
3) Building and installing modules with an installed version of Python.
msg286120 - (view) Author: Michael Felt (Michael.Felt) * Date: 2017-01-23 21:56
You guys are the experts. I can only comment on what I see. IMHO: the file _sysconfigdata.py is more accurate with nothing in it.

I am clearly confused by whatever process this is. If you believe it is more accurate to have the BLD variable 'inaccurate' in this file - and that we just need to "believe" that it has the correct value during the build (which, starting with version 2.7.13 seems to be the case, as I am able to build in a different directory - and could not do this with version 2.7.10 (first time I tried using separate directories).

In short, I have no expert opinion on this. My naive view is that both variables being accurate in the file is more accurate. In any case, the patch is needed for a working _sysconfigdata.py and integration with something such as "pip build ...". Only after I learned about 'pip' did I ever run into this, i.e., only people who are trying to install something extra have issues here. I have been 'patching' _sysconfigdata.py manually so that things work normally.

I hope my feedback helps you move forward on this.
msg286172 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2017-01-24 10:22
Reading the ticket, it seems that there is some confusion about what LDSHARED and BLDSHARED are used for. BLDSHARED is used to override the LDSHARED value when building libpython and the shared modules (via setup.py).

LDSHARED is what is meant to be used for building shared modules after installation.

This distinction is not being followed by all targets in the Makefile, but is needed in cases where special build tools are necessary, as is the case on AIX.

For the latter, BLDSHARED has to point to the source tree version of those build tools, while LDSHARED has to point to the installed version of these.

On AIX, BLDSHARED should therefore point to the ./Modules/ld_so_aix (or better: the absolute dir of the source tree), while LDSHARED needs to point to the installation target for ld_so_aix, e.g. /usr/local/lib/python2.7/config/ld_so_aix.

So the fix which was already applied to 3.4 is correct for 2.7 as well. The missing part is the fix to the configure script, since in Python 2.7, this still uses relative paths:

                BLDSHARED="Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
                LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"

instead of the ones from 3.4:

                BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:\$(srcdir)/Modules/python.exp"
                LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
msg286173 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2017-01-24 10:28
Hmm, looking at the patch again:

diff -r a089a8b1f93d Lib/sysconfig.py
--- a/Lib/sysconfig.py  Fri Jun 21 18:37:02 2013 -0400
+++ b/Lib/sysconfig.py  Fri Jun 21 22:33:15 2013 -0700
@@ -368,7 +368,7 @@
     # -- these paths are relative to the Python source, but when installed
     # the scripts are in another directory.
     if _PYTHON_BUILD:
-        vars['LDSHARED'] = vars['BLDSHARED']
+        vars['BLDSHARED'] = vars['LDSHARED']
 
     # There's a chicken-and-egg situation on OS X with regards to the
     # _sysconfigdata module after the changes introduced by #15298:

I think that with the configure fix, the special case for AIX can be dropped altogether. It just polishes over the bug in configure, turning a relative path into an absolute one.
msg286174 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2017-01-24 10:32
BTW: Does the ticket still apply to 3.5+ ? From reading the ticket, it seems that the problem is already fixed for those versions.
msg286179 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2017-01-24 12:01
I don’t run AIX, but my understanding is there are three distinct branches (2.7, 3.5, and 3.6+). Some of the following is guessed, so please correct me if I am wrong:

Python 2.7:
_sysconfigdata.py incorrectly created with LDSHARED = Modules/ld_so_aix.
Result: Installed distutils fails (unless you’re in the build tree).
Fix: Apply David’s issue18235.patch + Michael H’s msg219888 fix.

Python 3.5:
David’s issue18235.patch already applied.
_sysconfigdata.py incorrectly created with BLDSHARED = $(LIBPL)/ld_so_aix, i.e. the installed location.
Distutils does not refer to _sysconfigdata.py.
Result: Distutils unaffected, but running from the build tree, sysconfig.get_config_var("LDSHARED") would incorrectly use the installed location.
Fix: Apply Michael H’s msg219888.

Python 3.6+:
Distutils does use _sysconfigdata*.py, thanks to revision 3fa8aebed636.
Result: Distutils shouldn’t work unless Python is already installed. Since the 3.6 and 3.x buildbots pass test_distutils, does that mean that both those versions of Python are already installed?
Fix: Should also be fixed by merging msg219888 from 3.5.

Marc-Andre, regarding configure.ac and absolute vs relative paths, I suggest you open a separate bug. That is an orthogonal issue, and this bug is already too complicated. But also keep in mind Issue 18235. You want the build tree, not the source tree.

Also, if you mean to drop the assignment in sysconfig, I think that will break in-tree usage of sysconfig (3.5+) and distutils (3.6+), unless Python happens to also be installed.
msg286181 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2017-01-24 12:08
Sorry I meant Issue 10656. I recently committed a fix regarding out-of-tree builds and ld_so_aix, and it sounds like you were thinking of reverting that.
msg286184 - (view) Author: Michael Felt (Michael.Felt) * Date: 2017-01-24 13:39
re: msg286115, 

1) Building modules in the tree during the build process.
** if "in the tree" means building outside of source - such as:
../src/python-X.Y.Z/configure ...
make

** the tarball for Python-2.7.13 is building from ../src/Python-2.7.13/configure where as ../src/Python-2.7.12/configure and the earlier (ones I tried) were not.

** However, 'make distclean' is not working. 
   Further details in a later issue - this bit about make distclean id merely FYI. 

2) In-tree testing of build module feature (test_distutils).

** Is this as simple as (from the 'build directory':
make test 

** shall check this later, make test in general seems to be working - is test_distutils a specific test you want verified?
3) Building and installing modules with an installed version of Python.
** FYI: this will work with the 5 lines deleted - as I mentioned above.
   This is how I manually patched _sysconfigdata.py in Python-2.7.12 when I ran into this.

Now reading the other comments from last night...

re: 286172 and 286173

Short response:
it looks as if patches elsewhere in the 'auto' config files has taken care of this issue - at least for Python-2.7

I shall download and check the latest Python-3.{4|5|6} and report back.
msg286188 - (view) Author: Michael Felt (Michael.Felt) * Date: 2017-01-24 14:23
As far as issue10656 and this issue are concerned:

Python-3.4 is out of context (but 3.4.6 was just released) - and does not work with 'out of tree' builds. 

The other versions: 2.7.13, 3.5.3 and 3.6.0 do build out-of-tree.
Note 3.5.3 and 3.6.0 use a different name for sysconfigdata.py

Notes:

FYI: regarding build and src in different directories

Not working...

unable to execute '../src/Python-3.4.6/Modules/ld_so_aix': No such file or directory
unable to execute '../src/Python-3.4.6/Modules/ld_so_aix': No such file or directory
 many many times

Concludes with:
ImportError: No module named 'time'
make: 1254-004 The error code from the last command is 1.
make: 1254-005 Ignored error code 1 from last command.
../src/Python-3.4.6/install-sh: ../src/Python-3.4.6/Modules/ld_so_aix does not exist
make: 1254-004 The error code from the last command is 1.

root@x064:[/data/prj/python/Python-3.4.6]find . -name _sysconfigdata.py -ls -exec grep LDSHARED {} \;
48049316   19 -rw-r-----  1 root      felt         19209 Jan 24 13:55 ./build/lib.aix-5.3-3.4/_sysconfigdata.py
 'BLDSHARED': '/opt/lib/python3.4/config/ld_so_aix xlc_r '
 'LDSHARED': '/opt/lib/python3.4/config/ld_so_aix xlc_r '

+++++++ Working ++++++++

Working: 2.7.13 -- Note: the 'lines' in sysconfig.py are removed:
root@x064:[/data/prj/python/Python-2.7.13.0]find . -name _sysconfigdata\*.py -ls -exec grep LDSHARED {} \;
48038426   16 -rw-r-----  1 root      felt         15807 Jan 24 13:36 ./build/lib.aix-5.3-2.7/_sysconfigdata.py
 'BLDSHARED': 'Modules/ld_so_aix xlc_r -bI:Modules/python.exp',
 'LDSHARED': '/opt/lib/python2.7/config/ld_so_aix xlc_r -bI:/opt/lib/python2.7/config/python.exp',

Working: 3.5.3
48049196   21 -rw-r-----  1 root      felt         20640 Jan 24 13:55 ./build/lib.aix-5.3-3.5/_sysconfigdata.py
 'BLDSHARED': '/opt/lib/python3.5/config-3.5m/ld_so_aix xlc_r '
 'LDSHARED': '/opt/lib/python3.5/config-3.5m/ld_so_aix xlc_r '

Working: 3.6.0 -- Note new file name!!
root@x064:[/data/prj/python/Python-3.6.0]find . -name _sysconfigdata\*.py -ls -exec grep LDSHARED {} \;
47794146   20 -rw-r-----  1 root      felt         20394 Jan 24 13:49 ./build/lib.aix-5.3-3.6/_sysconfigdata_m_aix5_.py
 'BLDSHARED': 'Modules/ld_so_aix xlc_r -bI:Modules/python.exp',
 'LDSHARED': '/opt/lib/python3.6/config-3.6m/ld_so_aix xlc_r '
msg286191 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2017-01-24 15:23
On 24.01.2017 15:23, Michael Felt wrote:
> As far as issue10656 and this issue are concerned:
> 
> Python-3.4 is out of context (but 3.4.6 was just released) - and does not work with 'out of tree' builds. 
> 
> The other versions: 2.7.13, 3.5.3 and 3.6.0 do build out-of-tree.
> Note 3.5.3 and 3.6.0 use a different name for sysconfigdata.py

I'm not sure what you mean with "out of tree". When building
Python, you are supposed to use the source code directory
as work dir.

> Notes:
> 
> FYI: regarding build and src in different directories
> 
> Not working...
> 
> unable to execute '../src/Python-3.4.6/Modules/ld_so_aix': No such file or directory
> unable to execute '../src/Python-3.4.6/Modules/ld_so_aix': No such file or directory
>  many many times
> 
> Concludes with:
> ImportError: No module named 'time'
> make: 1254-004 The error code from the last command is 1.
> make: 1254-005 Ignored error code 1 from last command.
> ../src/Python-3.4.6/install-sh: ../src/Python-3.4.6/Modules/ld_so_aix does not exist
> make: 1254-004 The error code from the last command is 1.
> 
> root@x064:[/data/prj/python/Python-3.4.6]find . -name _sysconfigdata.py -ls -exec grep LDSHARED {} \;
> 48049316   19 -rw-r-----  1 root      felt         19209 Jan 24 13:55 ./build/lib.aix-5.3-3.4/_sysconfigdata.py
>  'BLDSHARED': '/opt/lib/python3.4/config/ld_so_aix xlc_r '
>  'LDSHARED': '/opt/lib/python3.4/config/ld_so_aix xlc_r '

This is strange: where does the "../src/Python-3.4.6/Modules/ld_so_aix"
originate if the paths in the sysconfig file are absolute ?

> +++++++ Working ++++++++
> 
> Working: 2.7.13 -- Note: the 'lines' in sysconfig.py are removed:
> root@x064:[/data/prj/python/Python-2.7.13.0]find . -name _sysconfigdata\*.py -ls -exec grep LDSHARED {} \;
> 48038426   16 -rw-r-----  1 root      felt         15807 Jan 24 13:36 ./build/lib.aix-5.3-2.7/_sysconfigdata.py
>  'BLDSHARED': 'Modules/ld_so_aix xlc_r -bI:Modules/python.exp',
>  'LDSHARED': '/opt/lib/python2.7/config/ld_so_aix xlc_r -bI:/opt/lib/python2.7/config/python.exp',

BLDSHARED should be fixed to use an absolute path, I guess.

> Working: 3.5.3
> 48049196   21 -rw-r-----  1 root      felt         20640 Jan 24 13:55 ./build/lib.aix-5.3-3.5/_sysconfigdata.py
>  'BLDSHARED': '/opt/lib/python3.5/config-3.5m/ld_so_aix xlc_r '
>  'LDSHARED': '/opt/lib/python3.5/config-3.5m/ld_so_aix xlc_r '

Here BLDSHARED is wrong, but shouldn't do any harm since
it's only used for building Python itself, not for
extension modules.

> Working: 3.6.0 -- Note new file name!!
> root@x064:[/data/prj/python/Python-3.6.0]find . -name _sysconfigdata\*.py -ls -exec grep LDSHARED {} \;
> 47794146   20 -rw-r-----  1 root      felt         20394 Jan 24 13:49 ./build/lib.aix-5.3-3.6/_sysconfigdata_m_aix5_.py
>  'BLDSHARED': 'Modules/ld_so_aix xlc_r -bI:Modules/python.exp',
>  'LDSHARED': '/opt/lib/python3.6/config-3.6m/ld_so_aix xlc_r '

This looks odd and like a regression. Again, the path
should be absolute and point to the build tree, not the
installation tree.

PS: The BLDSHARED setting in sysconfig is not really relevant.
It's only there because we have it in the Makefile.
msg286192 - (view) Author: Michael Felt (Michael.Felt) * Date: 2017-01-24 15:27
I am back at this: (note: short answer to msg277745 - No. does not work for me)

As ... expressed before, this needs to work in three contexts:

2) In-tree testing of build module feature (test_distutils).

Below are results of 'in tree' and 'out of tree' testing. in/out seems to have no (more) impact.
++++
msg219888 also has a patch - that moves the code back to where it originally was: _init_posix

But - same issue - ld_so_aix is not found. (notice the "src" in string of 'threading.py')
[112/401/2] test_distutils
xlc_r: 1501-218 (S) file _configtest.i contains an incorrect file suffix
unable to execute '/opt/lib/python2.7/config/ld_so_aix': No such file or directory
Warning -- os.environ was modified by test_distutils
test test_distutils failed -- multiple errors occurred; run in verbose mode for details
[113/401/3] test_dl
test_dl skipped -- No module named dl
[114/401/3] test_docxmlrpc
/data/prj/python/src/Python-2.7.13/Lib/threading.py:846: DeprecationWarning: sys.exc_clear() not supported in 3.x; use except clauses
  self.__exc_clear()
[115/401/3] test_dumbdbm
root@x064:[/data/prj/python/Python-2.7.13]


Now, back to 'in tree' with patch from msg219888 (no "src" in path)

root@x064:[/data/prj/python/Python-2.7.13]find . -name _sysconfigdata\*.py -ls -exec grep LDSHARED {} \;
48056876   16 -rw-r-----  1 root      1000        15362 Jan 24 15:07 ./build/lib.aix-5.3-2.7/_sysconfigdata.py
 'BLDSHARED': 'Modules/ld_so_aix xlc_r -bI:Modules/python.exp',
 'LDSHARED': '/opt/lib/python2.7/config/ld_so_aix xlc_r -bI:/opt/lib/python2.7/config/python.exp',
[112/401/2] test_distutils
xlc_r: 1501-218 (S) file _configtest.i contains an incorrect file suffix
unable to execute '/opt/lib/python2.7/config/ld_so_aix': No such file or directory
Warning -- os.environ was modified by test_distutils
test test_distutils failed -- multiple errors occurred; run in verbose mode for details
[113/401/3] test_dl
test_dl skipped -- No module named dl
[114/401/3] test_docxmlrpc
/data/prj/python/Python-2.7.13/Lib/threading.py:846: DeprecationWarning: sys.exc_clear() not supported in 3.x; use except clauses
  self.__exc_clear()

Conclusion:
** As the code is - that is removed means the environment variable in sysconfigdata.py is correct,
   I would suggest the patch is to remove the 6 lines there.
   Further, the addition of the code below (per msg219888) has no effect, including it is not needed.

The .dist file is from the source tarball from last december for 2.7.13

michael@x071:[/data/prj/python/src]diff -u  Python-2.7.13/Lib/sysconfig.py.dist>
--- Python-2.7.13/Lib/sysconfig.py.dist 2016-12-17 20:05:06 +0000
+++ Python-2.7.13/Lib/sysconfig.py      2017-01-24 14:56:20 +0000
@@ -307,12 +307,6 @@
             msg = msg + " (%s)" % e.strerror
         raise IOError(msg)

-    # On AIX, there are wrong paths to the linker scripts in the Makefile
-    # -- these paths are relative to the Python source, but when installed
-    # the scripts are in another directory.
-    if _PYTHON_BUILD:
-        vars['LDSHARED'] = vars['BLDSHARED']
-
     # There's a chicken-and-egg situation on OS X with regards to the
     # _sysconfigdata module after the changes introduced by #15298:
     # get_config_vars() is called by get_platform() as part of the
@@ -355,6 +349,11 @@
     # _sysconfigdata is generated at build time, see _generate_posix_vars()
     from _sysconfigdata import build_time_vars
     vars.update(build_time_vars)
+    # On AIX, there are wrong paths to the linker scripts in the Makefile
+    # -- these paths are relative to the Python source, but when installed
+    # the scripts are in another directory.
+    if _PYTHON_BUILD:
+        vars['LDSHARED'] = vars['BLDSHARED']

 def _init_non_posix(vars):
     """Initialize the module as appropriate for NT"""
msg286193 - (view) Author: Michael Felt (Michael.Felt) * Date: 2017-01-24 15:35
OK - so details on the failing tests - for the record only.

However, I would appreciate some 'expert' feedback on what is expected to be happening in this test:

======================================================================
FAIL: test_sysconfig_compiler_vars (distutils.tests.test_sysconfig.SysconfigTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/prj/python/Python-2.7.13/Lib/distutils/tests/test_sysconfig.py", line 102, in test_sysconfig_compiler_vars
    self.assertEqual(global_sysconfig.get_config_var('LDSHARED'), sysconfig.get_config_var('LDSHARED'))
AssertionError: 'Modules/ld_so_aix xlc_r -bI:Modules/python.exp' != '/opt/lib/python2.7/config/ld_so_aix xlc_r -bI:/opt/lib/python2.7/config/python.exp'

----------------------------------------------------------------------

BULK details...

======================================================================
ERROR: test_record_extensions (distutils.tests.test_install.InstallTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/prj/python/Python-2.7.13/Lib/distutils/tests/test_install.py", line 216, in test_record_extensions
    cmd.run()
  File "/data/prj/python/Python-2.7.13/Lib/distutils/command/install.py", line 563, in run
    self.run_command('build')
  File "/data/prj/python/Python-2.7.13/Lib/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/data/prj/python/Python-2.7.13/Lib/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/data/prj/python/Python-2.7.13/Lib/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
  File "/data/prj/python/Python-2.7.13/Lib/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/data/prj/python/Python-2.7.13/Lib/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/data/prj/python/Python-2.7.13/Lib/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/data/prj/python/Python-2.7.13/Lib/distutils/command/build_ext.py", line 449, in build_extensions
    self.build_extension(ext)
  File "/data/prj/python/Python-2.7.13/Lib/distutils/command/build_ext.py", line 531, in build_extension
    target_lang=language)
  File "/data/prj/python/Python-2.7.13/Lib/distutils/ccompiler.py", line 691, in link_shared_object
    extra_preargs, extra_postargs, build_temp, target_lang)
  File "/data/prj/python/Python-2.7.13/Lib/distutils/unixccompiler.py", line 202, in link
    raise LinkError, msg
LinkError: command '/opt/lib/python2.7/config/ld_so_aix' failed with exit status 1

======================================================================
ERROR: test_search_cpp (distutils.tests.test_config_cmd.ConfigTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/prj/python/Python-2.7.13/Lib/distutils/tests/test_config_cmd.py", line 46, in test_search_cpp
    match = cmd.search_cpp(pattern='xxx', body='/* xxx */')
  File "/data/prj/python/Python-2.7.13/Lib/distutils/command/config.py", line 206, in search_cpp
    src, out = self._preprocess(body, headers, include_dirs, lang)
  File "/data/prj/python/Python-2.7.13/Lib/distutils/command/config.py", line 129, in _preprocess
    self.compiler.preprocess(src, out, include_dirs=include_dirs)
  File "/data/prj/python/Python-2.7.13/Lib/distutils/unixccompiler.py", line 113, in preprocess
    raise CompileError, msg
CompileError: command 'xlc_r' failed with exit status 40

======================================================================
ERROR: test_build_ext (distutils.tests.test_build_ext.BuildExtTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/prj/python/Python-2.7.13/Lib/distutils/tests/test_build_ext.py", line 63, in test_build_ext
    cmd.run()
  File "/data/prj/python/Python-2.7.13/Lib/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/data/prj/python/Python-2.7.13/Lib/distutils/command/build_ext.py", line 449, in build_extensions
    self.build_extension(ext)
  File "/data/prj/python/Python-2.7.13/Lib/distutils/command/build_ext.py", line 531, in build_extension
    target_lang=language)
  File "/data/prj/python/Python-2.7.13/Lib/distutils/ccompiler.py", line 691, in link_shared_object
    extra_preargs, extra_postargs, build_temp, target_lang)
  File "/data/prj/python/Python-2.7.13/Lib/distutils/unixccompiler.py", line 202, in link
    raise LinkError, msg
LinkError: command '/opt/lib/python2.7/config/ld_so_aix' failed with exit status 1

======================================================================
ERROR: test_get_outputs (distutils.tests.test_build_ext.BuildExtTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/prj/python/Python-2.7.13/Lib/distutils/tests/test_build_ext.py", line 292, in test_get_outputs
    cmd.run()
  File "/data/prj/python/Python-2.7.13/Lib/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/data/prj/python/Python-2.7.13/Lib/distutils/command/build_ext.py", line 449, in build_extensions
    self.build_extension(ext)
  File "/data/prj/python/Python-2.7.13/Lib/distutils/command/build_ext.py", line 531, in build_extension
    target_lang=language)
  File "/data/prj/python/Python-2.7.13/Lib/distutils/ccompiler.py", line 691, in link_shared_object
    extra_preargs, extra_postargs, build_temp, target_lang)
  File "/data/prj/python/Python-2.7.13/Lib/distutils/unixccompiler.py", line 202, in link
    raise LinkError, msg
LinkError: command '/opt/lib/python2.7/config/ld_so_aix' failed with exit status 1

======================================================================
FAIL: test_sysconfig_compiler_vars (distutils.tests.test_sysconfig.SysconfigTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/prj/python/Python-2.7.13/Lib/distutils/tests/test_sysconfig.py", line 102, in test_sysconfig_compiler_vars
    self.assertEqual(global_sysconfig.get_config_var('LDSHARED'), sysconfig.get_config_var('LDSHARED'))
AssertionError: 'Modules/ld_so_aix xlc_r -bI:Modules/python.exp' != '/opt/lib/python2.7/config/ld_so_aix xlc_r -bI:/opt/lib/python2.7/config/python.exp'

----------------------------------------------------------------------
Ran 194 tests in 3.254s

FAILED (failures=1, errors=4, skipped=21)
Traceback (most recent call last):
  File "test_distutils.py", line 18, in <module>
    test_main()
  File "test_distutils.py", line 13, in test_main
    test_support.run_unittest(distutils.tests.test_suite())
  File "/data/prj/python/Python-2.7.13/Lib/test/test_support.py", line 1494, in run_unittest
    _run_suite(suite)
  File "/data/prj/python/Python-2.7.13/Lib/test/test_support.py", line 1477, in _run_suite
    raise TestFailed(err)
test.test_support.TestFailed: multiple errors occurred
root@x064:[/data/prj/python/Python-2.7.13/Lib/test]
msg286196 - (view) Author: Eric N. Vander Weele (ericvw) * Date: 2017-01-24 15:47
I have a (large) patch that completely eliminates the need for ld_so_aix and makeexp_aix.  I've applied and been using this with for Python 2.7 and 3.5+, but I still need to go back and validate the tests to ensure everything passes as expected.

It's still a work in progress, but the patch can be found at https://github.com/ericvw/cpython/commit/e889f5fd04c1b73ef06e9f6e60108b2a7718b7d6.

If this is out of context for this particular issue, I'm happy to raise a new issue to have a focus discussion about potentially landing this.  Ignore changes for README.AIX since I am addressing that in issue28845.

I believe if we can eliminate the wrapper scripts, it will simplify the build and linking for AIX for the interpreter and C-extension modules.
msg286197 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2017-01-24 17:17
On 24.01.2017 16:47, Eric N. Vander Weele wrote:
> 
> I have a (large) patch that completely eliminates the need for ld_so_aix and makeexp_aix.  I've applied and been using this with for Python 2.7 and 3.5+, but I still need to go back and validate the tests to ensure everything passes as expected.
> 
> It's still a work in progress, but the patch can be found at https://github.com/ericvw/cpython/commit/e889f5fd04c1b73ef06e9f6e60108b2a7718b7d6.

Hmm, the patch seems to be incomplete, as it just removes
all the AIX support scripts and mentions, without adding
anything new to accommodate for the removal.

Please note that building with both xlc_r and gcc needs to
be supported.

> If this is out of context for this particular issue, I'm happy to raise a new issue to have a focus discussion about potentially landing this.  Ignore changes for README.AIX since I am addressing that in issue28845.

Please open a new issue for this to discuss this change there.

> I believe if we can eliminate the wrapper scripts, it will simplify the build and linking for AIX for the interpreter and C-extension modules.

Sure, if that's possible. The scripts are rather old and AIX
has moved on since those days.

FWIW: They still do work without any problems, provided the
Makefile and distutils can find them.
msg286198 - (view) Author: Eric N. Vander Weele (ericvw) * Date: 2017-01-24 17:37
> Hmm, the patch seems to be incomplete, as it just removes all the AIX support scripts and mentions, without adding anything new to accommodate for the removal.

The new changes to accommodate for the script removal are in https://github.com/ericvw/cpython/commit/e889f5fd04c1b73ef06e9f6e60108b2a7718b7d6#diff-e2d5a00791bce9a01f99bc6fd613a39dR9159 and https://github.com/ericvw/cpython/commit/e889f5fd04c1b73ef06e9f6e60108b2a7718b7d6#diff-67e997bcfdac55191033d57a16d1408aR2403.

> Please note that building with both xlc_r and gcc needs to be supported.

I'll need to double check gcc, I have it working with xlc_r already.

> Please open a new issue for this to discuss this change there.

Absolutely, I'll clean up the patch and provide more details for the changes in another issue.  Thanks.
History
Date User Action Args
2017-01-24 17:37:35ericvwsetmessages: + msg286198
2017-01-24 17:17:02lemburgsetmessages: + msg286197
2017-01-24 15:47:35ericvwsetmessages: + msg286196
2017-01-24 15:35:04Michael.Feltsetmessages: + msg286193
2017-01-24 15:27:48Michael.Feltsetmessages: + msg286192
2017-01-24 15:23:26lemburgsetmessages: + msg286191
2017-01-24 14:23:57Michael.Feltsetmessages: + msg286188
2017-01-24 13:39:20Michael.Feltsetmessages: + msg286184
2017-01-24 12:08:08martin.pantersetmessages: + msg286181
2017-01-24 12:01:50martin.pantersetmessages: + msg286179
2017-01-24 10:33:38pitrousetnosy: - pitrou
2017-01-24 10:32:24lemburgsetmessages: + msg286174
2017-01-24 10:28:44lemburgsetmessages: + msg286173
2017-01-24 10:22:07lemburgsetnosy: + lemburg
messages: + msg286172
2017-01-23 21:56:27Michael.Feltsetmessages: + msg286120
2017-01-23 21:01:02David.Edelsohnsetmessages: + msg286115
2017-01-23 20:56:00martin.pantersetmessages: + msg286114
2017-01-23 14:50:18Michael.Feltsetmessages: + msg286088
2017-01-14 23:41:38Michael.Feltsetmessages: + msg285502
2017-01-14 15:13:24David.Edelsohnsetmessages: + msg285487
2017-01-13 23:38:40Michael.Feltsetmessages: + msg285449
2017-01-13 21:30:06martin.pantersetmessages: + msg285443
2017-01-12 12:04:49aixtools@gmail.comsetmessages: + msg285314
2017-01-12 11:18:51aixtools@gmail.comsetmessages: + msg285306
2016-11-29 00:24:42ericvwsetnosy: + ericvw
2016-11-17 07:14:41Michael.Feltsetmessages: + msg281024
2016-11-16 21:12:20Michael.Feltsetmessages: + msg280991
2016-10-26 02:09:54martin.pantersetmessages: + msg279482
2016-10-26 00:43:48martin.pantersetmessages: + msg279472
2016-10-23 19:56:13aixtools@gmail.comsetmessages: + msg279281
2016-10-23 19:54:18aixtools@gmail.comsetnosy: + aixtools@gmail.com
messages: + msg279279
2016-10-14 23:23:25martin.pantersetmessages: + msg278674
2016-10-03 09:31:59haubisetmessages: + msg277944
2016-09-30 23:13:31David.Edelsohnsetmessages: + msg277783
2016-09-30 22:33:14Michael.Feltsetmessages: + msg277780
2016-09-30 18:45:35David.Edelsohnsetmessages: + msg277769
2016-09-30 07:06:58martin.panterlinkissue28311 superseder
2016-09-30 07:03:13martin.pantersetstatus: closed -> open

superseder: AIX shared library extension modules installation broken - Python2.7 ->
versions: + Python 2.7, Python 3.5, Python 3.6, Python 3.7, - Python 3.3, Python 3.4
nosy: + Michael.Felt

messages: + msg277745
stage: resolved -> patch review
2016-09-30 06:38:45martin.pantersetsuperseder: AIX shared library extension modules installation broken - Python2.7

messages: + msg277741
nosy: + martin.panter
2014-10-30 09:38:19pelsonsetnosy: + pelson
messages: + msg230257
2014-06-06 15:23:23haubisetmessages: + msg219888
2014-06-03 08:42:54haubisetmessages: + msg219670
2014-06-03 08:41:01haubisetfiles: - python-tip-aix-absbuilddir.patch
2013-12-05 17:57:07haubisetmessages: + msg205315
2013-12-05 16:26:26David.Edelsohnsetmessages: + msg205310
2013-12-05 13:51:27haubisetmessages: + msg205297
2013-11-08 16:46:39David.Edelsohnsetmessages: + msg202436
2013-11-08 15:24:30haubisetfiles: + python-tip-aix-absbuilddir.patch
nosy: + haubi
messages: + msg202427

2013-10-22 04:18:56David.Edelsohnsetmessages: + msg200875
2013-10-19 20:08:38pitrousetstatus: open -> closed
resolution: fixed
messages: + msg200492

stage: resolved
2013-10-19 20:07:54python-devsetnosy: + python-dev
messages: + msg200491
2013-10-19 20:00:13pitrousetnosy: + pitrou
messages: + msg200488
2013-10-19 19:02:44David.Edelsohnsetmessages: + msg200479
2013-10-19 18:48:19David.Edelsohnsetfiles: + issue18235.patch
keywords: + patch
messages: + msg200476
2013-10-19 18:39:55larrysetnosy: + larry
2013-06-22 00:35:37David.Edelsohnsetmessages: + msg191624
2013-06-21 17:15:22eric.araujosetversions: + Python 3.3, Python 3.4, - Python 3.5
nosy: + eric.araujo

messages: + msg191598

components: + Build, - Extension Modules
2013-06-18 01:26:22David.Edelsohnsetmessages: + msg191385
2013-06-17 00:33:21David.Edelsohncreate