简体   繁体   English

iOS 通用框架不构建 i386?

[英]iOS Universal Framework not build i386?

I'm using the fantastic iOS Universal Framework script to build my own framework and its worked great for some time.我正在使用出色的iOS 通用框架脚本来构建我自己的框架,并且它在一段时间内运行良好。 I'm not sure exactly when, but it seems to have stopped building i386 along the way.我不确定确切的时间,但它似乎在此过程中停止了构建 i386。 Apps consuming the framework produced no longer work with the simulator.使用生成的框架的应用程序不再与模拟器一起使用。

I've got VALID_ARCHS = arm64 armv7 armv7s i386 x86_64 set.我有VALID_ARCHS = arm64 armv7 armv7s i386 x86_64集。 And ONLY_ACTIVE_ARCH = NO .并且ONLY_ACTIVE_ARCH = NO The build script isn't throwing any errors or logs.构建脚本不会抛出任何错误或日志。 Yet I get a skinny framework in the end without i386 or x86_64 and thus any project dependent on this framework has linker errors when building for the simulator.然而,我最终得到了一个没有 i386 或 x86_64 的瘦框架,因此任何依赖于该框架的项目在为模拟器构建时都会出现链接器错误。

Extra info:额外信息:

  • Using the Mk8 script latest build from main repo.使用来自主存储库的 Mk8 脚本最新版本。
  • Archiving, not building as some errors suggest.归档,而不是像某些错误所暗示的那样构建。

Any ideas?有任何想法吗?

I was having this same problem recently.我最近遇到了同样的问题。 I had to tweak several build settings to get it to build for i386 and x86_64 again.我不得不调整几个构建设置才能让它再次为 i386 和 x86_64 构建。 The one that got it working for me was when I unchecked the "Run script only when installing" checkbox in the Run Script Build Phase.让它为我工作的那个是当我取消选中运行脚本构建阶段中的“仅在安装时运行脚本”复选框时。

This may be one of my more vague answers, and I may not be able to specifically answer your question because you're talking about iOS Universal Framework but maybe I can shed some light on my experience.这可能是我比较模糊的答案之一,我可能无法具体回答您的问题,因为您在谈论 iOS 通用框架,但也许我可以阐明我的经验。

I've found that building for both i386 and x86_64 architectures at the same time (with one xcodebuild call) even with the correct valid-archs and only-active-arch just doesn't work.我发现同时为i386x86_64架构构建(使用一个 xcodebuild 调用),即使使用正确的valid-archsonly-active-arch也行不通。

I solved the particular issue of creating a universal static library with all 5 archs in the Kiwi project by explicitly building for x86_64 and combining the output with the previous step with lipo.我通过为 x86_64 显式构建并将输出与上一步与 lipo 相结合,解决了在Kiwi项目中创建具有所有 5 个拱门的通用静态库的特定问题。

Comments from my pull request are below:我的拉取请求的评论如下:

Building explicitly for the x86_64 simulator required a bit of trial and error, xcodebuild seems unable to build i386 and x86_64 at the same time, so I added [additional] steps specifically for x86_64.为 x86_64 模拟器显式构建需要一些反复试验,xcodebuild 似乎无法同时构建 i386 和 x86_64,因此我添加了专门针对 x86_64 的 [附加] 步骤。

Restricting the VALID_ARCHS, ARCHS and IPHONEOS_DEPLOYMENT_TARGET for the 64bit simulator build seemed to do the trick.为 64 位模拟器构建限制 VALID_ARCHS、ARCHS 和 IPHONEOS_DEPLOYMENT_TARGET 似乎可以解决问题。

ARCHS='x86_64' VALID_ARCHS='x86_64' IPHONEOS_DEPLOYMENT_TARGET='7.0' ARCHS='x86_64' VALID_ARCHS='x86_64' IPHONEOS_DEPLOYMENT_TARGET='7.0'

Under the hood a universal framework is just creating a static library with symbolic links and a specific structure (to look like a .framework).在引擎盖下,通用框架只是创建一个带有符号链接和特定结构(看起来像 .framework)的静态库。 I'd imagine iOS Universal Framework has the same issues I had the Kiwi library.我想 iOS Universal Framework 有与 Kiwi 库相同的问题。 I'm sure more people have this issue...相信更多人有这个问题...

You need to build the script for all archs arm64 armv7 armv7s i386 x86_64 and then build a new file using lipo command.您需要为所有 archs arm64 armv7 armv7s i386 x86_64 构建脚本,然后使用 lipo 命令构建一个新文件。

To build arm64 armv7 armv7s use the iphone platform /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer and for i386 x86_64 use the simulator /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer.要构建 arm64 armv7 armv7s 使用 iphone 平台 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer 和 i386 x86_64 使用模拟器 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform /开发人员。

I use this to generate one c++ lib.我用它来生成一个 C++ 库。

Ex:前任:

    $(CC) $(CFLAGS) -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer $(CPP_SRC_DIR)/*.cpp

    $(XCODE_AR) rvs $(IOS_TARGET_A_DIR)/$(LIB_NAME).x86_64.a $(IOS_TARGET_O_DIR)/x86_64/*.o
    #Build fat library
    $(XCODE_LIPO) -create $(IOS_TARGET_A_DIR)/*.a -output $(IOS_TARGET_FAT_DIR)/lib.a

I hope this helps.我希望这有帮助。

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

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