Bug 1781685

Summary: gdc: Cannot compile D source if ldc-druntime-devel is installed
Product: [Fedora] Fedora Reporter: Borax Man <rotflol2>
Component: ldcAssignee: Kalev Lember <klember>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 31CC: animuspexus, aoliva, avi.kivity, bioinfornatics, dmalcolm, fweimer, ibuclaw, i, jakub, jwakely, klember, law, mpolacek, msebor, nickc
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: ldc-1.23.0-1.fc33 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-08-21 14:17:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Borax Man 2019-12-10 11:46:09 UTC
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

Comment 1 Jakub Jelinek 2020-03-31 14:04:52 UTC
If you read the forum, you'll see that it is a ldc bug, not gcc.

Comment 2 Iain Buclaw 2020-04-21 05:01:16 UTC
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

Comment 3 Kalev Lember 2020-08-21 14:17:22 UTC
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