简体   繁体   English

无法将iOS / iPhone应用程序构建为i386以外的任何其他应用程序

[英]Can't build iOS/iPhone app as anything other than i386

I am completely new to the iOS/iPhone/XCode world, so if you guess is between something rather complex and something so simple that everyone should know, I'd go with the simple answer. 我是iOS / iPhone / XCode世界的新手,所以如果你猜的是介于相当复杂的东西之间,而且每个人都应该知道这么简单,我会选择简单的答案。 :-) :-)

Okay, so I have inherited an iPhone project that we had outsourced to another company. 好的,所以我继承了一个我们外包给另一家公司的iPhone项目。 My only objective right now is to be able to build the dang thing. 我现在唯一的目标是能够建立当时的事情。 I set up XCode 4.2 and installed the proper SDKs. 我设置了XCode 4.2并安装了适当的SDK。 I loaded up the project and everything seems good to this point. 我加载了这个项目,到目前为止一切似乎都很好。 However, when I build, I get errors from what I believe to be the linking stage of the build. 但是,当我构建时,我会从我认为构建的链接阶段中得到错误。 I'm not entirely sure because the statuses change quickly when building. 我不完全确定,因为建筑时状态会迅速改变。 The error I get is the following: 我得到的错误如下:

来自XCode构建的错误

From what I have been able to find online, it seems that one of the libraries I am using was not compiled for the i386 platform. 从我在网上找到的,似乎我使用的其中一个库没有为i386平台编译。 To start, this doesn't make sense to me because the libraries that I am using (where these errors are coming from) are currently included as sub-projects and produce .a files which I thought were arch-independent (am I wrong here??). 首先,这对我来说没有意义,因为我正在使用的库(这些错误来自哪里)目前作为子项目包含并生成.a文件,我认为这些文件是独立于拱形的(我在这里错了) ??)。 Also, I can't find anywhere in the project where I've instructed XCode to build to an i386 architecture. 此外,我在项目中找不到任何指示XCode构建i386架构的项目。 This is what I've done so far: 这是我到目前为止所做的:

  • Made sure that the file in which these errors arose was included into the "Compile Sources" section of the Build Phase tab (the .m file) 确保出现这些错误的文件包含在Build Phase选项卡的“Compile Sources”部分(.m文件)中
  • Set my architectures to armv6 and armv7 and set the Build Active Architecture Only to no . 将我的架构设置为armv6armv7 ,并将Build Active Architecture Only设置no (See images below) (见下图)

Main Project Config 主项目配置 主项目构建配置

Sub-Project Config 子项目配置 子项目配置



Event when I build using the release configuration, I still get this error and I'm not sure why. 当我使用发布配置构建时,我仍然遇到此错误,我不知道为什么。 Everything that I am looking at in my build config seems to indicate that I should be building everything in an arm architecture. 我在构建配置中看到的所有内容似乎都表明我应该在arm架构中构建所有内容。

You are getting errors because you messed with the architecture settings. 您遇到错误,因为您搞乱了架构设置。 You should not fix those towards ARM code but allow i386 as well. 您不应该将这些修复为ARM代码,但也允许使用i386。

Right now, one of more of your (sub)-projects build ARM code only, resulting into a linker error once you try to build a simulator version. 现在,您的一个(子)项目只构建ARM代码,一旦您尝试构建模拟器版本,就会导致链接器错误。 That is happening because your Architecture settings are not as they should be. 这种情况正在发生,因为您的架构设置并非如此。

Note your setting for Any iOS SDK , that one is incorrect as it builds only ARM code. 请注意您的Any iOS SDK设置,因为它只构建ARM代码,因此不正确。 Remove those settings entirely by using the backspace key on your keyboard after selecting that specific setting (single-click). 选择特定设置(单击)后,使用键盘上的退格键完全删除这些设置。

And this is how it should be: 这应该是这样的: 在此输入图像描述

$(ARCHS_STANDARD_32_BIT) resolves to ARMV7 when building device specific code and i386 when building simulator specific code. $(ARCHS_STANDARD_32_BIT)在构建特定于设备的代码时解析为ARMV7 ,在构建模拟器特定代码时解析为i386 Including ARMV6 code as per my screenshot is only needed if you plan to serve the results to older iOS devices (iPhone 3G and below). 只有当您计划将结果提供给较旧的iOS设备(iPhone 3G及更低版本)时,才需要根据我的屏幕截图包含ARMV6代码。

Once those settings are active in all (sub)-projects , everything should work smoothly. 一旦这些设置在所有(子)项目中处于活动状态 ,一切都应该顺利进行。

For creating a universal library out of a project, useful if you plan to distribute a static library to other developers, use LIPO . LIPO项目中创建通用库,如果您计划将静态库分发给其他开发人员,请使用LIPO

Example: 例:

lipo input_library_1.a input_library_2.a -create -ouput output_library.a

Lets say input_library_1 was i386 specific (simulator) and input_library_2 was ARM specific (device), this will join them into a universal version usable for both simulator and device. 让我们说input_library_1是i386特定的(模拟器)和input_library_2是ARM特定的(设备),这将它们连接成可用于模拟器和设备的通用版本。

It seems like you have been trying to link to static library built for devices(armv6 or armv7). 您似乎一直在尝试链接到为设备构建的静态库(armv6或armv7)。 When your building for the simulator the architecture will be i386. 当您为模拟器构建时,架构将是i386。 So you getting all these nasty linking errors. 所以你得到了所有这些讨厌的链接错误。 Solution is to include the library compiled for simulator as well in your project. 解决方案是在项目中包含为模拟器编译的库。

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

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