Hi all,
This took me hours to figure out and work on a robust fix (hopefully) to build.d
for others.
Instructions for building DMD on macOS arm64 today:
- Download LDC universal package. You can use the Dlang install.sh script, and pass
-arch universal
. You need this package to target x86_64, because DMD can only be built into an x86_64 binary (because of x86 assembly in its source code). - Apply this patch to build.d: https://github.com/dlang/dmd/pull/16239
- Go to DMD checkout and execute:
HOST_DMD="<path to ldc>/bin/ldmd2" DFLAGS="-mtriple=x86_64-apple-macos11" DMD="<path to ldc>/bin/ldmd2" make
@someone: please add this info to the right places where other people might find it. I really believe that this information is crucial to attract new contributors. If I would be new to the project and wanted to contribute something simple, I would certainly have given up on it. This is not hypothetical: on Slack, Ben Jones told us he just gave up.
-Johan