DMD vs. GDC vs. LDC
Asked Answered
K

3

58

What are the Pros/Cons of the different D Compilers? How is the performance and the standard compliance/D2 support? How well are debuggers supported? How good are the Error messages and is the IDE integration? How good is the 64 bit support? My thought so far:

DMD

  • Mature and well maintained
  • Only one platform, 64 bit support is not good
  • Not FOSS

GDC

  • Supports various platforms
  • Has very mature optimizations, so it's fast?
  • Out of date runtime?
  • GCC so a good debugger support?

LDC

  • Supports various platforms
  • LLVM, so it supports JITing?
  • Has very mature optimizations, so it's fast?
  • Not very well maintained?
  • Out of date runtime?

dead/not working

  • dang
  • sdc
  • MiniD - very, very nice, but not D (never claimed to be, though)

I'm thinking about targeting ARM and i think GDC is the tool of choice, but I'm not sure.

Kinny answered 20/7, 2011 at 19:0 Comment(2)
DMD is the reference implementation (bugs notwithstanding) and it goes cross platformDaltondaltonism
VisualD with cv2pdb has very good debugging support for DMD dsource.org/projects/visuald/wiki/Tour/DebuggerZoellick
S
25

DMD is the reference implementation, the backend and frontend are open source. The code generation quality is not that overwhelming.

GDC and LDC are both based on the DMD frontend so it might take some time until a new version of the frontend is merged in.
Since the backends they use are very mature and good the quality of these compilers mainly depends on the glue code which connects frontend and backend.

LDC and GDC are still developed actively, but mainly by just a few guys.
All in all they could use some manpower.

Sotos answered 20/7, 2011 at 20:6 Comment(3)
How do GDC and LDC support for Druntime and Tango, Phobos? It seems there are issues.Kinny
LDC has very good support for Tango. Don't know about GDC. GDC has an up-to-date fork of phobos2, LDC's fork is 2 months old now.Sotos
Looks like 64 bit support is working now: auto-tester.puremagic.com/?projectid=14Apsis
B
9
  1. Significant drawback of DMD is shared library deficiency:
  2. I personally was surprised that GDC supports D2, but they say it does:
    • D1: 1.067
    • D2: 2.053

  3. LDC definitely seems to be scarcely maintained: "D2 is working on x86-32 Linux only". To me, it's a showstopper issue.

  4. While searching for LDC I've found one more compiler (?!): dil. I haven't tested it yet, but at least it's currently maintained. I'll research more on this topic ASAP. EDIT: As it was pointed out in comments, dil isn't close to a somewhat complete state for now — it is only able to parse the code and generate documentation from sources.
Baecher answered 21/7, 2011 at 9:40 Comment(4)
Don't judge on LDC based on the wiki. Development takes place at bitbucket.org/lindquist/ldc and forks.Sotos
dil is apparently not able to generate binaries yet (it only works on generating docs atm). This is stated on their google code page. Kind of a bummer, it looks pretty coolKosse
@Andrew Spott: hmm... Not even some intermediate representation?Baecher
@vines: doesn't look like it: code.google.com/p/dil says that it can't produce binaries and only generates help docs at the moment.Kosse
C
3

As of February 2012, it seems that LDC is not really a usable option (at least on Debian).

For example, consider the first program in the D book:

import std.stdio;

void main(string[] args)
{
        writeln("Hello, world!");
}

This will fail to compile with LDC on my system:

hello.d(24): Error: module stdio cannot read file 'std/stdio.d'

The same is true of the first program at dlang.org:

import std.stdio;

void main() {
    ulong lines = 0;
    double sumLength = 0;
    foreach (line; stdin.byLine()) {
        ++lines;
        sumLength += line.length;
    }
    writeln("Average line length: ",
        lines ? sumLength / lines : 0);
}

This is because my LDC does not support Phobos--the current D runtime library. It looks like it is possible to build a D2 version of LDC, including Phobos, but that is not the way it ships on Debian at least.

GDC, and of course DMD, both compile the above just fine. It looks like GDC is quite up to date (DMD released 2.057 two months ago and GDC supports it now).

For me, GDC was the obvious choice because a simple 'apt-get -V install gdc' brought in both the compiler and the Phobos runtime with no problems (tested on Debian unstable).

Culpable answered 25/2, 2012 at 0:6 Comment(2)
Your problem is due to incorrect or missing configuration (etc/ldc2.conf, usually sits in /usr/local). If the file exists, then there should be at least 1 "-I{PATH}" switch inside it that points to sources belonging to the library (phobos2) and the runtime. std/stdio.d for instance belongs to phobos2. I'm not an expert, but I've managed to get the LDC compiler (master on github at this time) to compile on OSX Lion 64-bit and this configuration was done automatically by CMake. NB: there were problems with some runtime symbols when linking programs, but I will submit a patch about them.Gargantua
I have the same problem. If there is missing configuration, it's missing in the Debian packaging of lmd.Adalard

© 2022 - 2024 — McMap. All rights reserved.