Description of problem: GDC fails to compile any D source file if LDC is installed. GDC reports multiple compilation errors. GDC works as expected if LDC is not installed. Version-Release number of selected component (if applicable): 9.2.1-1 How reproducible: Reproducible all the time. Steps to Reproduce: 1. Ensure gcc-gdc and ldc-druntime-devel both installed. ldc-druntime-devel is a dependency of ldc 2. Invoke gdc to compile a D source file. Actual results: GDC fails with multiple compilation errors concerning source files in /usr/include/d/core/internal Expected results: GDC to compile and link successfully. Additional info: Removing ldc (or more specifically ldc-druntime-devel) fixes the problem. The issue seems to be that with ldc-druntime-devel, gdc uses the .d source files located at /usr/include/d/core/internal, which belong to ldc-druntime-devel, instead of the source files at /usr/lib/gcc/x86_64-redhat-linux/9/include/d, which are owned by gcc-gdc. By removing LDC, GDC then uses its own .d source files. This is a bug because the precense of ldc shouldn't break gdc, and that it may be required for users to have both packages installed to run D programs. Also see https://forum.dlang.org/thread/esijvgxtcyoxivrtpmgx@forum.dlang.org
If you read the forum, you'll see that it is a ldc bug, not gcc.
More specifically, the environment variable required to set up a proper location to install modules. https://salsa.debian.org/d-team/ldc/-/blob/debian/master/debian/rules#L11 An extra patch is required to re-add /usr/include/d back into the search paths. https://salsa.debian.org/d-team/ldc/-/blob/d3a8be556a8a5fcabc8bd98e5ff561b2185c4057/debian/patches/02_ldc_include_path.diff
I just spent some time looking into this and I think I got this issue resolved in ldc-1.23.0-1.fc33 The idea is that gdc installs its internal D runtime headers into a private directory under /usr/lib/gdc, and ldc installs its private headers into /usr/lib/ldc, and then /usr/include/d contains only shared library headers that both compilers can use. Does this sounds about right? https://src.fedoraproject.org/rpms/ldc/c/4150b474999ba50f6708603f4c0d8602d5bd9808