Building DMD on macOS arm64 - 23 Feb 2024

Johan j at j.nl
Fri Feb 23 21:50:47 UTC 2024


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:
1. Download LDC universal package. You can use the Dlang 
[install.sh script](https://dlang.org/install.html), 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).
2. Apply this patch to build.d: 
https://github.com/dlang/dmd/pull/16239
2. Go to DMD checkout and execute:</br>
  `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


More information about the Digitalmars-d mailing list