ios Xcode 6.1 文件中缺少所需的架构 X86_64

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26552855/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 03:19:51  来源:igfitidea点击:

Xcode 6.1 Missing required architecture X86_64 in file

iosxcode6.1

提问by yogsma

In Xcode 6.1 , I am getting error for iPhone 6, iPhone 5s(iOS 7.1) which says

在 Xcode 6.1 中,我收到 iPhone 6, iPhone 5s(iOS 7.1) 的错误消息,上面写着

    Undefined symbols for architecture x86_64:
      "_OBJC_CLASS_$_ClientAuthenticator", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
linker command failed with exit code 1

This is what I have for architecture settings perspective

这就是我对架构设置的看法

  Architectures : Standard Architectures(armv7, arm64) - $(ARCHES_STANDARD)
  Base SDK : Latest iOS(8.1) 
  Valid Architectures: arm64, armv7, armv7s

  IOS Deployment Target: iOS 6.0

Recently I updated my OS to Yosemite and Xcode from 6.0 to 6.1. I have searched on Stack Overflow for this question which refer to Xcode 5.1 and tried all the given solutions, but nothing has worked.

最近我将我的操作系统从 6.0 更新到了 Yosemite 和 Xcode 6.1。我在 Stack Overflow 上搜索了这个问题,它指的是 Xcode 5.1 并尝试了所有给定的解决方案,但没有任何效果。

Update- I tried the changes as suggested in the answer, but I still keep getting the error which says "Missing required architecture X86_64" . On further investigation I found that the file ClientAuthenticator.o which is from my library is not getting built for X86_64 architecture and probably that is the issue? I am looking how it can be built for x86_64.

更新- 我按照答案中的建议尝试了更改,但我仍然收到错误消息,显示“缺少所需的架构 X86_64”。在进一步调查中,我发现来自我的库的文件 ClientAuthenticator.o 不是为 X86_64 架构构建的,可能这就是问题所在?我正在寻找如何为 x86_64 构建它。

My new question is what is the difference between arm64 and x86_64? More of it seems like the difference between just the architecture manufacturer, but basic 64-bit architecture remains same.

我的新问题是arm64 和 x86_64 之间什么区别?更多的似乎只是架构制造商之间的差异,但基本的 64 位架构保持不变。

回答by raurora

  • The first thing you should make sure is that your static library has all architectures. When you do a lipo -info myStaticLibrary.aon terminal - you should see armv7 armv7s i386 x86_64 arm64architectures for your fat binary.

  • To accomplish that, I am assuming that you're making a universal binary - add the following to your architecture settings of static library project -

  • 您应该确保的第一件事是您的静态库具有所有架构。当您lipo -info myStaticLibrary.a在终端上执行操作时 - 您应该会看到armv7 armv7s i386 x86_64 arm64您的胖二进制文件的架构。

  • 为了实现这一点,我假设您正在制作一个通用二进制文件 - 将以下内容添加到静态库项目的架构设置中 -

enter image description here

在此处输入图片说明

  • So, you can see that I have to manually set the Standard architectures (including 64-bit) (armv7, armv7s, arm64)of the static library project.
  • 所以,你可以看到我必须手动设置Standard architectures (including 64-bit) (armv7, armv7s, arm64)静态库项目的。

enter image description here

在此处输入图片说明

  • Alternatively, since the normal $ARCHS_STANDARDnow includes 64-bit. You can also do $(ARCHS_STANDARD)and armv7s. Check lipo -infowithout it, and you'll figure out the missing architectures. Here's the screenshot for all architectures -
  • 或者,由于正常$ARCHS_STANDARD现在包括 64 位。你也可以做$(ARCHS_STANDARD)armv7s。如果lipo -info没有它,您将找出缺失的架构。这是所有架构的屏幕截图 -

enter image description here

在此处输入图片说明

  • For your reference implementation (project using static library). The default settings should work fine -

    enter image description here

  • 供您参考实现(使用静态库的项目)。默认设置应该可以正常工作 -

    在此处输入图片说明

Update 12/03/14Xcode 6 Standard architectures exclude armv7s.

更新 12/03/14 Xcode 6 标准架构不包括 armv7s。

So, armv7sis not needed? Yes. It seems that the general differences between armv7 and armv7s instruction sets are minor. So if you choose not to include armv7s, the targeted armv7 machine code still runs fine on 32 bit A6 devices, and hardly one will notice performance gap. Source

那么,armv7s是不是需要?是的。armv7 和 armv7s 指令集之间的一般差异似乎很小。所以如果你选择不包含 armv7s,目标 armv7 机器代码在 32 位 A6 设备上仍然可以正常运行,几乎没有人会注意到性能差距。来源

If there is a smarter way for Xcode 6.1+ (iOS 8.1 and above) - please share.

如果 Xcode 6.1+(iOS 8.1 及更高版本)有更智能的方法 - 请分享。

回答by David Douglas

If you are building a universal library and need to support the Simulator (x86_64) then build the framework for all platforms by setting Build Active Architecture Onlyto No. enter image description here

如果您正在构建一个通用库并且需要支持模拟器 (x86_64),那么通过设置Build Active Architecture OnlyNo. 在此处输入图片说明

回答by joelc

Many use the build scripts found either here: http://www.raywenderlich.com/41377/creating-a-static-library-in-ios-tutorialor here: https://gist.github.com/sponno/7228256for their run script in their target.

许多人使用此处找到的构建脚本:http: //www.raywenderlich.com/41377/creating-a-static-library-in-ios-tutorial或此处:https: //gist.github.com/sponno/7228256用于他们在目标中的运行脚本。

I was pulling my hair out trying to add x86_64, i386, armv7s, armv7, and arm64 to the Architectures section, only to find lipo -info targetname.anever returning these architectures after a successful build.

我一直在努力将 x86_64、i386、armv7s、armv7 和 arm64 添加到架构部分,结果发现lipo -info targetname.a在成功构建后再也没有返回这些架构。

In my case, I had to modify the target runscript, specifically step 1 from the gist link, to manually include the architectures using -arch.

就我而言,我必须修改目标运行脚本,特别是 gist 链接中的第 1 步,以使用 -arch 手动包含架构。

Step 1. Build Device and Simulator versions xcodebuild -target ${PROJECT_NAME} ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" xcodebuild -target ${PROJECT_NAME} -configuration ${CONFIGURATION} -sdk iphonesimulator -arch x86_64 -arch i386 -arch armv7 -arch armv7s -arch arm64 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"

Step 1. Build Device and Simulator versions xcodebuild -target ${PROJECT_NAME} ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" xcodebuild -target ${PROJECT_NAME} -configuration ${CONFIGURATION} -sdk iphonesimulator -arch x86_64 -arch i386 -arch armv7 -arch armv7s -arch arm64 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"

回答by boro

Here's a response to your latest question about the difference between x86_64and arm64:

这里的约之间的区别您的最新问题的回答x86_64arm64

  • x86_64architecture is required for running the 64bit simulator.

  • arm64architecture is required for running the 64bit device (iPhone 5s, iPhone 6, iPhone 6 Plus, iPad Air, iPad mini with Retina display).

  • x86_64运行 64 位模拟器需要架构。

  • arm64运行 64 位设备(iPhone 5s、iPhone 6、iPhone 6 Plus、iPad Air、带 Retina 显示屏的 iPad mini)需要架构。

回答by boro

I run into exactly the same problem and was following this tutorial https://github.com/jverkoey/iOS-Framework#faq

我遇到了完全相同的问题,并按照本教程 https://github.com/jverkoey/iOS-Framework#faq

The way that I made this work is after putting into the scripts into your Aggregate's Build Phase, before you compile, make sure you compile it using an iphone simulator (I used iPhone6) instead of IOS Device.

我完成这项工作的方式是在将脚本放入聚合的构建阶段之后,在编译之前,确保使用 iphone 模拟器(我使用 iPhone6)而不是 IOS 设备进行编译。

which will give me 2 slices: armv7 and x86_64, then drag and drop it into new project is working fine for me.

这会给我 2 个切片:armv7 和 x86_64,然后将其拖放到新项目中对我来说工作正常。

回答by JD - DC TECH

My solution was connect my iPhone 6, build on it and I got the project running successfully.

我的解决方案是连接我的 iPhone 6,在它上面进行构建,我让项目成功运行。

Because I was building for iPhone 6 Simulator.

因为我是为 iPhone 6 Simulator 构建的。

回答by allen huang

I use lipocommand to combine two built static libraries manually.

我使用lipo命令手动组合两个构建的静态库。

EX: I have a static library(libXYZ.a) to build.

例如:我有一个静态库(libXYZ.a)要构建。

I run build for Generic iOS Deviceand got Product in Debug-iphoneos/

我运行构建Generic iOS Device并获得了产品Debug-iphoneos/

$ lipo -info Debug-iphoneos/libXYZ.a
Architectures in the fat file: Debug-iphoneos/libXYZ.a are: armv7 arm64

Then I run build for any iOS Simulatorand got Product in Debug-iphonesimulator/

然后我运行 build for anyiOS Simulator并获得 ProductDebug-iphonesimulator/

$ lipo -info Debug-iphonesimulator/libXYZ.a
Architectures in the fat file: Debug-iphonesimulator/libXYZ.a are: i386 x86_64

Finally I combine into one to contain all architectures.

最后我组合成一个包含所有架构。

$ lipo -create Debug-iphoneos/libXYZ.a Debug-iphonesimulator/libXYZ.a -output libXYZ.a
$ lipo -info libXYZ.a
Architectures in the fat file: libXYZ.a are: armv7 i386 x86_64 arm64

回答by Satyasree Muralidharan

Setting the build active architectures only to No fixed this problem for me. enter image description here

仅将构建活动架构设置为 No 为我解决了这个问题。 在此处输入图片说明

回答by Seraj Ahmad

If you are having this problem in react-native projects with one of the external library. You should remove the project and use react-native link <package-name>again. That should solve the problem.

如果您在使用外部库之一的本机项目中遇到此问题。您应该删除该项目并react-native link <package-name>再次使用。那应该可以解决问题。

回答by shubham mishra

Following changes you have to make that's it(change architecture into armv7 and remove others) :-

您必须进行以下更改(将架构更改为 armv7 并删除其他架构):-

Change you have to make

你必须做出改变