如何阻止 setup.py 尝试在 MacOSX 版本上包含 -arch ppc?

发布于 2024-11-05 11:52:00 字数 716 浏览 8 评论 0原文

Xcode4 似乎不再包含 PPC 作为构建选项。当对包含 C 扩展的模块使用 setup.py 时,setup.py 始终尝试使用以下选项进行构建:

gcc-4.2 ... -DMACOSX -arch i386 -arch ppc ...

这会失败错误消息

/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386

如果我只是从失败的命令中删除 -arch ppc,它会正常完成,我可以重新运行 setup.py build 继续下一步。

对于只包含一个 C 扩展的模块(例如 ssl)来说,这还可以,但对于像 PIL 这样构建大量扩展的模块来说,这是一个很大的痛苦。

有没有办法阻止 setup.py 在编译参数中包含 -arch ppc ?

It appears that Xcode4 doesn't include PPC as a build option anymore. When using setup.py for modules that include C extensions, setup.py always attempts the build with these options:

gcc-4.2 ... -DMACOSX -arch i386 -arch ppc ...

This fails with the error message

/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386

If I just remove -arch ppc from the failed command it completes fine and I can rerun setup.py build to move on to the next step.

This is okay for modules that only include one C extension, like ssl, but for something like PIL that builds a ton of extensions it is a major pain.

Is there some way to prevent setup.py from including -arch ppc in the compilation parameters?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冷弦 2024-11-12 11:52:00

或者,修复有关 ppc 汇编器的 Xcode 4 安装。

$ sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gcc/darwin/ppc /Developer/usr/libexec/gcc/darwin
$ sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gcc/darwin/ppc /usr/libexec/gcc/darwin

Or, fix Xcode 4 installation about ppc assembler.

$ sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gcc/darwin/ppc /Developer/usr/libexec/gcc/darwin
$ sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gcc/darwin/ppc /usr/libexec/gcc/darwin
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文