Re: Porting gdc/dmd

yelninei--- via Bug reports for the GNU Hurd <[email protected]> Thu, 25 Jun 2026 19:11:06 +0200 (CEST)
Newsgroups gmane.os.hurd.bugs
Message-ID <[email protected]>
Hi Samuel,


Jun 24, 2026, 01:13 by [email protected]:

> Hello,
>
> yelninei--- via Bug reports for the GNU Hurd, le mer. 17 juin 2026 10:37:02 +0200, a ecrit:
>
>> The changes have been merged into dmd and phobos master.
>>
>
> Nice!
>
>> There might still be minor issues all over the place because hand translating almost the entire libc headers into D is tedious work.
>>
>
> Uh :/ Been there with rust, done that too... Why are languages still
> doing this rather than just relying on C headers...
>

I guess one needs a C preprocessor and C compiler to fully understand C headers and then a way to convert the C definitions into something the not-C language can understand.Thankfully one only does it once (and hope that the libc never changes its API/ABI)

Having a way to automatically generate this from the C headers would have made this a lot easier.

>> I have backports to gcc-11 and gcc-14/15 which are enough to bootstrap or cross compile an initial gdc (for both i686 and x86_64) that can then be used to build dmd. How is Dlang currently bootstrapped in debian and gentoo?
>>
>
> The rebootstrap script can be used to cross-build gcc from a linux host
> for instance.
>
> How did you bootstrap for your work? Did you cross-compile?
>

I started with a cross compiler from gdc 14 on linux because of significant improvements in DRuntime (reducing assumptions that glibc means linux + glibc) . 
I  switched to bootstrapping from gcc-11 once I knew what was needed for each file in the ifdef jungle that is DRuntime (gdc-11 is the last gdc version where the compiler is in C++ and one does not need an existing D compiler) because that is easier for guix.

 With the backports I can built

gdc-11 -> gdc-14 -> dmd

completely natively on i686 and x86_64.
The patches are here: https://codeberg.org/guix/guix/pulls/8026 .For x86_64 it needs a patch for minimal support in gcc-11 as well.
For gcc-15 it should also just work after rebasing the gcc-14 patches (untested)
> Samuel
>
Y.