FS#62726 - [gcc] Add D language support

Attached to Project: Arch Linux
Opened by loqs (loqs) - Thursday, 23 May 2019, 18:20 GMT
Last edited by Bartłomiej Piotrowski (Barthalion) - Thursday, 24 October 2019, 16:38 GMT
Task Type Feature Request
Category Packages: Core
Status Closed
Assigned To Bartłomiej Piotrowski (Barthalion)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 8
Private No


The gcc 9 release added D programming language support which is currently supplied by gdc 8.2.1+2.068.2-2.

Additional info:
* gcc 9.1.0-1
* https://www.gnu.org/software/gcc/gcc-9/changes.html
This task depends upon

Closed by  Bartłomiej Piotrowski (Barthalion)
Thursday, 24 October 2019, 16:38 GMT
Reason for closing:  Fixed
Additional comments about closing:  gcc 9.2.0-3
Comment by Jamp (jamp) - Monday, 24 June 2019, 07:53 GMT
+1! Please add D support directly from gcc.
Comment by Daniel Kozák (kozzi) - Wednesday, 26 June 2019, 13:44 GMT
Here is an example of PKGBUILD how to add gdc support to gcc

new files for building gcc with d support
Comment by Juan Francisco Cantero Hurtado (juanfra) - Wednesday, 10 July 2019, 19:11 GMT
Just in case you (GCC maintainers) don't know, the gdc version in Arch Linux doesn't work. I'm trying to build a quite simple program (41 lines) which uses phobos and it fails with the error: "gdc: fatal error: -fuse-linker-plugin, but liblto_plugin.so not found". I can't workaround the problem disabling the linker plugin because then ld can't find "crtbeginS.o". There are similar bug reports.

The current gdc package is useless. Also, you will need gdc 9 to bootstrap gdc 10 when upstream releases it. The merge of gdc in the gcc package is inevitable and will not break other packages because the only affected package is already broken :) .
Comment by Maxim (mxfm) - Wednesday, 10 July 2019, 19:42 GMT
The gdc package is broken because it is compiled in 8.2 version and seeks liblto_plugin.so in '/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/' but it is installed in gcc package in '9.1.0' folder. So either gdc should ship this library or should be configured to find it from gcc package. Without this the gdc package will be always broken when gcc version > gdc version.
Comment by Robert Schadek (burner) - Thursday, 11 July 2019, 14:31 GMT
+1! Arch is a really good D dev distro. Its a shame that gcc is not up to spec.
Comment by Daniel Kozák (kozzi) - Thursday, 01 August 2019, 12:33 GMT Comment by Daniel Kozák (kozzi) - Wednesday, 07 August 2019, 14:54 GMT
Until this is solved I have made some aur packages:

https://aur.archlinux.org/packages/gdc-static/ - this is what is part of gcc9 (c++ DMDFE 2.076.1)
https://aur.archlinux.org/packages/gdc-git/ - this is what would be part of gcc10 (dlang DMDFE 2.086.0)
Comment by Bartłomiej Piotrowski (Barthalion) - Thursday, 17 October 2019, 05:25 GMT
@Daniel: Have you managed to actually run GCC test suite with all other languages enabled? Just as it was with 9.1.0, 9.2.0 tests also get terminated for some reason.
Comment by Daniel Kozák (kozzi) - Thursday, 17 October 2019, 07:50 GMT
@Bartłomiej: No I have not, but I will look into it today.
Comment by Bartłomiej Piotrowski (Barthalion) - Thursday, 17 October 2019, 09:39 GMT
I ended up disabling them for now. If I get it to compile some packages we have in repositories, I'll consider it good enough and push it to [testing] this week.
Comment by Bartłomiej Piotrowski (Barthalion) - Thursday, 17 October 2019, 10:52 GMT
Specifically, just libgphobos. gdc test suite seems to work.
Comment by Daniel Kozák (kozzi) - Thursday, 17 October 2019, 20:41 GMT
It is related to -shared-libphobos, GDC is suppose to be built and use with static druntime and phobosby default, so this is reason why I am using --enable-static instead of --enable-shared in my AUR PKGBUILDs.
Other way is to have some wrapper as I have posted her which add -shared-libphobos to gdc invokes. But to make check works you would have to somehow add this to flags. One way is add this line to prepare in PKGBUILD:
sed -i "/GDCFLAGSX=/s/-Wall/-shared-libphobos -Wall/" libphobos/configure
Comment by Bartłomiej Piotrowski (Barthalion) - Friday, 18 October 2019, 08:20 GMT
@Daniel: No dice, still fails; I can't get gtkd to build either. I will upload packages (incl. glibc and binutils due to the latter upgrade) to separate repository, maybe you will have some ideas what I'm doing wrong.
Comment by Daniel Kozák (kozzi) - Friday, 18 October 2019, 13:47 GMT
@Bartłomiej: can you share you PKGBUILD, I will try it on my PC and see what can be done
Comment by Bartłomiej Piotrowski (Barthalion) - Monday, 21 October 2019, 07:43 GMT
Server = https://pkgbuild.com/~bpiotrowski/gdc/

Should go above [core] due to reasons described above. You can find src.tar.gz files there as well.
Comment by Daniel Kozák (kozzi) - Thursday, 24 October 2019, 11:36 GMT
@Bartłomiej: I have try it and seems to work ok for me. The issue with gtkd seems to be related to gdc itself:

Comment by Bartłomiej Piotrowski (Barthalion) - Thursday, 24 October 2019, 16:38 GMT
Great, thanks. Feel free to email me if you see any possible improvements in the future.