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:
Explanation:
According to edford, Apple's software engineer, we need to build our binaries for the iOS platform, targeting
MacOSX
and use theCFLAG
-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 specifyingarchs
ortargets
:Option
--archs
, for OpenSSL <= 1.0.2:Option
--targets
for OpenSSL >= 1.1.0All the above solutions didn't work for me, so I went on and tried to fix it for my system running Mac OSX 10.15.4.
In my case this is where the above solutions stopped working for me:
I read through the build-libssl.sh file noticed that the sdk version was taken by the script using the code:
which on my system does return:
Using finder an navigating to the location:
did show me there was indeed no MacOSX10.15.4.sdk. There was however a MacOSX10.14.sdk. I did use this knowledge to come up with the following solution:
OpenSSL version <= 1.0 (1.0.2l)
OpenSSL version >= 1.1 (1.1.0) currently not functional