krzyzanowskim / OpenSSL

OpenSSL package for SwiftPM, CocoaPod, and Carthage, multiplatform
https://swift.best
Other
910 stars 336 forks source link

Support ARM64 macOS builds #86

Closed DarkDust closed 4 years ago

DarkDust commented 4 years ago

This provides basic support for building OpenSSL on macOS for ARM64 as well.

This pull request needs to make a number of changes:

Known issues/limitations

DarkDust commented 4 years ago

Correction: The frameworks produced with Xcode 12 beta do have the minimum deployment targets set to iOS 8.0 and macOS 10.9, even though iOS 6.0 and macOS 10.8 were passed to the compiler (which, funnily enough, is visible inside the final binaries).

krzyzanowskim commented 4 years ago

this is fantastic! I'll back to it ASAP

krzyzanowskim commented 4 years ago

@DarkDust just to clarify. With these changes, does it still build with Xcode 11?

krzyzanowskim commented 4 years ago

Something is off with result. After I run the script, macos result is missing

./build.sh
Building for iPhoneSimulator i386
Configuring for iPhoneSimulator.platform i386
Building /var/folders/2_/tt78sncj6p9fbmkn7808254h0000gn/T/tmp.2dMv5WRe/1.0.2u-iPhoneSimulator-i386.build.log
Building for iPhoneSimulator x86_64
Configuring for iPhoneSimulator.platform x86_64
Building /var/folders/2_/tt78sncj6p9fbmkn7808254h0000gn/T/tmp.2dMv5WRe/1.0.2u-iPhoneSimulator-x86_64.build.log
Building for iPhoneOS armv7
Configuring for iPhoneOS.platform armv7
Building /var/folders/2_/tt78sncj6p9fbmkn7808254h0000gn/T/tmp.2dMv5WRe/1.0.2u-iPhoneOS-armv7.build.log
Building for iPhoneOS armv7s
Configuring for iPhoneOS.platform armv7s
Building /var/folders/2_/tt78sncj6p9fbmkn7808254h0000gn/T/tmp.2dMv5WRe/1.0.2u-iPhoneOS-armv7s.build.log
Building for iPhoneOS arm64
Configuring for iPhoneOS.platform arm64
Building /var/folders/2_/tt78sncj6p9fbmkn7808254h0000gn/T/tmp.2dMv5WRe/1.0.2u-iPhoneOS-arm64.build.log
Building for MacOSX x86_64
Configuring for MacOSX.platform x86_64
Building /var/folders/2_/tt78sncj6p9fbmkn7808254h0000gn/T/tmp.iHj3nIE5/1.0.2u-MacOSX-x86_64.build.log
Screenshot 2020-07-13 at 22 38 36
DarkDust commented 4 years ago

Oh, sorry, I‘ll look into this tomorrow.

DarkDust commented 4 years ago

I found the problem: even though the SDK version is 10.15.4, the SDK path is .../Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk (note the missing .4). I've changed the derivation of CROSS_TOP and CROSS_SDK (used by the OpenSSL configure/makefile) to derive it from the actual SDK path instead.

This means we don't need the *_SDK_VERSION and *_PLATFORM variables any more (except for OSX_SDK_VERSION to decide whether to build for ARM64).

The updated version now builds both with Xcode 11 and 12 beta.

krzyzanowskim commented 4 years ago

@DarkDust thank you!