gdc broken by ldc-phobos-devel on Fedora

mipri mipri at minimaltype.com
Wed Nov 20 21:51:58 UTC 2019


Howdy,

This was the case in Fedora 30, and is now the case in Fedora 31.
RPMs are available for gdc and for ldc2, but when both are
installed gdc can't compile anything as it tries to load a version
of phobos installed by ldc2 which has features gdc doesn't yet
support. For someone who's decided to just use gdc for a project,
they have the easy fix of just uninstalling ldc2, but I'd expect
that someone evaluating D as a language will be interested in
comparing the different compilers, so all the compilers will be
installed--and then only dmd and ldc will be functional.

As commands:

   dnf install gcc-gdc ldc
   echo 'void main() { import std.stdio; writeln("hello"); }' > 
hello.d
   gdc hello.d

This will fail due to ldc-phobos-devel's files in /usr/include/d:

/usr/include/d/core/internal/hash.d:426:16: error: basic type 
expected, not foreach
   426 |         static foreach (i; 0 .. T.sizeof / size_t.sizeof)
       |                ^
/usr/include/d/core/internal/hash.d:426:16: error: no identifier 
for declarator _error_
   426 |         static foreach (i; 0 .. T.sizeof / size_t.sizeof)
       |                ^
/usr/include/d/core/internal/traits.d:175:12: error: declaration 
expected, not 'foreach'
   175 |     static foreach (Ti; T)
       |            ^
/usr/include/d/core/internal/traits.d:175:26: error: no 
identifier for declarator T
   175 |     static foreach (Ti; T)
       |                          ^
/usr/include/d/core/internal/traits.d:175:26: error: declaration 
expected, not ')'
   175 |     static foreach (Ti; T)
       |                          ^
/usr/include/d/core/internal/traits.d:182:5: error: unrecognized 
declaration
   182 |     }
       |     ^

gdc installs its own files into path[1] but prefers 
/usr/include/d:

import path[0] = /usr/include/d
import path[1] = /usr/lib/gcc/x86_64-redhat-linux/9/include/d

and I haven't found a way, in gdc's manpage or in (the much less
examined) gcc documentation, to skip the first path. I'm also not
sure what a proper fix would be. Maybe the ldc rpm should be
updated to install phobos into a similarly ldc-specific directory.
Maybe a gdc update will happen soon and ldc's phobos files will be
acceptable to it.

Mainly I want to mention it here so that people can find it and 
not
just think that gdc is broken on Fedora, like I thought for a good
while.



More information about the D.gnu mailing list