简体   繁体   English

在MacOSX上编译coverage.py时出错

[英]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. 我试图在当前Mac OS X 10.6.7上运行的MacBook上安装Coverage 3.4 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 ; 在Ned发表评论后,我尝试使用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.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-//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. 据我所记得,我以标准方式从源代码编译了python,它不是二进制发行版。 I tried it with and without virtualenv . 我在有和没有virtualenv情况下都尝试过。

The most recent version of XCode removes support for compiling to the old PowerPC (PPC) architecture. XCode的最新版本删除了对旧PowerPC(PPC)体系结构的编译支持。 Unfortunately, Python on Mac typically still tries to build C extensions for PPC as well as x86. 不幸的是,Mac上的Python通常仍会尝试为PPC和x86构建C扩展。 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设置的“ setup.py install”或“ easy_install”等前缀命令中仅包含您要为其构建的体系结构:

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

Alternatively, you can use ActivePython to obviate the need to compile things yourself : 另外,您可以使用ActivePython来消除自己进行编译的需要:

$ 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. 经过大量的搜寻之后,我在此博客文章和评论中找到了一个对我有用的解决方案:我删除了/Developer/SDKs/MacOSX10.4u.sdk,然后安装coverage(和reportlab,这也显示了同样的问题)预期。

As far as I understood, the handling of stdarg.h has changed in some version of gcc, resulting in the described problem. 据我了解,在某些版本的gcc中,stdarg.h的处理已更改,从而导致了上述问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM