[MacPorts] #39223: incorrect flags from distutils when linking against python27 @2.7.5_0
#39223: incorrect flags from distutils when linking against python27 @2.7.5_0 --------------------+---------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Keywords: | Port: python27 --------------------+---------------------- I've been having some problems build some software against python27 @2.7.5_0: {{{ checking for a Python interpreter with version >= 2.6... python checking for python... /opt/local/bin/python checking for python version... 2.7 checking for python platform... darwin checking for python script directory... ${prefix}/lib/python2.7/site- packages checking for python extension module directory... ${exec_prefix}/lib/python2.7/site-packages checking for python2.7... (cached) /opt/local/bin/python checking for a version of Python >= '2.1.0'... yes checking for the distutils Python package... yes checking for Python include path... -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 checking for Python library path... -L/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -lpython2.7 checking for Python site-packages path... /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages checking python extra libraries... -ldl -framework CoreFoundation checking python extra linking flags... -u _PyMac_Error Python.framework/Versions/2.7/Python checking consistency of all components of python development environment... no configure: error: in `/Users/ram/git/lalsuite/lalburst': configure: error: Could not link test program to Python. Maybe the main Python library has been installed in some non-standard library path. If so, pass it to configure, via the LDFLAGS environment variable. Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib" ============================================================================ ERROR! You probably have to install the development version of the Python package for your distribution. The exact name of this package varies among them. ============================================================================ See `config.log' for more details }}} This seems to be due to distutils reporting incorrectly the flags required to link against python. With @2.7.5_0: {{{ Python 2.7.5 (default, May 24 2013, 11:10:07) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import distutils.sysconfig conf = distutils.sysconfig.get_config_var print (conf('LINKFORSHARED')) -u _PyMac_Error Python.framework/Versions/2.7/Python
}}}
i.e. it looks like the path is incomplete. Whereas if I revert back to @2.7.3_1 I get what I would expect: {{{ Python 2.7.3 (default, Nov 26 2012, 15:06:55) [GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin Type "help", "copyright", "credits" or "license" for more information.
import distutils.sysconfig conf = distutils.sysconfig.get_config_var print (conf('LINKFORSHARED')) -u _PyMac_Error /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python
}}}
-- Ticket URL: <https://trac.macports.org/ticket/39223> MacPorts <http://www.macports.org/> Ports system for OS X
#39223: incorrect flags from distutils when linking against python27 @2.7.5_0 -----------------------+------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Changes (by macsforever2000@…): * cc: macsforever2000@… (added) Comment: I see the same result for python 2.7.5. -- Ticket URL: <https://trac.macports.org/ticket/39223#comment:1> MacPorts <http://www.macports.org/> Ports system for OS X
#39223: incorrect flags from distutils when linking against python27 @2.7.5_0 -----------------------+------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by nad@…): LINKFORSHARED is a configuration variable used to build the Python interpreter itself in its build directory. It isn't intended to be used directly by other components. Unfortunately, Python builds export all configuration variables whether they are meaningful or not. To embed Python, the supported interface for finding build flags is to use the pythonx.y-config script: {{{ $ /opt/local/bin/python2.7-config --cflags -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -pipe -O2 -fwrapv -arch x86_64 -arch i386 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes $ /opt/local/bin/python2.7-config --ldflags -L/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -ldl -framework CoreFoundation -lpython2.7 }}} This is explained in the "Extending and Embedding the Python Interpreter" manual of the Python docs [http://docs.python.org/3/extending/embedding.html#compiling-and-linking- under-unix-like-systems] Note that the Python 3 version of this doc is more up-to-date than the Python 2 version. -- Ticket URL: <https://trac.macports.org/ticket/39223#comment:3> MacPorts <http://www.macports.org/> Ports system for OS X
#39223: incorrect flags from distutils when linking against python27 @2.7.5_0 -----------------------+------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by jmr@…): There's a reinplace in post-destroot that looks like it's meant to "fix" this. It originated from #15099. Upstream bug report: http://bugs.python.org/issue3588 -- Ticket URL: <https://trac.macports.org/ticket/39223#comment:4> MacPorts <http://www.macports.org/> Ports system for OS X
#39223: incorrect flags from distutils when linking against python27 @2.7.5_0 -----------------------+------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by nad@…): I think the correct solution here is to patch and fix upstream whatever ports are referencing Python's LINKFORSHARED. They are likely causing problems for everyone. I know the Homebrew folks are currently reporting weird problems with /usr/bin/vim picking up the wrong python at runtime. -- Ticket URL: <https://trac.macports.org/ticket/39223#comment:5> MacPorts <http://www.macports.org/> Ports system for OS X
#39223: incorrect flags from distutils when linking against python27 @2.7.5_0 -----------------------+------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by ram@…): Replying to [comment:3 nad@…]:
LINKFORSHARED is a configuration variable used to build the Python interpreter itself in its build directory. It isn't intended to be used directly by other components. Unfortunately, Python builds export all configuration variables whether they are meaningful or not. To embed Python, the supported interface for finding build flags is to use the pythonx.y-config script:
Thanks that's interesting, the software I was trying to build uses the [http://git.savannah.gnu.org/gitweb/?p=autoconf- archive.git;a=blob;f=m4/ax_python_devel.m4 `ax_python_devel.m4`] macro from the autoconf archive but `python-config` looks like a better approach. I'll forward that to upstream. -- Ticket URL: <https://trac.macports.org/ticket/39223#comment:6> MacPorts <http://www.macports.org/> Ports system for OS X
#39223: incorrect flags from distutils when linking against python27 @2.7.5_0 -----------------------+------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by jmr@…): I guess someone should probably tell the maintainer of that autoconf macro that they're doing it wrong, too. -- Ticket URL: <https://trac.macports.org/ticket/39223#comment:7> MacPorts <http://www.macports.org/> Ports system for OS X
#39223: incorrect flags from distutils when linking against python27 @2.7.5_0 -----------------------+------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by egall@…): #39357 is related -- Ticket URL: <https://trac.macports.org/ticket/39223#comment:8> MacPorts <http://www.macports.org/> Ports system for OS X
#39223: python27 @2.7.5_0: incorrect LINKFORSHARED from distutils.sysconfig -----------------------+------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Changes (by larryv@…): * cc: wichert@… (added) -- Ticket URL: <https://trac.macports.org/ticket/39223#comment:9> MacPorts <http://www.macports.org/> Ports system for OS X
#39223: python27 @2.7.5_0: incorrect LINKFORSHARED from distutils.sysconfig -----------------------+------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by wichert@…): For what it's worth I whipped up a basic autoconf macro that will use python-config and should be a drop-in replacement for ax_python_devel.m4 . I've attached it to this ticket. -- Ticket URL: <https://trac.macports.org/ticket/39223#comment:10> MacPorts <http://www.macports.org/> Ports system for OS X
#39223: python27 @2.7.5_0: incorrect LINKFORSHARED from distutils.sysconfig -----------------------+------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by ram@…): Nice, it's probably worth submitting something like this to the autoconf- archive. -- Ticket URL: <https://trac.macports.org/ticket/39223#comment:11> MacPorts <http://www.macports.org/> Ports system for OS X
#39223: python27 @2.7.5_0: incorrect LINKFORSHARED from distutils.sysconfig -----------------------+------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Changes (by larryv@…): * cc: bryant.gipson@…, tiago@…, mmoll@… (added) Comment: Has duplicate #39363. -- Ticket URL: <https://trac.macports.org/ticket/39223#comment:12> MacPorts <http://www.macports.org/> Ports system for OS X
#39223: python27 @2.7.5_0: incorrect LINKFORSHARED from distutils.sysconfig -----------------------+------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by wichert@…): I'll try to submit it to the archive. I wonder if they'll take it though since the python document does mention python-config is not guaranteed to work everywhere, and if it does not work one should still us distutils.sysconfig. There is even an example using {{{LINKFORSHARED}}}. -- Ticket URL: <https://trac.macports.org/ticket/39223#comment:13> MacPorts <http://www.macports.org/> Ports system for OS X
#39223: python27 @2.7.5_0: incorrect LINKFORSHARED from distutils.sysconfig -----------------------+------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by nad@…): I've opened http://bugs.python.org/issue18164 to fix the Python docs. -- Ticket URL: <https://trac.macports.org/ticket/39223#comment:14> MacPorts <http://www.macports.org/> Ports system for OS X
#39223: python27 @2.7.5_0: incorrect LINKFORSHARED from distutils.sysconfig -----------------------+------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by t.m.isele@…): Replying to [comment:10 wichert@…]:
For what it's worth I whipped up a basic autoconf macro that will use python-config and should be a drop-in replacement for ax_python_devel.m4 . I've attached it to this ticket. Thanx for cooking that thing together! Please excuse my stupid question: What do I exactly do with this file to fix the problem of installing a port linked to python 2.7.5 (graph-tool in my case..) Thank you!
-- Ticket URL: <https://trac.macports.org/ticket/39223#comment:15> MacPorts <http://www.macports.org/> Ports system for OS X
#39223: python27 @2.7.5_0: incorrect LINKFORSHARED from distutils.sysconfig -----------------------+------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by egall@…): Replying to [comment:6 ram@…]:
Replying to [comment:3 nad@…]:
LINKFORSHARED is a configuration variable used to build the Python interpreter itself in its build directory. It isn't intended to be used directly by other components. Unfortunately, Python builds export all configuration variables whether they are meaningful or not. To embed Python, the supported interface for finding build flags is to use the pythonx.y-config script:
Thanks that's interesting, the software I was trying to build uses the [http://git.savannah.gnu.org/gitweb/?p=autoconf- archive.git;a=blob;f=m4/ax_python_devel.m4 `ax_python_devel.m4`] macro from the autoconf archive but `python-config` looks like a better approach. I'll forward that to upstream.
#39804 would update the autoconf-archive port to the latest version, which includes changes to this macro. idk if that would fix this, but it's worth a shot... -- Ticket URL: <https://trac.macports.org/ticket/39223#comment:18> MacPorts <http://www.macports.org/> Ports system for OS X
#39223: python27 @2.7.5_0: incorrect LINKFORSHARED from distutils.sysconfig -----------------------+------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by aronnax@…): Replying to [comment:18 egall@…]:
Replying to [comment:6 ram@…]:
Replying to [comment:3 nad@…]:
LINKFORSHARED is a configuration variable used to build the Python interpreter itself in its build directory. It isn't intended to be used directly by other components. Unfortunately, Python builds export all configuration variables whether they are meaningful or not. To embed Python, the supported interface for finding build flags is to use the pythonx.y-config script:
Thanks that's interesting, the software I was trying to build uses the [http://git.savannah.gnu.org/gitweb/?p=autoconf- archive.git;a=blob;f=m4/ax_python_devel.m4 `ax_python_devel.m4`] macro from the autoconf archive but `python-config` looks like a better approach. I'll forward that to upstream.
#39804 would update the autoconf-archive port to the latest version, which includes [http://git.savannah.gnu.org/cgit/autoconf- archive.git/commit/?id=fec534a05b5863c6dc00caede574fc9ffb2964a7 changes to this macro]. idk if that would fix this, but it's worth a shot...
No, it still has LINKFORSHARED in it. -- Ticket URL: <https://trac.macports.org/ticket/39223#comment:20> MacPorts <http://www.macports.org/> Ports system for OS X
#39223: python27 @2.7.5_0: incorrect LINKFORSHARED from distutils.sysconfig -----------------------+-------------------- Reporter: ram@… | Owner: jwa@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.1.3 Resolution: invalid | Keywords: Port: python27 | -----------------------+-------------------- Changes (by jmr@…): * status: new => closed * resolution: => invalid Comment: Closing, since the problem is in the other software that tries to use this value. -- Ticket URL: <https://trac.macports.org/ticket/39223#comment:21> MacPorts <http://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts