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?
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