如何使用 Xcode 3.2.2 for OSX 构建通用二进制文件 (ppc/i386)?
我正在尝试为工作中的项目构建通用二进制文件,但我似乎无法正确设置 Xcode 来执行此操作。
我熟悉有关这方面的苹果文档,但显然我没有正确阅读它。
有问题的 Xcode 构建选项似乎是:
- Architectures
- Base SDK
- C/C++ Compiler Version
- Mac OS X Deployment Target
在我的设置中,我有以下有效架构:i386 ppc ppc64 ppc7400 ppc970 x86_64。
如果我使用以下选项,我将获得带有 i386 和 ppc970 的二进制文件:
- 架构:i386 ppc
- 基础 SDK:Mac OS X 10.5
- C/C++ 编译器版本:GCC 4.0
- Mac OS X 部署目标:Mac OS X 10.5
我对此有几个问题:
- 为什么是 ppc970 而不是 ppc7400 (或者只是 ppc)?
- ppc(ppc、ppc64、ppc7400、ppc970)之间有什么区别?
- 如何获取任何 ppc 的二进制文件?
显然,我需要一个带有 ppc7400 的二进制文件才能在我们用于测试的 Mac Mini 上工作。 Mini 配备 G4,运行 OSX 10.5.8。据我所知,使用 ppc7400 的二进制文件可以工作,但仅使用 ppc970 的二进制文件则不行。
我尝试了上述构建选项的几种组合,包括将我的 Base SDK 更改为 10.4u。上述配置是唯一可以构建的配置。其他构建失败,通常是因为无法识别头文件或明显可用的#defines。例如,如果我将编译器更改为 gcc 4.2,则由于 #include_next 指令且没有指向正确标头的明确路径,搜索 stdarg.h 时会出现错误。如果我将 Base SDK 降至 4.0,则尽管未更改任何包含内容,但不再识别 #define FSIZE long long。
我非常感谢您能就此提供任何见解。
编辑更新
感谢您提供的信息。我现在明白了这些标志。但我得到了一个奇怪的结果。
这些是我现在的构建标志:
GCC_VERSION = 4.0 MACOSX_部署_目标 = 10.4 SDK根目录=macosx10.5 GCC_MODEL_TUNING = G3
这会生成具有 arch 'ppc' 的目标文件 (.o),如 lipo 所示。所有包含的库和框架都是“ppc”或“ppc7400”(再次如 lipo 所示)。但是,最终版本是“ppc970”。
我已经非常仔细地检查了这一点,以确保我得到了一切。谁能想到 ppc 架构差异的原因吗?
我什至创建了一个新项目(Hello World)并将其链接到第一个项目的所有库和框架。 Hello 构建为“ppc”而不是“ppc970”。
这对我来说毫无意义。
I am trying to build a universal binary for a project at work, but I can't seem to get Xcode set up properly to do so.
I am familiar with the Apple Documentation regarding this, but apparently I am not reading it correctly.
The Xcode build options in question seem to be:
- Architectures
- Base SDK
- C/C++ Compiler Version
- Mac OS X Deployment Target
In my settings I have the following Valid Architectures: i386 ppc ppc64 ppc7400 ppc970 x86_64.
If I use the following options, I get a binary with i386 and ppc970:
- Architectures: i386 ppc
- Base SDK: Mac OS X 10.5
- C/C++ Compiler Version: GCC 4.0
- Mac OS X Deployment Target: Mac OS X 10.5
I have several questions about this:
- Why ppc970 and not ppc7400 (or simply ppc)?
- What is the difference between the ppcs (ppc, ppc64, ppc7400, ppc970)?
- How do I get a binary for any ppc?
Apparently, I need a binary with ppc7400 to work on the Mac Mini we have for testing. The Mini has a G4 and is running OSX 10.5.8. From what I can tell, a binary with ppc7400 works but not one with only ppc970.
I have tried several combinations of the above build options, including changing my Base SDK to 10.4u. The above configuration is the only one that even builds. Other builds fail, often because of not recognizing header files or clearly available #defines. For example, if I change my compiler to gcc 4.2, I get errors searching for stdarg.h because of the #include_next directive and no clear path to correct headers. If I drop my Base SDK to 4.0, #define FSIZE long long is no longer recognized despite not changing any includes.
I'd really appreciate any insight you can give me on this.
EDIT UPDATE
Thanks for the info. I understand the flags now. But I get a strange result.
These are my build flags now:
GCC_VERSION = 4.0
MACOSX_DEPLOYMENT_TARGET = 10.4
SDKROOT = macosx10.5
GCC_MODEL_TUNING = G3
This produces object file (.o) that have arch 'ppc' as shown by lipo. All the included libs and frameworks are either 'ppc' or 'ppc7400' (again as shown by lipo). But, the final build is 'ppc970'.
I have gone over this very carefully to ensure I got everything. Can anyone think of a reason for the ppc architecture differences?
I've even gone so far as to create a new project (Hello World) and link it to all the libs and frameworks of the first project. Hello builds as 'ppc' not 'ppc970'.
This just makes no sense to me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ppc970
==G5
。如果您需要支持早至G4
,那么只需针对ppc7400
进行构建即可。不过,您只需从弹出窗口中选择
32位通用
(或标准(32/64位通用)
,如果适用)即可,而不是搞乱各个体系结构设置菜单,这应该可以满足您的需要。ppc970
==G5
. If you need to support as far back as theG4
then just build forppc7400
.Rather than messing with individual architecture settings, though, you can just select
32-bit Universal
(orStandard (32/64-bit Universal)
, if appropriate) from the popup menu, and that should give you what you need.在目标设置中进行以下更改。
即,取消选中“使用 64 位整数数学”。
启用将开启 64 位。所以从G5开始..
In target settings make below changes..
i.e., uncheck “Use 64-bit integer Math”.
Enabling will turn on 64 bit. So it will be G5 onwards..