This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python build fails on OS X with "$MACOSX_DEPLOYMENT_TARGET mismatch"
Type: compile error Stage: resolved
Components: Build, macOS Versions:
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: aft, ezio.melotti, loewis, ned.deily, ronaldoussoren
Priority: normal Keywords:

Created on 2012-04-16 22:36 by aft, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg158511 - (view) Author: Andrew Thompson (aft) Date: 2012-04-16 22:36
I could not get Python3 to build on my OSX 10.6.8 box as per the instructions on the website (or those in the README).  It "configures" , but does not "make" :
    
<snip>
IOError: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.4" but "10.5" during configure
make: *** [Include/Python-ast.h] Error 1
</snip>

I can fix this by issuing

export MACOSX_DEPLOYMENT_TARGET=10.6

EXTRA WRINKLE:
It then configures and makes. But if I select a new terminal  (i.e. without the exported env variable, and "make clean ; configure ; make" it continues to make perfectly.    Not sure what is going on here.

IMPORTANT:
**** To replicate this bug I had to get a fresh mercurial clone ****


Q: Is this the correct setting for the TARGET ?
Q: Does this happen for other OSX users (specifically !=10.6 users) ?

Q: Should this be documented to save grief for other newbie OSX devs ?



Full Stack Dump of error :

gcc -c -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes    -I. -I./Include    -DPy_BUILD_CORE -o Python/_warnings.o Python/_warnings.c
./Parser/asdl_c.py -h ./Include ./Parser/Python.asdl
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/7.0/lib/python2.7/site.py", line 553, in <module>
    main()
  File "/Library/Frameworks/Python.framework/Versions/7.0/lib/python2.7/site.py", line 535, in main
    known_paths = addusersitepackages(known_paths)
  File "/Library/Frameworks/Python.framework/Versions/7.0/lib/python2.7/site.py", line 268, in addusersitepackages
    user_site = getusersitepackages()
  File "/Library/Frameworks/Python.framework/Versions/7.0/lib/python2.7/site.py", line 243, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/Library/Frameworks/Python.framework/Versions/7.0/lib/python2.7/site.py", line 233, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/Library/Frameworks/Python.framework/Versions/7.0/lib/python2.7/sysconfig.py", line 535, in get_config_var
    return get_config_vars().get(name)
  File "/Library/Frameworks/Python.framework/Versions/7.0/lib/python2.7/sysconfig.py", line 434, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/Library/Frameworks/Python.framework/Versions/7.0/lib/python2.7/sysconfig.py", line 313, in _init_posix
    raise IOError(msg)
IOError: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.4" but "10.5" during configure
make: *** [Include/Python-ast.h] Error 1
msg158521 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-04-17 01:26
Please understand that the bug tracker is not a place to ask questions; use python-list@python.org for that. To still answer your last question: newbie OSX developers are advised to prefer released versions of Python, as they will have build issues fixed that occur during development. In the specific case, a released version wouldn't even attempt to run asdl_c.py.

What README did you read, and what web page? What specific build steps did you then perform to produce this error? What specific revision did you try to build?

ISTM that the error doesn't originate from the Python you are trying to build, but from Apple's Python build, which apparently cannot work with MACOSX_DEPLOYMENT_TARGET being set.
msg158525 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-04-17 03:23
The problem you are seeing is due to two separate issues.  (1) The first time you build Python 3 in a particular build directory, the Abstract Syntax Definition Language (asdl) parser build step may be unnecessarily run by "make" if the time stamps of the source files are not preserved, for example, for an initial clone of a repo using hg.  The parser step requires the use of an existing Python on your system.  It appears you a Python 2.7 installed and first on the your shell $PATH.  Unfortunately, that causes you to run into the second issue, which was documented in Issue9516, a bug in the initial releases of Python 2.7.x.  The fix for that issue is now released in Python 2.7.3, so that the interpreter on OS X is no longer incorrectly checking MACOSX_DEPLOYMENT_TARGET settings.  So, among other solutions, you can either update to Python 2.7.3 or remove it from your PATH during the initial build (until the asdl target is up-to-date).
History
Date User Action Args
2022-04-11 14:57:29adminsetgithub: 58807
2012-04-17 03:25:22ned.deilysetassignee: ronaldoussoren
title: OSX Build Target -> Python build fails on OS X with "$MACOSX_DEPLOYMENT_TARGET mismatch"
stage: resolved
components: - Devguide
versions: - Python 2.7
2012-04-17 03:23:14ned.deilysetstatus: open -> closed

assignee: ronaldoussoren -> (no value)
versions: + Python 2.7
nosy: + ned.deily

messages: + msg158525
resolution: out of date
2012-04-17 01:26:17loewissetnosy: + loewis
messages: + msg158521
2012-04-16 22:39:16aftsetassignee: ronaldoussoren

type: compile error
components: + macOS
nosy: + ronaldoussoren
2012-04-16 22:36:12aftcreate