distutils& OS X通用二进制文件 [英] distutils & OS X universal binaries

查看:65
本文介绍了distutils& OS X通用二进制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ppc上运行

intel编译扩展时,用户会报告我们的某个扩展程序出现问题,反之亦然。他正在构建

扩展名作为通用二进制文件。虽然英特尔编译的版本

运行正常但它在ppc上运行时会显示一个已知错误。


看来我们有一个字节编译的字节序依赖< b / b
进入二进制文件。


一个建议的修复方法是在运行时使endian变量代码动态更改

。但是,我认为在引擎盖下扩展是以多种方式构建的,因此我们在

预处理器宏中对字节序的静态定义需要是动态的。 br />

有没有办法让distutils将不同的宏/定义传递给

单独的编译。


失败有没有人知道这个问题究竟是怎么回事?
应该处理?即如果有多个编译,

区分它们。我的理解是这些通用二进制文件中最多可以将4个不同的二进制文件

压在一起。

-

Robin Becker

A user reports problems with one of our extensions when running the
intel compiled extension on ppc and vice versa. He is building the
extension as a universal binary. Although the intel compiled version
runs fine it displays a known bug when run on a ppc.

It appears we have an endianness dependency which is statically compiled
into the binaries.

One proposed fix is to make the endian variable code dynamically change
at run time. However, I assume that under the hood the extension is
being built in multiple ways so our static definition of endianness in a
pre-processor macro needs to be dynamic.

Is there a way to get distutils to pass different macros/definitions to
the separate compilations.

Failing that does anyone know off hand exactly how this problem is
supposed to be handled? Ie if there are multiple compiles what
distinguishes them. My understanding is that up to 4 different binaries
are being squashed together in these universal binaries.
--
Robin Becker

推荐答案

一个建议的修复方法是使endian变量代码在运行时动态更改
One proposed fix is to make the endian variable code dynamically change


at run time.



我会建议不要这样做。应通过适当的条件编译在编译时解决字节顺序。 Endianness不会在运行时更改
更改(不,甚至不是胖二进制文件 - x86代码

将始终看到相同的字节顺序, ppc代码也是如此。

I would advise against that. Endianness depdency should be resolved at
compile time, with appropriate conditional compilation. Endianness won''t
change at run-time (and no, not even for a fat binary - the x86 code
will always "see" the same endianness, and so will the ppc code).


有没有办法让distutils将不同的宏/定义传递给

单独的编译。
Is there a way to get distutils to pass different macros/definitions to
the separate compilations.



对于特定的通用目标文件,distutils只调用编译器一次,而不是多次调用
次。 gcc驱动程序然后重复调用

不同的cc1后端。

No. distutils only invokes the compiler a single time, not multiple
times, for a specific universal object file. The gcc driver then invokes
different cc1 backends repeatedly.


如果没有,那么任何人都知道这个问题到底是怎么回事
应该处理
?即如果有多个编译,

区分它们。我的理解是,在这些通用二进制文件中,最多可以将4个不同的二进制文件压缩在一起。
Failing that does anyone know off hand exactly how this problem is
supposed to be handled? Ie if there are multiple compiles what
distinguishes them. My understanding is that up to 4 different binaries
are being squashed together in these universal binaries.



在特定情况下,只需使用

pyconfig.h中定义的WORDS_BIGENDIAN宏;它将被定义,如果目标是bigendian,并且

未定义。在通用构建的情况下,它将在x86编译器调用中未定义,并在ppc

调用中定义。


如果您对如何安排它感到好奇,请阅读来源。


问候,

马丁

In the specific case, just use the WORDS_BIGENDIAN macro defined in
pyconfig.h; it will be defined if the target is bigendian, and
undefined otherwise. In the case of a universal build, it will be
undefined in the x86 compiler invocation, and defined in the ppc
invocation.

If you are curious as to how it arranges that, read the source.

Regards,
Martin

< br>

Robin Becker写道:
Robin Becker wrote:

当运行

intel编译的扩展时,用户报告我们的某个扩展有问题ppc,反之亦然。他正在构建

扩展名作为通用二进制文件。虽然英特尔编译的版本

运行正常但它在ppc上运行时会显示一个已知错误。
A user reports problems with one of our extensions when running the
intel compiled extension on ppc and vice versa. He is building the
extension as a universal binary. Although the intel compiled version
runs fine it displays a known bug when run on a ppc.



您是否在 http://bugs.python.org/? 最小的

示例可以帮助我们解决问题。


Christian

Have you reported the problem at http://bugs.python.org/? A minimal
example could help us to fix the problem.

Christian


>用户在运行
>A user reports problems with one of our extensions when running the

>英特尔编译的ppc扩展,反之亦然。他正在将
扩展构建为通用二进制文件。虽然英特尔编译版本运行良好,但它在ppc上运行时会显示一个已知错误。
>intel compiled extension on ppc and vice versa. He is building the
extension as a universal binary. Although the intel compiled version
runs fine it displays a known bug when run on a ppc.



您是否在 http://bugs.python.org/? 最小的

示例可以帮助我们解决问题。


Have you reported the problem at http://bugs.python.org/? A minimal
example could help us to fix the problem.



起初,我还认为Robin建议使用Python存在问题

。重新阅读后,我现在相信他更愿意在报告代码中看到错误

,并且要求在那里解决它。


问候,

马丁

At first, I also thought that Robin suggested that there is a problem
with Python. Upon re-reading, I now believe he rather sees the bug
in the reportlabs code, and is asking for an approach to solve it there.

Regards,
Martin


这篇关于distutils&amp; OS X通用二进制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆