Skip to content

WIP - Support cross-compile darwin builds to aarch64 [ci-full]#7137

Open
moztcampbell wants to merge 4 commits into
mozilla:mainfrom
moztcampbell:aarch64_darwin_cross
Open

WIP - Support cross-compile darwin builds to aarch64 [ci-full]#7137
moztcampbell wants to merge 4 commits into
mozilla:mainfrom
moztcampbell:aarch64_darwin_cross

Conversation

@moztcampbell

Copy link
Copy Markdown
Collaborator

To support local android builds on Apple Silicon to use Nimbus in unit-tests, I'd like to extend our megazord_full_libsForTests artifacts to include darwin-aarch64. This extends the existing configuration to also target aarch64 following a similar consistent approach with Glean (such as the no_encryption flag).

Pushing PR to poke some CI and see what happens...

Comment on lines +23 to +32
export ORG_GRADLE_PROJECT_RUST_ANDROID_GRADLE_TARGET_${target_upper}_NSS_STATIC=1
export ORG_GRADLE_PROJECT_RUST_ANDROID_GRADLE_TARGET_${target_upper}_NSS_DIR=/builds/worker/checkouts/vcs/libs/desktop/darwin-${build_path}/nss
export ORG_GRADLE_PROJECT_RUST_ANDROID_GRADLE_TARGET_${target_upper}_CC=/builds/worker/clang/bin/clang-20
export ORG_GRADLE_PROJECT_RUST_ANDROID_GRADLE_TARGET_${target_upper}_TOOLCHAIN_PREFIX=/builds/worker/cctools/bin
export ORG_GRADLE_PROJECT_RUST_ANDROID_GRADLE_TARGET_${target_upper}_AR=/builds/worker/cctools/bin/${target}-ar
export ORG_GRADLE_PROJECT_RUST_ANDROID_GRADLE_TARGET_${target_upper}_RANLIB=/builds/worker/cctools/bin/${target}-ranlib
export ORG_GRADLE_PROJECT_RUST_ANDROID_GRADLE_TARGET_${target_upper}_LD_LIBRARY_PATH=/builds/worker/clang/lib
export ORG_GRADLE_PROJECT_RUST_ANDROID_GRADLE_TARGET_${target_upper}_RUSTFLAGS="-C linker=/builds/worker/clang/bin/clang-20 -C link-arg=-fuse-ld=/builds/worker/cctools/bin/${target}-ld -C link-arg=-B -C link-arg=/builds/worker/cctools/bin -C link-arg=-target -C link-arg=${target} -C link-arg=-isysroot -C link-arg=/tmp/MacOSX11.0.sdk -C link-arg=-Wl,-syslibroot,/tmp/MacOSX11.0.sdk -C link-arg=-Wl,-dead_strip${extra_rustflags}"
export ORG_GRADLE_PROJECT_RUST_ANDROID_GRADLE_TARGET_${target_upper}_CFLAGS_${target_lower}="-B /builds/worker/cctools/bin -target ${target} -isysroot /tmp/MacOSX11.0.sdk -Wl,-syslibroot,/tmp/MacOSX11.0.sdk -Wl,-dead_strip"
export ORG_GRADLE_PROJECT_RUST_ANDROID_GRADLE_TARGET_${target_upper}_BINDGEN_EXTRA_CLANG_ARGS="--sysroot /tmp/MacOSX11.0.sdk"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diff machinery failed me here, but the values for x86_64 should be unchanged. For aarch64, we add the no_encryption linker flag based on what Glean does. https://github.com/mozilla/glean/blob/8aff55c2b89b9592428034b00bdd2a13a2861c2b/taskcluster/scripts/cross-compile-setup.sh#L22

@moztcampbell

Copy link
Copy Markdown
Collaborator Author

Sigh.. now I see the NSS issue with CI missing nss aarch64 artifacts

@moztcampbell moztcampbell force-pushed the aarch64_darwin_cross branch 20 times, most recently from 5d36ef8 to 150a3d9 Compare December 23, 2025 23:01
@moztcampbell moztcampbell force-pushed the aarch64_darwin_cross branch 2 times, most recently from ab95d00 to bcc38cd Compare January 5, 2026 22:53
To support darwin-aarch64 in the future, avoid using the ambiguous 'darwin' target
and also generalize the rust-android-gradle handling.
Build the android unit-test megazords with support for darwin-aarch64 to make
it easier to run tests locally that use Nimbus, etc. Since our NSS CI doesn't
have darwin-aarch64 artifacts, this patch builds NSPR/NSS directly similar to
how libs/build-nss-ios.sh does.
@moztcampbell moztcampbell force-pushed the aarch64_darwin_cross branch 2 times, most recently from 90b3bbe to 8240905 Compare January 5, 2026 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant