Difference between revisions of "Compilers"
Klickverbot (talk | contribs) (LDC armhf has been passing all tests for a while) |
ZILtoid1991 (talk | contribs) (→Comparison) |
||
(18 intermediate revisions by 10 users not shown) | |||
Line 5: | Line 5: | ||
<td style="width:33%; vertical-align: top; padding: 10px 10px; background: #f9f9f9; border: 1px solid #ccc; border-top: 1px solid #eee; border-bottom: 2px solid #999;"> | <td style="width:33%; vertical-align: top; padding: 10px 10px; background: #f9f9f9; border: 1px solid #ccc; border-top: 1px solid #eee; border-bottom: 2px solid #999;"> | ||
= [[DMD|DMD »]] = | = [[DMD|DMD »]] = | ||
− | '''Digital Mars D compiler''' <br/>The | + | '''Digital Mars D compiler''' <br/>The official reference D compiler. |
<div style="text-align: right;">[[DMD|DMD Portal »]]</div> | <div style="text-align: right;">[[DMD|DMD Portal »]]</div> | ||
</td> | </td> | ||
Line 17: | Line 17: | ||
= [[GDC|GDC »]] = | = [[GDC|GDC »]] = | ||
'''GCC D compiler'''<br/> | '''GCC D compiler'''<br/> | ||
− | Fast and open source. | + | The DMD compiler front end coupled with the GCC compiler back end. Fast and open source. |
<div style="text-align: right;">[[GDC|GDC Portal »]]</div> | <div style="text-align: right;">[[GDC|GDC Portal »]]</div> | ||
</td> | </td> | ||
Line 24: | Line 24: | ||
= [[LDC|LDC »]] = | = [[LDC|LDC »]] = | ||
'''LLVM D compiler'''<br/> | '''LLVM D compiler'''<br/> | ||
− | Fast and open source. | + | The DMD compiler front end coupled with the LLVM compiler back end. Fast and open source. |
<div style="text-align: right;">[[LDC|LDC Portal »]]</div> | <div style="text-align: right;">[[LDC|LDC Portal »]]</div> | ||
</td> | </td> | ||
Line 32: | Line 32: | ||
== Which compiler should I use? == | == 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 == | == Comparison == | ||
Line 48: | Line 48: | ||
*OS X | *OS X | ||
*FreeBSD | *FreeBSD | ||
− | |||
| | | | ||
*Windows (alpha) | *Windows (alpha) | ||
Line 60: | Line 59: | ||
*FreeBSD | *FreeBSD | ||
*OpenSolaris | *OpenSolaris | ||
− | *iOS ( | + | *iOS (alpha) |
− | *Android | + | *Android |
|--- | |--- | ||
Line 68: | Line 67: | ||
* i386 | * i386 | ||
* amd64 | * amd64 | ||
+ | * arm64(aarch64)(experimental) | ||
| | | | ||
Complete (runtime / standard library) support: | Complete (runtime / standard library) support: | ||
Line 108: | Line 108: | ||
* mips | * mips | ||
* s390x | * s390x | ||
+ | * WASM | ||
|--- | |--- | ||
|'''Distribution''' | |'''Distribution''' | ||
Line 121: | Line 122: | ||
*Debian/Ubuntu repository via http://d-apt.sourceforge.net | *Debian/Ubuntu repository via http://d-apt.sourceforge.net | ||
*OS-X homebrew and macports repositories | *OS-X homebrew and macports repositories | ||
+ | *Nix/NixOS package (for NixOS, other Linux and OS X) | ||
| | | | ||
*Source | *Source | ||
Line 133: | Line 135: | ||
*Fedora repository | *Fedora repository | ||
*Gentoo repository | *Gentoo repository | ||
+ | *FreeBSD repository | ||
+ | *[[Installing_LDC_on_GNU_Guix|GNU Guix]] | ||
+ | *Nix/NixOS package (for NixOS, other Linux and OS X) | ||
|--- | |--- | ||
|'''Backend''' | |'''Backend''' | ||
− | | [https://github.com/ | + | | [https://github.com/dlang/dmd/tree/master/src/dmd/backend DMD] ([http://digitalmars.com/download/freecompiler.html DMC] fork) |
| [http://gcc.gnu.org/ GCC] | | [http://gcc.gnu.org/ GCC] | ||
| [http://llvm.org/ LLVM] | | [http://llvm.org/ LLVM] | ||
|--- | |--- | ||
|'''License''' | |'''License''' | ||
− | | | + | | Boost |
− | |||
| GPL 3 or later | | GPL 3 or later | ||
| LDC-specific code: 3-clause BSD | | LDC-specific code: 3-clause BSD | ||
Line 165: | Line 169: | ||
* FreeBSD ? | * FreeBSD ? | ||
| | | | ||
+ | * Linux | ||
+ | * FreeBSD ? | ||
| | | | ||
* Linux | * Linux | ||
Line 176: | Line 182: | ||
| | | | ||
* Linux | * Linux | ||
+ | * OS X | ||
|--- | |--- | ||
|'''Dynamic loading of D shared libraries''' | |'''Dynamic loading of D shared libraries''' | ||
Line 183: | Line 190: | ||
| | | | ||
* Linux | * Linux | ||
+ | * OS X | ||
|--- | |--- | ||
!colspan="4" align="center"|<br/>'''Linux specific''' | !colspan="4" align="center"|<br/>'''Linux specific''' | ||
Line 207: | Line 215: | ||
==Package and/or binary availability, by platform and compiler== | ==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. | 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. | ||
Line 238: | Line 241: | ||
*[http://brew.sh Homebrew] | *[http://brew.sh Homebrew] | ||
*[https://www.macports.org MacPorts] | *[https://www.macports.org MacPorts] | ||
+ | *[https://nixos.org/nixos/packages.html#dmd Nix] | ||
*[http://dlang.org/download.html Manual download] | *[http://dlang.org/download.html Manual download] | ||
| | | | ||
| | | | ||
*[http://brew.sh Homebrew] | *[http://brew.sh Homebrew] | ||
+ | *[https://nixos.org/nixos/packages.html#ldc Nix] | ||
*[https://github.com/ldc-developers/ldc/releases Manual download] | *[https://github.com/ldc-developers/ldc/releases Manual download] | ||
|--- | |--- | ||
Line 252: | Line 257: | ||
!Android | !Android | ||
| | | | ||
− | |||
| | | | ||
| | | | ||
− | *[https://github.com/ | + | *[https://github.com/ldc-developers/ldc/releases Manual download] |
− | *[[Build | + | *[[Build D for Android|Instructions on setup]], including a native package |
|--- | |--- | ||
!Linux (generic) | !Linux (generic) | ||
Line 280: | Line 284: | ||
*[http://d-apt.sourceforge.net APT repository] | *[http://d-apt.sourceforge.net APT repository] | ||
| | | | ||
− | * [https://packages.debian.org/ | + | * [https://packages.debian.org/buster/gdc stable] |
− | * [https://packages.debian.org/ | + | * [https://packages.debian.org/bullseye/gdc testing] |
* [https://packages.debian.org/sid/gdc unstable] | * [https://packages.debian.org/sid/gdc unstable] | ||
| | | | ||
− | * [https://packages.debian.org/ | + | * [https://packages.debian.org/buster/ldc stable] |
+ | * [https://packages.debian.org/bullseye/ldc testing] | ||
* [https://packages.debian.org/sid/ldc unstable] | * [https://packages.debian.org/sid/ldc unstable] | ||
|--- | |--- | ||
Line 292: | Line 297: | ||
*[http://d-apt.sourceforge.net APT repository] | *[http://d-apt.sourceforge.net APT repository] | ||
| | | | ||
− | [http://packages.ubuntu.com/search?keywords= | + | [http://packages.ubuntu.com/search?keywords=gdc gdc] |
| | | | ||
[http://packages.ubuntu.com/search?keywords=ldc ldc] | [http://packages.ubuntu.com/search?keywords=ldc ldc] | ||
Line 336: | Line 341: | ||
| | | | ||
| | | | ||
+ | *[https://www.freshports.org/lang/ldc Ports] | ||
|} | |} | ||
== Experimental compilers and forks == | == Experimental compilers and forks == | ||
− | * [[SDC|SDC ( | + | * [[SDC|SDC (Snazzy D Compiler)]] - from-scratch D compiler implementation, written in idiomatic D. |
* [https://github.com/smolt/ldc-iphone-dev LDC for iOS] - LDC-based toolkit for cross-compiling to iOS | * [https://github.com/smolt/ldc-iphone-dev LDC for iOS] - LDC-based toolkit for cross-compiling to iOS | ||
* [https://github.com/joakim-noah/android/releases D for Android] - Toolkit for cross-compiling to Android (x86 using DMD and ARM using LDC) | * [https://github.com/joakim-noah/android/releases D for Android] - Toolkit for cross-compiling to Android (x86 using DMD and ARM using LDC) | ||
* [https://github.com/Syniurge/Calypso Calypso] - LDC fork which provides direct Clang interoperability, allowing the use of C headers directly. | * [https://github.com/Syniurge/Calypso 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 |
* [https://github.com/yebblies/dmd/tree/microd MicroD] - DMD fork which outputs C source code instead of object files | * [https://github.com/yebblies/dmd/tree/microd MicroD] - DMD fork which outputs C source code instead of object files | ||
* [https://github.com/adamdruppe/dtojs dtojs] - DMD fork which outputs JavaScript source code instead of object files | * [https://github.com/adamdruppe/dtojs dtojs] - DMD fork which outputs JavaScript source code instead of object files | ||
* [[DIL]] - D compiler written in D2/Tango (inactive project) | * [[DIL]] - D compiler written in D2/Tango (inactive project) | ||
+ | * [https://github.com/Ace17/dscripten dscripten] - LDC/emscripten-based toolchain for compiling D to asm.js / WebAssembly | ||
Category page: [[Experimental compilers]] | Category page: [[Experimental compilers]] | ||
[[Category:Compiler]] | [[Category:Compiler]] |
Latest revision as of 18:35, 28 August 2024
DMD »Digital Mars D compiler |
GDC »GCC D compiler |
LDC »LLVM D compiler |
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 |
|
|
|
Architectures |
|
Complete (runtime / standard library) support:
Partial or bare-metal only support (packages for gdc in debian):
|
Complete (runtime / standard library) support:
Near-complete support:
Partial or bare-metal only support:
|
Distribution |
|
|
|
Backend | DMD (DMC fork) | GCC | LLVM |
License | Boost | GPL 3 or later | LDC-specific code: 3-clause BSD |
Inline assembler |
|
|
|
SIMD | Partial (?) | Partial (?) | Partial (?) |
Phobos as a shared library |
|
|
|
Building D code as shared library |
|
| |
Dynamic loading of D shared libraries |
|
| |
Linux specific | |||
Object file format | ELF | ELF | ELF |
Mac specific | |||
Object file format | Mach-O | Mach-O | Mach-O |
Windows specific | |||
Object file format | OMF (32) / COFF (32 & 64) | 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 | |||
OS X | |||
iOS | |||
Android |
| ||
Linux (generic) |
| ||
Cross-platform |
|
||
Distribution-specific packages | |||
Debian | |||
Ubuntu | |||
Fedora | |||
OpenSuse | |||
CentOS | |||
Arch Linux |
|
|
|
Gentoo | see https://wiki.gentoo.org/wiki/Dlang | ||
FreeBSD |
|
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