ldc and gdc

Jonathan M Davis jmdavisProg at gmx.com
Thu Aug 4 14:14:29 PDT 2011


> Am 04.08.2011, 19:34 Uhr, schrieb Jonathan M Davis <jmdavisProg at gmx.com>:
> >> By the way... the druntime and phobos patches for LDC - are they
> >> applicable to GDC and DMD as well? I'm asking because I could imagine
> >> installing druntime, phobos, DMD, GDC and LDC and all three compilers
> >> would use the same installation of the standard library.
> > 
> > They _can't_ all use the same installations. At minimum, druntime must be
> > different for each of them. That's expected and by design. Whether Phobos
> > needs to be different for each or not as far as source goes, I don't know
> > (hopefully not, but there might be a reason why it has to). But since the
> > compiled library includes both druntime and Phobos, that can't be shared.
> > 
> > - Jonathan M Davis
> 
> Thank you for the clarification. My impression was that druntime was
> created to make it possible to use either phobos or tango. If the compiled
> library includes both (with which compiler anyway? both GDC and LDC?) I
> figure that I could not install any two of the three compilers in their
> default locations on Linux, correct? If I take the time to create packages
> for Gentoo for the alternative compilers that is good to know. Symlinks
> and altered library names for druntime/phobos would be required. But with
> a mix of DMD1, DMD2, GDC, LDC, Phobos and Tango things could become messy

For D1, Phobos and Tango were incompatible, because they used different 
runtimes. druntime was created for D2 (from Tango's runtime, I believe) so 
that it would be possible for Phobos and Tango to coexist in D2 (though Tango 
hasn't really been officially ported over to D2 yet). So, druntime _does_ help 
with mixing Phobos and Tango.

The problem is that druntime includes stuff which is compiler-specific. It's 
low-level stuff that must vary from compiler to compiler. As such, dmd, gdc, 
and ldc are all going to need somewhat different versions of druntime. That 
shouldn't be true for Phobos, but I don't know what the exact situation with 
gdc and ldc is. But regardless, you're getting one compiled library out of the 
deal, so that's going to be compiler-specific. And so yes, mixing dmd, gdc, 
and ldc on the same system could get a bit interesting in terms of how it 
affects libraries and whatnot. Adding D1 versions of them into the mix would 
make it that much worse. But I've never tried gdc or ldc, and I always install 
dmd in my home directory, so I don't know what it takes to get them all to mix 
nicely in /usr or /opt. dmd.conf should take of the problem easily enough for 
dmd, but I don't know how all that works with gdc and ldc. So, if you're 
looking to manage packages for Gentoo, good luck. It should be quite doable, 
but there are definite obstacles.

- Jonathan M Davis


More information about the Digitalmars-d mailing list