我试图将一个Python脚本添加到我的项目中,以直接从Git获取构建和营销号。
我创建了一个新的目标阶段,并按照以下方式运行了一个脚本:
http://yeahrightkeller.com/2008/10/19/xcode-run-script-build-phase-tip/
我编写了一个Python脚本,使用Info.plist解析程序。
from Foundation import NSMutableDictionary
然而,当脚本被编译时,它会失败并向构建结果报告以下错误:
Running a custom build phase script: gitversion.py
Traceback (most recent call last):
File "/Users/jorge/Documents/Programming iPod/Pruebas/RowOrder/Scripts/gitversion.py", line 9, in <module>
from Foundation import NSMutableDictionary
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/Foundation/__init__.py", line 8, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC/objc/__init__.py", line 26, in <module>
from _bridgesupport import *
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC/objc/_bridgesupport.py", line 9, in <module>
import pkg_resources
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 651, in <module>
class Environment(object):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 654, in Environment
def __init__(self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 55, in get_supported_platform
plat = get_build_platform(); m = macosVersionString.match(plat)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 181, in get_build_platform
plat = get_platform()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/util.py", line 97, in get_platform
cfgvars = get_config_vars()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/sysconfig.py", line 525, in get_config_vars
func()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/sysconfig.py", line 408, in _init_posix
raise DistutilsPlatformError(my_msg)
distutils.errors.DistutilsPlatformError: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.5" but "10.6" during configure
Finished running custom build phase script: gitversion.py (exit status = 1)
显然,distutils已经硬编码为编译版本10.6(也就是我正在使用的Snow Leopard),但该项目的MacOSX部署目标设置为10.5。
如果我尝试将此变量设置为项目中的10.6,则会出现以下错误:
ld: library not found for -lcrt1.10.6.o
有什么解决这个问题的想法吗?提前感谢。