开发者

Error compiling coverage.py on MacOSX

I tried to install coverage 3.4 on my MacBook running on current Mac OS X 10.6.7. This is what I got as an error:

$ easy_install coverage
install_dir /Users/jammon/workspace/myproject/lib/python2.7/site-packages/
Searching for coverage
Reading http://pypi.python.org/simple/coverage/
Reading http://nedbatchelder.com/code/modules/coverage.html
Reading http://nedbatchelder.com/code/coverage
Reading http://nedbatchelder.com/code/coverage/3.4b1
Reading http://nedbatchelder.com/code/coverage/3.4b2
Best match: coverage 3.4
Downloading http://pypi.python.org/packages/source/c/coverage/coverage-3.4.tar.gz#md5=46782809578c8fd29912c124d2420842
Processing coverage-3.4.tar.gz
Running coverage-3.4/setup.py -q bdist_egg --dist-dir /var/folders/10/10P5vwX-Ghmkg8s25PMr3E+++TI/-Tmp-/easy_install-UcskZB/coverage-3.4/egg-dist-tmp-QCs3YS
no previously-included directories found matching 'test'
In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:4,
                 from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:85,
                 from coverage/tracer.c:3:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:4,
                 from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:85,
                 from coverage/tracer.c:3:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/10/10P5vwX-Ghmkg8s25PMr3E+++TI/-Tmp-//ccAYGjpc.out
error: Setup script exited with error: command 'gcc-4.0' failed with exit status 1

Can anybody make sense from that? I simply don't understand what is wrong. Or how I can fix it.

Any help greatly appreciated.

Update:

After Ned's comment I tried it with easy_install -vv coverage; the result is not much different:

...
creating build/temp.macosx-10.3-fat-2.7/coverage
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c coverage/tracer.c -o build/temp.macosx-10.3-fat-2.7/coverage/tracer.o
In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:4,
                 from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:85,
                 from coverage/tracer.c:3:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Library/Frameworks/Python.fram开发者_StackOverflow中文版ework/Versions/2.7/include/python2.7/unicodeobject.h:4,
                 from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:85,
                 from coverage/tracer.c:3:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/10/10P5vwX-Ghmkg8s25PMr3E+++TI/-Tmp-//ccZQsHOd.out
error: Setup script exited with error: command 'gcc-4.0' failed with exit status 1

As far as I remember, I compiled python from the sources the standard way, it was not a binary distribution. I tried it with and without virtualenv.


The most recent version of XCode removes support for compiling to the old PowerPC (PPC) architecture. Unfortunately, Python on Mac typically still tries to build C extensions for PPC as well as x86. To get around this, prefix commands like 'setup.py install' or 'easy_install' with an ARCHFLAGS setting that only includes the architectures you want to build for:

ARCHFLAGS="-arch i386 -arch x86_64" easy_install coverage


Alternatively, you can use ActivePython to obviate the need to compile things yourself:

$ pypm install coverage
The following packages will be installed into "~/Library/Python/2.7" (2.7):
 coverage-3.4
Get: [pypm-free.activestate.com] coverage 3.4
Installing coverage-3.4                                  
Fixing script ~/Library/Python/2.7/bin/coverage
$


After a lot of googling I found a solution in this blogpost and the comments, that worked for me: I removed /Developer/SDKs/MacOSX10.4u.sdk, then installing coverage (and reportlab, which showed the same problem) worked just as expected.

As far as I understood, the handling of stdarg.h has changed in some version of gcc, resulting in the described problem.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜