简体   繁体   English

如何使用Xcode 3.2.2为OSX构建通用二进制文件(ppc / i386)?

[英]How do I build Universal binaries (ppc/i386) using Xcode 3.2.2 for OSX?

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. 我正在尝试为工作中的项目构建通用二进制文件,但我似乎无法正确设置Xcode。

I am familiar with the Apple Documentation regarding this, but apparently I am not reading it correctly. 我熟悉Apple文档,但显然我没有正确阅读。

The Xcode build options in question seem to be: 有问题的Xcode构建选项似乎是:

  • Architectures 架构
  • Base SDK 基础SDK
  • C/C++ Compiler Version C / C ++编译器版本
  • Mac OS X Deployment Target Mac OS X部署目标

In my settings I have the following Valid Architectures: i386 ppc ppc64 ppc7400 ppc970 x86_64. 在我的设置中,我有以下有效架构:i386 ppc ppc64 ppc7400 ppc970 x86_64。

If I use the following options, I get a binary with i386 and ppc970 : 如果我使用以下选项,我会得到一个i386ppc970的二进制文件:

  • Architectures: i386 ppc 架构: i386 ppc
  • Base SDK: Mac OS X 10.5 基础SDK: Mac OS X 10.5
  • C/C++ Compiler Version: GCC 4.0 C / C ++编译器版本: GCC 4.0
  • Mac OS X Deployment Target: Mac OS X 10.5 Mac OS X部署目标: Mac OS X 10.5

I have several questions about this: 我有几个问题:

  1. Why ppc970 and not ppc7400 (or simply ppc)? 为什么ppc970而不是ppc7400(或简称ppc)?
  2. What is the difference between the ppcs (ppc, ppc64, ppc7400, ppc970)? ppcs(ppc,ppc64,ppc7400,ppc970)有什么区别?
  3. How do I get a binary for any ppc? 如何获得任何ppc的二进制文件?

Apparently, I need a binary with ppc7400 to work on the Mac Mini we have for testing. 显然,我需要一个带有ppc7400的二进制文件来处理我们测试的Mac Mini。 The Mini has a G4 and is running OSX 10.5.8. Mini有一个G4,运行OSX 10.5.8。 From what I can tell, a binary with ppc7400 works but not one with only ppc970. 据我所知,ppc7400的二进制文件可以工作但不能只用ppc970。

I have tried several combinations of the above build options, including changing my Base SDK to 10.4u. 我已经尝试了上述构建选项的几种组合,包括将我的Base SDK更改为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. 其他构建失败,通常是因为无法识别头文件或明显可用的#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. 例如,如果我将编译器更改为gcc 4.2,由于#include_next指令而没有明确的路径来纠正标头,因此我在搜索stdarg.h时遇到错误。 If I drop my Base SDK to 4.0, #define FSIZE long long is no longer recognized despite not changing any includes. 如果我将我的Base SDK丢弃到4.0,尽管没有更改任何包含,但不再识别#define FSIZE long long。

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 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. 这会生成具有arch'ppc'的目标文件(.o),如lipo所示。 All the included libs and frameworks are either 'ppc' or 'ppc7400' (again as shown by lipo). 所有包含的库和框架都是'ppc'或'ppc7400'(再次由lipo显示)。 But, the final build is 'ppc970'. 但是,最终版本是'ppc970'。

I have gone over this very carefully to ensure I got everything. 我非常仔细地检查了这一点以确保我得到了所有东西。 Can anyone think of a reason for the ppc architecture differences? 谁能想到ppc架构差异的原因?

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 World)并将其链接到第一个项目的所有库和框架。 Hello builds as 'ppc' not 'ppc970'. Hello构建为'ppc'而非'ppc970'。

This just makes no sense to me. 这对我来说毫无意义。

ppc970 == G5 . ppc970 == G5 If you need to support as far back as the G4 then just build for ppc7400 . 如果您需要支持G4那么只需为ppc7400构建。

Rather than messing with individual architecture settings, though, you can just select 32-bit Universal (or Standard (32/64-bit Universal) , if appropriate) from the popup menu, and that should give you what you need. 但是,您可以从弹出菜单中选择32-bit Universal (或Standard (32/64-bit Universal) ,而不是弄乱单个架构设置,这应该可以满足您的需求。

In target settings make below changes.. 在目标设置中进行以下更改..

GCC_MODEL_PPC64 = NO

ie, uncheck “Use 64-bit integer Math”. 即,取消选中“使用64位整数数学”。

Enabling will turn on 64 bit. 启用将打开64位。 So it will be G5 onwards.. 所以它将是G5开始..

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

相关问题 Boost XCode i386 - Boost XCode i386 Xcode构建错误-缺少必需的体系结构i386 - Xcode build error - missing required architecture i386 如何在XCode 4的i386应用程序的dylib中使用Sqlite? 这种方法确实适用于iPhone应用程序 - How do I use Sqlite in a dylib in an i386 app in XCode 4? This approach does work in iPhone app Xcode:架构i386的未定义符号 - Xcode: Undefined symbols for architecture i386 Xcode 4 iPhone Sim 需要 i386 吗? - Xcode 4 Needs i386 for iPhone Sim? 在Xcode中,是否可以重用i386配置中的中间对象,其中使用通用配置进行构建? - In Xcode, is it possible to reuse intermedian objects from i386 configuration where building with universal configuration? XCode无法与Kinvey一起编译:文件是通用文件(3片),但不包含i386片 - XCode won't compile with Kinvey : file is universal (3 slices) but does not contain a(n) i386 slice 尽管编译了通用库和i386版本的库,但未为体系结构i386找到符号 - Symbol(s) not found for architecture i386 despite compiling universal and i386 versions of library 从PPC OSX,用Xcode生成Intel二进制文件? - From PPC OSX, generate Intel binaries with Xcode? 无法在Mac OSX上针对i386目标使用我的应用程序构建Apache Thrift - Failure to build Apache Thrift with my application on Mac OSX for i386 target
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM