[英]Xcode app archive validation fails for Mac App Store distribution due to lack of LC_VERSION_MIN in a Mach-O header
I have a Swift project which calls a command line utility using NSTask. 我有一个Swift项目,它使用NSTask调用命令行实用程序。
For portability, I have included that command line utility in the bundled resources of the app. 为了便于携带,我在应用程序的捆绑资源中包含了该命令行实用程序。
The utility is quite complex - it's a Ruby interpreted application, with a bunch of gems, some of which have native extensions. 该实用程序非常复杂 - 它是一个Ruby解释的应用程序,带有一堆宝石,其中一些具有原生扩展。 The gems are all installed with Bundler into a standard vendor/ directory within the utility.
这些gem都与Bundler一起安装到实用程序中的标准供应商/目录中。
I have successfully archived, validated, distributed, and run the app on a second Mac which does not have that CLI utility (or Xcode) installed through the Developer ID ('outside the Mac App Store') workflow several times. 我已经在第二台Mac上成功存档,验证,分发和运行应用程序,而第二台Mac上没有通过开发者ID(“Mac App Store”外部)工作流程安装的CLI实用程序(或Xcode)多次。
However, the archive failed to validate for Mac App Store distribution with this error: 但是,存档无法验证Mac App Store分发时出现此错误:
2016-08-28 15:26:41 +0000 [MT] Presenting: Error Domain=DVTFoundationNSBundleAdditionsErrorDomain Code=1 "Couldn't find platform family in Info.plist CFBundleSupportedPlatforms or Mach-O LC_VERSION_MIN for AbstractMemory.o" UserInfo={NSLocalizedDescription=Couldn't find platform family in Info.plist CFBundleSupportedPlatforms or Mach-O LC_VERSION_MIN for AbstractMemory.o} 2016-08-28 15:26:41 +0000 [MT]呈现:错误域= DVTFoundationNSBundleAdditionsErrorDomain Code = 1“无法在Info.plist CFBundleSupportedPlatforms中找到平台族或者在AbstractMemory.o中找到Mach-O LC_VERSION_MIN”UserInfo = {NSLocalizedDescription =无法在Info.plist CFBundleSupportedPlatforms中找到平台族或者在AbstractMemory.o中找到Mach-O LC_VERSION_MIN}
So... why would app archive validation fail in the MAS workflow, but not the Developer ID workflow, with such an error? 那么......为什么app工作流验证会在MAS工作流程中失败,而不是Developer ID工作流程会出现这样的错误?
Potentially interesting points: 潜在的有趣点:
iconv
, xmlcatalog
) iconv
, xmlcatalog
) AbstractMemory.o
) AbstractMemory.o
) ffi_c.bundle
, nokogiri.bundle
) ffi_c.bundle
, nokogiri.bundle
) libcapi.dylib
, libcharset.dylib
) libcapi.dylib
, libcharset.dylib
) libcharset.a
) libcharset.a
) The dependency project had originally been compiled with a really old version of Xcode and OS X, so a number of Mach-O executables inside it did not have the LC_VERSION_MIN_MACOSX load command in their headers. 依赖项目最初是使用旧版本的Xcode和OS X编译的,因此其中的许多Mach-O可执行文件在其标题中没有LC_VERSION_MIN_MACOSX加载命令。 Basically I had to find a way to squeeze that load command in.
基本上我必须找到一种方法来挤压该命令。
The only surefire and clean way to do that is to recompile all the native code in the dependency project using the Xcode 7 build tools. 唯一可靠且干净的方法是使用Xcode 7构建工具重新编译依赖项目中的所有本机代码。 If the dependency is open source you could do it yourself.
如果依赖项是开源的,您可以自己完成。 If not you'll have to plead with your software vendor.
如果不是,您将不得不恳求您的软件供应商。
If you need Yosemite Deployment Target compatibility, you could risk it and use Xcode 7.1 GM on a Yosemite build box. 如果您需要Yosemite部署目标兼容性,您可能会冒险并在Yosemite构建框上使用Xcode 7.1 GM。 But I recommend that you recompile the code with Xcode 7.1+ on an El Capitan build box, to ensure your binary dependency plays nice with El Capitan things like SIP.
但我建议您在El Capitan构建盒上使用Xcode 7.1+重新编译代码,以确保您的二进制依赖性能与SIP等El Capitan之类的东西相媲美。
In my case, the dependency project was open source, so I was able to: 就我而言,依赖项目是开源的,所以我能够:
otool -l [path to executable]
. otool -l [path to executable]
。 I was able to set up multiple OS X build VMs without going mad by using Travis CI's Mac build fleet. 通过使用Travis CI的Mac构建机队,我能够设置多个OS X构建VM而不会生气。
"Include symbols for debugging" had to be unticked for archive validation or export. 必须取消“包含用于调试的符号”以进行存档验证或导出。 This is because the symbolicator could not deal with the third party object code.
这是因为符号化器无法处理第三方目标代码。 I guess this is because it was built for release, and so the object code did not come with any accompanying debug symbols.
我想这是因为它是为发布而构建的,因此目标代码没有附带任何附带的调试符号。
If you are not able to recompile the code I've heard rumours of dirty workarounds that can stuff Mach-O load commands into a pre-existing binary. 如果您无法重新编译代码,我听说有关于可以将Mach-O加载命令加载到预先存在的二进制文件中的肮脏变通方法的传闻。 This suffers from the following problems:
这会遇到以下问题:
I cross-posted this question to the Apple Developer forums at https://forums.developer.apple.com/message/175427 to see if it would get answered any faster by a more specialist community. 我将此问题交叉发布到Apple开发人员论坛, 网址为https://forums.developer.apple.com/message/175427 ,看看是否会由更专业的社区更快地得到答复。 It wasn't, but you may find additional discussion of the problem through that link.
事实并非如此,但您可以通过该链接找到对该问题的进一步讨论。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.