Compilers - D Wiki (original) (raw)
| DMD » Digital Mars D compiler The official reference D compiler. | GDC » GCC D compilerThe DMD compiler front end coupled with the GCC compiler back end. Fast and open source. | LDC » LLVM D compilerThe DMD compiler front end coupled with the LLVM compiler back end. Fast and open source. |
|---|
Which compiler should I use?
For beginners, DMD is the recommended choice, as it is the implementation closest to the D Language Specification. Otherwise, the best choice depends on the project's needs, the target platforms, and personal preferences. GDC and LDC both generate substantially faster binaries than DMD.
Comparison
| | DMD | GDC | LDC | | | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Platforms | Windows Linux OS X FreeBSD | Windows (alpha) Linux OS X (untested) FreeBSD (untested) | Windows Linux OS X (incl. iOS etc.) FreeBSD Android | | Architectures | i386 amd64 arm64(aarch64)(experimental) | Complete (runtime / standard library) support: i386 amd64 x32 armel armhf Partial or bare-metal only support (packages for gdc in debian): alpha arm64 (aarch64) hppa hurd-i386 kfreebsd-amd64 kfreebsd-i386 m68k mips mipsel ppc pcc64 ppc64el s390x sparc64 | Complete (runtime / standard library) support: i386 amd64 arm64 (aarch64) armel (untested) armhf (untested) Near-complete support: ppc ppc64 ppc64el mips64 riscv64 loongarch64 Partial or bare-metal only support: mips s390x WebAssembly | | Distribution | Source Multi-platform source/binary archive Multi-platform installer (DVM) Windows installer OS X package (.dmg) Debian/Ubuntu package (.deb) Fedora package (.rpm) OpenSUSE (.rpm) package Debian/Ubuntu repository via http://d-apt.sourceforge.net OS-X homebrew and macports repositories Nix/NixOS package (for NixOS, other Linux and OS X) | Source Windows / Linux binary archive Debian/Ubuntu repository Gentoo repository Archlinux repository | Source Windows / Linux / OS X / FreeBSD / Android binary archive Debian/Ubuntu repository Fedora repository Gentoo repository FreeBSD repository GNU Guix Nix/NixOS package (for NixOS, other Linux and OS X) | | Backend | DMD (DMC fork) | GCC | LLVM | | License | Boost | GPL 3 or later | LDC-specific code: 3-clause BSD | | Inline assembler | DMD Intel-like syntax (i386/amd64) | GCC syntax (all targets) | DMD Intel-like syntax (i386/amd64) GCC syntax (all targets) LLVM inline IR | | SIMD | Partial (?) | Partial (?) | Partial (?) | | Phobos as a shared library | Linux FreeBSD | Linux FreeBSD | Linux (incl. Android) OS X FreeBSD Windows | | Building D code as shared library | Linux OS X FreeBSD Windows | | Linux (incl. Android) OS X FreeBSD Windows | | Dynamic loading of D shared libraries | Linux FreeBSD | | Linux (incl. Android) OS X FreeBSD Windows | | Linux specific | | | | | Object file format | ELF | ELF | ELF | | Mac specific | | | | | Object file format | Mach-O | Mach-O | Mach-O | | Windows specific | | | | | Object file format | COFF | COFF | COFF |
Package and/or binary availability, by platform and compiler
Some unofficial repositories and downloads are listed here, but of course many more do exist. With a little searching, you may be able to find something more up to date for your chosen OS.
Very old compilers are (mostly) omitted, as they are unlikely to be of interest to users.
| Platform | Compiler | ||
|---|---|---|---|
| DMD | GDC | LDC | |
| Windows | Manual download Chocolatey | Manual download | Manual download |
| OS X | Homebrew MacPorts Nix Manual download | Homebrew Nix Manual download | |
| iOS | Manual download | ||
| Android | Manual download Instructions on setup, including a native package | ||
| Linux (generic) | Manual download | Manual download | Manual download Source (ARM/Linux cross-compiler) |
| Cross-platform | DVM (Any version) | ||
| Distribution-specific packages | |||
| Debian | Manual download APT repository | stable testing unstable | stable testing unstable |
| Ubuntu | Manual download APT repository | gdc | ldc |
| Fedora | Manual download | See https://apps.fedoraproject.org/packages/ldc | |
| OpenSuse | devel:languages:D | devel:languages:D home:marc_schuetz | |
| CentOS | Manual download | ||
| Arch Linux | Community | Community AUR (git HEAD) | Community AUR (git HEAD) |
| Gentoo | see https://wiki.gentoo.org/wiki/Dlang | ||
| FreeBSD | Manual download Ports | Ports |
Experimental compilers and forks
- SDC (Snazzy D Compiler) - from-scratch D compiler implementation, written in idiomatic D.
- LDC for iOS - LDC-based toolkit for cross-compiling to iOS
- D for Android - Toolkit for cross-compiling to Android (x86 using DMD and ARM using LDC)
- Calypso - LDC fork which provides direct Clang interoperability, allowing the use of C headers directly.
- DCompute (LDC CUDA and SPIRV) - Library and LDC fork to "target CUDA and SPIR to enable hassle free native execution on the gpu" -upstreamed into LDC
- MicroD - DMD fork which outputs C source code instead of object files
- dtojs - DMD fork which outputs JavaScript source code instead of object files
- DIL - D compiler written in D2/Tango (inactive project)
- dscripten - LDC/emscripten-based toolchain for compiling D to asm.js / WebAssembly
Category page: Experimental compilers