Opened 13 years ago

Closed 12 years ago

#27916 closed defect (fixed)

python27 runtime IOError due to MACOSX_DEPLOYMENT_TARGET

Reported by: joshmoz@… Owned by: jyrkiwahlstedt
Priority: Normal Milestone:
Component: ports Version: 1.9.2
Keywords: Cc: singingwolfboy@…, deric@…, pixilla (Bradley Giesbrecht)
Port: python27

Description (last modified by ryandesign (Ryan Carsten Schmidt))

I am a Mozilla developer, we recommend that our Mac OS X developers use MacPorts to get build dependencies (like Mercurial, libidl, autoconf213). Mozilla's build system will use python2.7 from MacPorts over the system python if it exists, which it does in my case because it was a dep for something else I installed via MacPorts. I get the following error when trying to build Firefox with a deployment target of MACOSX_DEPLOYMENT_TARGET=10.5:

checking for Python version >= 2.5 but not 3.x... Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 553, in <module>
    main()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 535, in main
    known_paths = addusersitepackages(known_paths)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 268, in addusersitepackages
    user_site = getusersitepackages()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 243, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 233, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 535, in get_config_var
    return get_config_vars().get(name)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 434, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 313, in _init_posix
    raise IOError(msg)
IOError: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.5" but "10.6" during configure
configure: error: Python 2.5 or higher (but not Python 3.x) is required.
*** Fix above errors and then restart with               "make -f client.mk build"
make[1]: *** [configure] Error 1
make[1]: Leaving directory `/Volumes/MozillaBuilds/10_6/ff_200_debug_32'
make: *** [/Volumes/MozillaBuilds/10_6/ff_200_debug_32/objdir-debug/Makefile] Error 2
make: Leaving directory `/Volumes/MozillaBuilds/10_6/ff_200_debug_32'

I assume this is because MACOSX_DEPLOYMENT_TARGET is set to 10.5 for the Firefox build but it was set to 10.6 for the python2.7 build. For some reason the current state of MACOSX_DEPLOYMENT_TARGET matters for python2.7 when it shouldn't.

If I force the Firefox build to use python26 from MacPorts (PYTHON=/opt/local/bin/python2.6) this problem doesn't happen so I think this problem is specific to python27 from MacPorts.

Change History (12)

comment:1 Changed 13 years ago by singingwolfboy@…

Cc: singingwolfboy@… added

Cc Me!

comment:2 Changed 13 years ago by jmroot (Joshua Root)

Owner: changed from macports-tickets@… to jwa@…

Please remember to cc the maintainer.

comment:3 Changed 13 years ago by jmroot (Joshua Root)

I doubt this is specific to MacPorts; the code in sysconfig.py raises an error any time the current MDT is lower than the one python was configured with. One workaround would be to use the (unsupported) macosx_deployment_target setting in macports.conf to build python27 targeting 10.5.

comment:4 Changed 13 years ago by deric@…

Cc: deric@… added

Cc Me!

comment:5 Changed 13 years ago by deric@…

The python_select port in macports will allow you to easily switch between different versions of python installed by macports and the apple supplied one. This checking of MACOSX_DEPLOYMENT_TARGET is a bit dubious imo. since the site module always is imported automatically during initializtion and the getuserbase call then will import the build configuration and bail.

Basically any environment with MACOSX_DEPLOYMENT_TARGET set to something below what python2.7 was built with will not run. Another quick workaround is setting MACOSX_DEPLOYMENT_TARGET in /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/Makefile since that's where sysconfig is getting the value from.

comment:6 Changed 13 years ago by deric@…

This bug is captured by http://bugs.python.org/issue9516

comment:7 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

comment:8 in reply to:  6 Changed 13 years ago by pixilla (Bradley Giesbrecht)

Replying to deric@…:

This bug is captured by http://bugs.python.org/issue9516

issue9516 has status: closed, resolution: fixed.

comment:9 Changed 13 years ago by pixilla (Bradley Giesbrecht)

Cc: pixilla@… added

Cc Me!

comment:10 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

So what do we need to do to be able to close this ticket? Do we need to apply some upstream patch to our ports? Or have fixed versions already been released?

comment:11 Changed 12 years ago by ned-deily (Ned Deily)

The last set of upstream fixes for Issue9516 were committed after Python 2.7.2 was released; they will be in 2.7.3 (release date TBD). But the specific problem documented in this issue (that of sysconfig being influenced by the MACOSX_DEPLOYMENT_TARGET) was fixed in the first set of fixes which are in 2.7.2. (All of the fixes for Python 3 were released in 3.2.2.)

comment:12 Changed 12 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: newclosed

Looks fixed to me.

Note: See TracTickets for help on using tickets.