alexcrichton/openssl-src-rs

Supporting aarch64-apple-darwin

shepmaster opened this issue · 4 comments

I was hoping that OpenSSL would accept the PR that adds support to their build system for aarch64-apple-darwin, but with 1.1.1h released without it, it seems unlikely by the end of 2020. As such, I'd like to discuss how the project feels about applying our own patches on top of the official release.

Specifically, the patch in question only modifies the build system to use existing pieces in new ways.

With that applied, and a single line added to this crate to map target triples, it's possible to cross-compile to aarch64-apple-darwin:

% SDKROOT=$(xcrun -sdk macosx11.0 --show-sdk-path) MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.0 --show-sdk-platform-version) cargo +462ec6baef52edea591eab1a070ed4e18b80d094 build --target=aarch64-apple-darwin --features vendored
   Compiling cc v1.0.60
   Compiling pkg-config v0.3.18
   Compiling autocfg v1.0.1
   Compiling libc v0.2.77
   Compiling bitflags v1.2.1
   Compiling foreign-types-shared v0.1.1
   Compiling openssl v0.10.30 (/Users/shep/Projects/rust-openssl/openssl)
   Compiling cfg-if v0.1.10
   Compiling lazy_static v1.4.0
   Compiling foreign-types v0.3.2
   Compiling openssl-src v111.10.2+1.1.1g (/Users/shep/Projects/openssl-src-rs)
   Compiling openssl-sys v0.9.58 (/Users/shep/Projects/rust-openssl/openssl-sys)
    Finished dev [unoptimized + debuginfo] target(s) in 29.71s

This should make it possible to build Cargo for this platform as well.

It feels kind of bad, but given that it's already shipping in Homebrew maybe not the worst option: openssl/openssl#12369 (comment)

Ah yes, I meant to mention that we wouldn’t be the first to go down that path.

We already do a bit of munging for MUSL here: https://github.com/alexcrichton/openssl-src-rs/blob/master/src/lib.rs#L449, so this could follow that pattern.

Yeah given how small the patch is I think it's fine to get it working here in this crate locally, and we can remove the workaround when it's released upstream.