在对 2019 年的 WWDC 公告感到兴奋之后,我尝试使用 Xcode 11.0 beta 针对 MacOS 编译我现有的 iOS 应用程序。不幸的是,它没有按预期进行。
Xcode 说我的静态库是为<未知>架构构建的:
Building for UIKit for Mac, but the linked library 'libssl.a' was built for < unknown >. You may need to restrict the platforms for which this library should be linked in the target editor.
但是当我检查我的静态库时,我可以看到它们确实包含所需的架构 x86_64
:
我认为这个问题可能与 Xcode Beta 错误有关。有人对此有想法吗?
最佳答案
在线修复:
git clone git@github.com:marcelosalloum/OpenSSL-for-iPhone.git --branch feature/mac-catalyst && \
cd OpenSSL-for-iPhone && \
./build-libssl.sh --archs="MacOSX_x86_64 i386 arm64 armv7s armv7"
说明:
根据 Apple 软件工程师 edford 的说法,我们需要为 iOS 平台构建我们的二进制文件,目标是 MacOSX
并使用 CFLAG
-目标 x86_64-apple-ios13.0-macabi
。这里有一个非常有启发性的讨论:https://forums.developer.apple.com/message/362577 .
我已经 fork OpenSSL-for-iPhone here并在分支 feature/mac-catalyst
中实现了 MacCatalyst 支持。
您可以通过指定 archs
或 targets
为 MacCatalyst
构建它:
选项 --archs
,用于 OpenSSL <= 1.0.2:
git clone git@github.com:marcelosalloum/OpenSSL-for-iPhone.git --branch feature/mac-catalyst && \
cd OpenSSL-for-iPhone && \
./build-libssl.sh --archs="MacOSX_x86_64 i386 arm64 armv7s armv7" --version="1.0.2l"
Option --targets
for OpenSSL >= 1.1.0
git clone git@github.com:marcelosalloum/OpenSSL-for-iPhone.git --branch feature/mac-catalyst && \
cd OpenSSL-for-iPhone && \
./build-libssl.sh --targets="ios-sim-cross-i386 ios64-cross-arm64 ios-cross-armv7s ios-cross-armv7 mac-catalyst-x86_64" --version="1.1.0"
关于ios - Xcode 11 无法识别静态库的架构 : MacCatalyst (aka UIKitForMac),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56479972/