在mac os x 10.8上安装gcc4.0

时间:2013-06-01 09:17:48

标签: python macos gcc

我正在尝试阅读和学习pytho2.5.6源代码,并尝试在每次对其进行一些更改时重新编译代码。

但是当我通过以下命令编写源代码时,它似乎不起作用:

./configure --prefix=/path/to/somewhere/that/don't/messup/myenv/
make

make之后,控制台只显示如下错误:

cc1: error: unrecognized command line option "-Wno-long-double" 

我搜索谷歌,似乎我使用的gcc(4.2.1)与python2.5.6无法兼容。

我的系统的一些信息:

gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Xcode 4.6.2(installed via the xcode command cline tool )
python2.5.6 source code(download from python.org)

我尝试过这样的解决方案:

1.download diff python代码版本,如2.5.4,并再次执行这些步骤。

2.在configure之后,修改Makefile,然后删除--Wno-long-double,但新错误如下所示:

        ➜  Python-2.5.6  make
        gcc -c -fno-strict-aliasing -no-cpp-precomp -mno-fused-madd -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include   -DPy_BUILD_CORE -o Python/mactoolboxglue.o Python/mactoolboxglue.c
        In file included from Include/Python.h:57,
                         from Python/mactoolboxglue.c:26:
        Include/pyport.h:547: warning: ‘struct winsize’ declared inside parameter list
        Include/pyport.h:547: warning: its scope is only this definition or declaration, which is probably not what you want
        Include/pyport.h:548: warning: ‘struct winsize’ declared inside parameter list
        In file included from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:67,
                         from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:38,
                         from /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/CarbonCore.h:18,
                         from /System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AE.h:20,
                         from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:18,
                         from /System/Library/Frameworks/Carbon.framework/Headers/Carbon.h:20,
                         from Include/pymactoolbox.h:10,
                         from Python/mactoolboxglue.c:27:
        /usr/include/AvailabilityMacros.h:109:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
        In file included from Python/mactoolboxglue.c:27:
       .......
       Python/mactoolboxglue.c: In function ‘MediaObj_Convert’:
       Python/mactoolboxglue.c:431: error: ‘cobj’ undeclared (first use in this function)
       Python/mactoolboxglue.c:431: error: too many arguments to function ‘PyMacGluePtr_MediaObj_Convert’
       make: *** [Python/mactoolboxglue.o] Error 1

所以,我想知道是否有办法手动安装gcc4.0?

PS:我之所以使用python2.5.6,是因为我读了一本名为中文的书。也许最好的解决办法是阅读2.7源代码=。= .... hmmm ....

0 个答案:

没有答案