build: cross compile the macOS x86_64 target natively on Apple Silicon - #296
Merged
devopvoid merged 1 commit intoSep 27, 2026
Merged
Conversation
The Intel macOS build already ran on an Apple Silicon runner, but all of it under Rosetta: an x64 JDK, and every Maven call behind arch -x86_64, so CMake, clang, gn, ninja and FFmpeg's configure and make were all emulated. Maven now runs natively and cross compiles: - the root pom gains a macos-cross-x86_64 profile that sets the macos-x86_64 classifier, declared after macos-aarch64, which the host still activates - the media module takes webrtc-jni's x86_64-macos-cross.cmake toolchain, so FFmpeg is configured as a cross build; Apple's strip reads any Mach-O, so its output stays stripped - the CI actions build with an arm64 JDK and run only the tests on an x64 one, which is what loading the Intel natives needs
devopvoid
added this pull request to stack #297
September 26, 2026 23:59
devopvoid
marked this pull request as ready for review
September 27, 2026 09:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #295.
The Intel macOS build already ran on an Apple Silicon runner (
macos-14), but all of it under Rosetta: an x64 JDK, and every Maven call behindarch -x86_64, so CMake, clang, gn, ninja and FFmpeg's configure and make were all emulated.Maven now runs natively and cross compiles:
macos-cross-x86_64profile that sets themacos-x86_64classifier. It is declared aftermacos-aarch64, which the host still activates, so its properties win.x86_64-macos-cross.cmaketoolchain, so FFmpeg is configured as a cross build (--enable-cross-compile, x86 asm kept, assembled by nasm). Apple's strip reads Mach-O of any architecture, so stripping stays on for macOS.Checked locally with the OS faked as an arm64 Mac (
MAVEN_OPTS="-Dos.name=Mac_OS_X -Dos.arch=aarch64"): with-Pmacos-cross-x86_64the classifier resolves tomacos-x86_64, both native modules pick up the cross toolchain, and FFmpeg installs into~/ffmpeg/macos-x86_64. Not yet run on macOS.Test plan
fileon the packaged dylibs reports x86_64