Bug 266825 - lang/gcc*: Enable D lang compiler (frontend) GDC
Summary: lang/gcc*: Enable D lang compiler (frontend) GDC
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Lorenzo Salvadore
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-04 20:36 UTC by Daniel Engberg
Modified: 2023-03-27 15:43 UTC (History)
4 users (show)

See Also:
salvadore: maintainer-feedback+


Attachments
Patch for gcc11 (1.73 KB, patch)
2022-10-04 20:36 UTC, Daniel Engberg
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Engberg freebsd_committer freebsd_triage 2022-10-04 20:36:57 UTC
Created attachment 237078 [details]
Patch for gcc11

This is needed to bootstrap devel/ldc and is the last version to build GDC without requiring to be bootstrapped

Compile and runtime tested on FreeBSD 13.1-STABLE (amd64)
Poudriere testport OK 12.3-RELEASE (amd64)
Poudriere testport OK 13.1-RELEASE (i386)
Comment 1 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-10-04 20:41:14 UTC
Thanks for your patch Daniel, I am going to check it as soon as possible.
Comment 2 Daniel Engberg freebsd_committer freebsd_triage 2022-10-04 23:03:24 UTC
Thanks!

A small nitpick on my own patch, bin/%%GNU_HOST%%-gdc11 should probably say bin/%%GNU_HOST%%-gdc%%SUFFIX%% in pkg-plist?

Best regards,
Daniel
Comment 3 Daniel Engberg freebsd_committer freebsd_triage 2022-10-05 07:27:23 UTC
FYI
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266828#c6

We might only want to have this enabled on aarch64 and amd64
Comment 4 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-10-06 20:05:38 UTC
I am studying your patch and I have a few questions.

> This is needed to bootstrap devel/ldc and is the last version to build GDC without requiring to be bootstrapped

Can you rephrase this please? What do you mean by "is the last version to build GDC without requiring to be boostrapped"? Do you refer to the version of gcc or the version of ldc? Do you refer to the boostrap of gcc or of ldc?

More precisely, I see your patch is for gcc11 only. Do you need D lang compiler for GCC 11 only? Don't you need it for GCC > 11? Please also keep in mind that I have already started the process to make GCC 12 the default GCC version:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265948

> A small nitpick on my own patch, bin/%%GNU_HOST%%-gdc11 should probably say bin/%%GNU_HOST%%-gdc%%SUFFIX%% in pkg-plist?

Yes, indeed.

> We might only want to have this enabled on aarch64 and amd64

Thanks to specify this, but if it works on other architectures too I prefer to enable it for them as well, so that we do not increase the port complexity.

----

I do not think your change requires an exp run, but I would like to follow Gerald's style of modifying the port (I might change it in the future when I have more time): let's first make your change to gcc11-devel, wait a bit to see if there is any package fallout, then, if everything is fine, let's update gcc11 too.
Does that work for you? Do you need the patch to be committed quickier?
Comment 5 Daniel Engberg freebsd_committer freebsd_triage 2022-10-06 21:56:05 UTC
Hi,

Yes, I too love the rather confusing naming ;-)

GDC is "GPL implementation of the D compiler which integrates the open source D front end with GCC". [1]
In GCC 12 and newer you need a working GDC compiler to bootstrap GDC itself. [2]

No idea if it works (as intended) on other archs, I'm primarily trying to get rid of ancient version of llvm in tree (due to ldc).

It's a requirement for bumping ldc (PR 266828) unless acm have something else in mind.

[1] https://gdcproject.org/
[2] https://gcc.gnu.org/gcc-12/changes.html (search for "Building and bootstrapping GDC")

Best regards,
Daniel
Comment 6 commit-hook freebsd_committer freebsd_triage 2022-10-08 10:11:50 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b43fb6ad6184deedb1dcb0193fe1f5c3f1ad071d

commit b43fb6ad6184deedb1dcb0193fe1f5c3f1ad071d
Author:     Lorenzo Salvadore <salvadore@FreeBSD.org>
AuthorDate: 2022-10-07 23:05:08 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2022-10-08 10:10:39 +0000

    lang/gcc11-devel: Update to 11.3.1.s20221007 and enable D lang compiler

    - Update to 11.3.1.s20221007.
    - Enable D lang compiler [1].

    PR:             266825 [1]
    Co-authored-by: Daniel Engberg <diizzy@FreeBSD.org>

 lang/gcc11-devel/Makefile  | 5 +++--
 lang/gcc11-devel/distinfo  | 6 +++---
 lang/gcc11-devel/pkg-plist | 3 +++
 3 files changed, 9 insertions(+), 5 deletions(-)
Comment 7 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-10-08 10:15:36 UTC
Daniel, as you can see I have committed your patch on gcc11-devel with the update to the latest snapshot. With poudriere everything went fine on i386 and amd64 for 12.3 and 13.1. Let's wait a few days to see if there is any package fallout. If all packages build fine as they will probably do, then I will approve your patch for lang/gcc11.

I will deal with higher versions of gcc later.
Comment 8 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-10-12 09:25:29 UTC
I am sorry, but this will require a bit more time than expected: we had a pkg fallout for lang/gcc11-devel on i386 and amd64 for 14.0-CURRENT.

I have already started investigations. Since I have committed your patch simultaneously with an update to the latest snapshot, the fallout might be due to the update and it could be unrelated to the patch. At first glance, it seems to me that it has nothing to do with gdc, but I migt be wrong. I am testing.

If you want to help, it can be useful to test the patch for lang/gcc11 on 14.0-CURRENT.

You can find the logs here:

i386:

Log URL:        http://beefy17.nyi.freebsd.org/data/main-i386-default/pd20a3cf7e848_s91a84eb5ba/logs/gcc11-devel-11.3.1.s20221007.log
Build URL:      http://beefy17.nyi.freebsd.org/build.html?mastername=main-i386-default&build=pd20a3cf7e848_s91a84eb5ba

amd64:

Log URL:        http://beefy18.nyi.freebsd.org/data/main-amd64-default/pd20a3cf7e848_s91a84eb5ba/logs/gcc11-devel-11.3.1.s20221007.log
Build URL:      http://beefy18.nyi.freebsd.org/build.html?mastername=main-amd64-default&build=pd20a3cf7e848_s91a84eb5ba
Comment 9 Daniel Engberg freebsd_committer freebsd_triage 2022-10-14 05:32:03 UTC
Hi,

Sorry for not getting back to you earlier, unfortunately I don't have a 14-CURRENT box and I don't have the hardware for it as my buildbox is already swamped as it is (GCC takes 7+ hours to build on my buildbox). I'll add brooks and acm to this as they probably have a better idea what's going on.

Best regards,
Daniel
Comment 10 commit-hook freebsd_committer freebsd_triage 2022-10-15 11:20:04 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=40332f3e2657aa790e47ed8a02ef20df45c4c61e

commit 40332f3e2657aa790e47ed8a02ef20df45c4c61e
Author:     Lorenzo Salvadore <salvadore@FreeBSD.org>
AuthorDate: 2022-10-15 07:41:16 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2022-10-15 11:19:05 +0000

    lang/gcc11-devel: Update to 11.3.1.s20221014 and disable D lang compiler

    - Update to 11.3.1.s20221014.
    - Revert the patch enabling lang D compiler from commit
      ed30110abbdf17ff5ea8d8104c24af542bf009f4 as it causes a pkg fallout on
      CURRENT for i386 and amd64 architectures. [1]

    PR:             266825 [1]

 lang/gcc11-devel/Makefile  | 5 ++---
 lang/gcc11-devel/distinfo  | 6 +++---
 lang/gcc11-devel/pkg-plist | 3 ---
 3 files changed, 5 insertions(+), 9 deletions(-)
Comment 11 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-10-15 11:58:05 UTC
I have studied the issue and it seems to me that the error is due to the patch enabling GDC. So I have tried to disable it and we will see if things go better and we do not have any pkg fallout anymore. Testing last snapshot of gcc11-devel with poudriere, without the GDC patch, worked on i386 and amd64 for 12.3, 13.1 and 14.0 (however, I have some "mmap of entire address space failed: Cannot allocate memory" on i386 14.0 in stage-qa, but the package is still created and i386 is tier 2 on 14.0 anyway). 

If indeed we do not get any more pkg fallout as I expect, then we need to fix GDC. Your patch seems very simple, I do not think the problem is in there: it is either in FreeBSD 14.0 code (since it works on 12.3 and 13.1) or upstream.
Comment 12 commit-hook freebsd_committer freebsd_triage 2022-10-22 10:38:27 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f61fb49b2e76fd4f7a5b7a11510b5109206c19f2

commit f61fb49b2e76fd4f7a5b7a11510b5109206c19f2
Author:     Lorenzo Salvadore <salvadore@FreeBSD.org>
AuthorDate: 2022-10-22 10:31:35 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2022-10-22 10:37:24 +0000

    lang/gcc11-devel: Update to 11.3.1.s20221021 and enable D lang compiler

    - Update to 11.3.1.s20221021.

    - Enable D lang compiler (second attempt): this time the values in
      libphobos/libdruntime/core/sys/freebsd/config.d have been updated to
      include FreeBSD 14 (CURRENT), and while here the values corresponding
      to FreeBSD 12 and 13 have also been updated to the latest supported
      version [1].

    PR:             266825 [1]
    Co-authored-by: Daniel Engberg <diizzy@FreeBSD.org>

 lang/gcc11-devel/Makefile                                  |  5 +++--
 lang/gcc11-devel/distinfo                                  |  6 +++---
 ...h-libphobos_libdruntime_core_sys_freebsd_config.d (new) | 14 ++++++++++++++
 lang/gcc11-devel/pkg-plist                                 |  3 +++
 4 files changed, 23 insertions(+), 5 deletions(-)
Comment 13 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-10-22 10:40:51 UTC
The commit in comment #12 works fine in poudriere, so I am confident that this time we will not have any package fallout. Assuming that everything goes fine, I will forward the new patch to lang/gcc11 and, possibily, to other versions of gcc as well.
Comment 14 Daniel Engberg freebsd_committer freebsd_triage 2022-10-22 12:01:59 UTC
Thanks for looking into this! =)
Comment 15 commit-hook freebsd_committer freebsd_triage 2022-10-28 14:56:56 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=57936dba89ea208e5dbc1bd2d7fda3d29a1838b3

commit 57936dba89ea208e5dbc1bd2d7fda3d29a1838b3
Author:     Lorenzo Salvadore <salvadore@FreeBSD.org>
AuthorDate: 2022-10-27 21:03:38 +0000
Commit:     Lorenzo Salvadore <salvadore@FreeBSD.org>
CommitDate: 2022-10-28 14:55:48 +0000

    lang/gcc11: Enable D lang compiler

    Forward the part of commit f61fb49b2e76fd4f7a5b7a11510b5109206c19f2 that
    enables D lang compiler.

    PR:             266825
    Co-authored-by: Daniel Engberg <diizzy@FreeBSD.org>

 lang/gcc11/Makefile                                        |  5 +++--
 ...h-libphobos_libdruntime_core_sys_freebsd_config.d (new) | 14 ++++++++++++++
 lang/gcc11/pkg-plist                                       |  3 +++
 3 files changed, 20 insertions(+), 2 deletions(-)
Comment 16 Lorenzo Salvadore freebsd_committer freebsd_triage 2022-10-28 15:00:07 UTC
Last commit should solve your issue with devel/ldc Daniel. I keep the bug open to deal with the other gcc ports, but feel free to remove the PR in the 'Blocks:' field if the problem is indeed solved as far as bug #266826 is concerned.
Comment 17 Daniel Engberg freebsd_committer freebsd_triage 2022-10-28 20:03:08 UTC
Thanks!
Comment 18 Daniel Engberg freebsd_committer freebsd_triage 2023-03-19 09:15:44 UTC
I guess we can close this bug by now?
Comment 19 Lorenzo Salvadore freebsd_committer freebsd_triage 2023-03-19 11:28:00 UTC
(In reply to Daniel Engberg from comment #18)

I was keeping it open as a reminder that we need to plan something about D for GCC > 12, where an existing D compiler will be needed. Probably we should do something similar to what thierry@ did with ada.

We can close this bug report if you prefer: I should remember the issue anyway, and even if we all forget, exp runs should remind us.