Xcode 11 not recognizing static library's architecture: MacCatalyst (aka UIKitForMac)

帅比萌擦擦* 提交于 2019-12-22 04:49:06

问题


After getting excited about 2019's WWDC announcements, I tried compiling my existing iOS app against the MacOS using Xcode 11.0 beta. Unfortunately, it didn't go as expected.

Xcode says my static library is built for < unknown > architecture:

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.

But when I check my static libs, I can see they do contain the desired architecture x86_64:

I believe this issue may be related to an Xcode Beta bug. Does anyone have thoughts on this?


回答1:


One-line fix:

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"

Explanation:

According to edford, Apple's software engineer, we need to build our binaries for the iOS platform, targeting MacOSX and use the CFLAG -target x86_64-apple-ios13.0-macabi. There is a very enlightening discussion here: https://forums.developer.apple.com/message/362577.

I've forked OpenSSL-for-iPhone here and implemented MacCatalyst support in the branch feature/mac-catalyst.

You can build it for MacCatalyst either by specifying archs or targets:

Option --archs, for 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"


来源:https://stackoverflow.com/questions/56479972/xcode-11-not-recognizing-static-librarys-architecture-maccatalyst-aka-uikitfo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!