Is it possible to build a "universal binary" of erlang on macOS (ARM/Intel)?

There is no direct support for it, but after briefly looking at the link you provided it should be possible (though not trivial) to build the arm and x86 releases separately and then merge them using lipo. That is something like this:

./configure CFLAGS="-g -O2 -target x86_64-apple-macos10.12" LDFLAGS="-target x86_64-apple-macos10.12"
make
make release RELEASE_ROOT=`pwd`/x86_release
git clean -Xfdq
./configure CFLAGS="-g -O2 -target arm64-apple-macos11" LDFLAGS="-target arm64-apple-macos11"
make
make release RELEASE_ROOT=`pwd`/arm_release

and then run lipo -create -output universal_app for each native binary found in the respective releases. Not sure what has to be done about dynamic libraries.

8 Likes