DMD support for Apples new silicon

Guillaume Piolat first.last at gmail.com
Sun Jan 10 14:50:44 UTC 2021


On Sunday, 10 January 2021 at 14:22:25 UTC, Christian Köstlin 
wrote:
> Hi all,
>
> are there any plans on supporting Apples new ARM silicon with 
> DMD or would this be something for ldc?
>
> Kind regards,
> Christian

Hello Christian,

LDC since 1.24+ support cross-compiling to Apple Silicon.
Here is how to build for it on Big Sur.


1. Download ldc2-1.24.0-osx-x86_64.tar.xz (or later version)
    from this page: https://github.com/ldc-developers/ldc/releases

2. Unzip where you want, and put the bin/ subdirectory in your 
PATH envvar

    This will give you the ldc2 and dub command in your 
command-line, however they won't work straight away in 
Catalina/Big Sur because of lacking notarization.

3. (optional) In this case, in Finder, right-click + click "Open" 
on the bin/dub and bin/ldc2 binaries since it is not notarized 
software, and macOS will ask for your approval first. Once you've 
done that, dub and ldc2 can be used from your Terminal normally.

4. Type 'ld' in Terminal, this will install the necessary latest 
XCode.app if it isn't already. That is a painful 10 gb download 
in general. You can also install Xcode from the App Store. People 
target Big Sur arm64 from Catalina or Big Sur usually.

5. You can target normal x86_64 (Rosetta 2) with:

       ldc2 <params>
       dub <params>

6. If you want to target arm64, adapt the SDK path in 
etc/ldc2.conf with your actual Xcode macOS11.0 path, and then use 
-mtriple=arm64-apple-macos to cross-compile.

       ldc2 -mtriple=arm64-apple-macos <params>
       dub -a arm64-apple-macos <params>

Debugging and notarization is a whole another topic then.


More information about the Digitalmars-d-learn mailing list