开发者

How to actually build 64-bit Python on OS X 10.6.2

Why? I want to do this because installation of SciPy recommends it, and I thought it would be a good learning experience. This question has been asked before (e.g. here). The preferred answer seems to be to use MacPorts, but as I say, I'd like to understand how it's done.

Anyway, I grab the source (Python-2.6.4.tgz) and unzip. I read the instructions on how to build a 64-bit "framework" build. As I understand it, I should run

./configure --enable-framework --enable-universalsdk=/ --with-univeral-archs=intel

configure runs for a while...and finishes. When I do make, it's obviously got a problem:

$ make
gcc -c -arch ppc -arch i386 -isysroot /  -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include   -DPy_BUILD_CORE -o Modules/python.o ./Modules/python.c
In file included from //usr/include/architecture/i386/math.h:626,
                 from //usr/include/math.h:28,
                 from Include/pyport.h:235,
                 from Include/Python.h:58,
                 from ./Modules/python.c:3:
//usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.

gcc is being called with the wrong arguments. Do I have the wrong arg开发者_运维技巧uments to configure, or should I set compiler flags in the environment, or what?

Edit: I don't see any errors in the output from configure...and I see this line:

checking for OSX 10.5 SDK or later... yes

it ends with

creating Modules/Setup
creating Modules/Setup.local
creating Makefile

Edit2: I thought I copied from the readme...

I did! There's a typo in the readme spec! My age-related dyslexia is acting up again. ;)


Your ./configure option is not correct. --enable-universalsdk should be set to the correct SDK, not /! That's why gcc got confused, see the option -isysroot. So, check what SDKs you have in /Developer/SDKs, and set the correct one.

Moreover, your gcc is called only with -arch ppc -arch i386, which do not include -arch x86_64 which is the intel 64 bit flag.


In order to choose an answer as correct, I'm paraphrasing comments above:

As noticed by Virgil Dupras, there was a typo in this flag:

--with-universal-archs=intel

It originates from the file Mac/readme, but I should've caught it before posting. Also I recommend that you read Ned Deily's very helpful comments. Check out those guys and vote 'em up.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜