Bug 272759 - lang/gcc12: Only for arches not including riscv (blocks 310 packages on my list)
Summary: lang/gcc12: Only for arches not including riscv (blocks 310 packages on my list)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: riscv Any
: --- Affects Many People
Assignee: Robert Clausecker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-27 16:29 UTC by dgilbert
Modified: 2024-05-27 06:40 UTC (History)
7 users (show)

See Also:
salvadore: maintainer-feedback+


Attachments
Poudriere log fragment with the error. (6.24 KB, text/plain)
2023-07-28 17:42 UTC, dgilbert
no flags Details
Proposed fix (958 bytes, patch)
2023-07-28 18:11 UTC, Jessica Clarke
no flags Details | Diff
v0 (5.99 KB, patch)
2023-11-28 07:54 UTC, Mikael Urankar
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description dgilbert 2023-07-27 16:29:45 UTC
poudriere build for gcc12 fails:

is only for aarch64 amd64 arm armv6 armv7 i386 powerpc powerpc64 powerpc64le, while you are running riscv64

This failure then skips 310 more packages in my list.

Now... gcc12 clearly _does_ support riscv... so that's one fix.  Alternatively (I wouldn't care) things that require gcc to build could require a gcc that does build in poudriere on FreebSD.
Comment 1 dgilbert 2023-07-28 17:36:41 UTC
So I made the obvious patch to allow arch riscv64 in the FreeBSD port Makefile.  After some hours of poudriere churning, I get a raft of errors from libgfortran:

In file included from /wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/libgfortran/runtime/fpu.c:29:
[06:39:04] ./fpu-target.h:44:3: error: unknown type name 'choke'
[06:39:04]    44 |   choke me
[06:39:04]       |   ^~~~~

... it goes on, but you can look it up in the attached poudriere log.

This poudriere log was made on a riscv unmatched with the following kernel and userland:

FreeBSD ump.daveg.ca 14.0-CURRENT FreeBSD 14.0-CURRENT riscv64 1400093 #0 main-n264297-b03012d0b600-dirty: Wed Jul 26 04:04:24 EDT 2023     root@ump.daveg.ca:/usr/obj/usr/src/riscv.riscv64/sys/GENERIC riscv
Comment 2 dgilbert 2023-07-28 17:39:25 UTC
Well... that build log is too big.  This is my poudriere link to the log:

https://riscv.daveg.ca/data/freebsd14-HEAD/2023-07-27_17h44m41s/logs/errors/gcc12-12.2.0_6.log

Since the whole log is too big, I will cut out the relevant section and upload that as a long (since the bug tracking is more permanent a record than my poudriere logs)...
Comment 3 dgilbert 2023-07-28 17:42:12 UTC
Created attachment 243670 [details]
Poudriere log fragment with the error.
Comment 4 Jessica Clarke freebsd_committer freebsd_triage 2023-07-28 17:57:08 UTC
If you follow it back, normally on FreeBSD we (confusingly) use fpu-glibc.h for cpu-target.h, but that requires feenableexcept to exist. However, riscv64 has feenableexcept as a static inline function in its fenv.h, and GCC's configure scripts aren't prepared for that, so they think it doesn't exist, fall back on fpu-sysv.h and then the build dies because riscv64 (like every non-x86 architecture) doesn't implement either of fp(re)setsticky.
Comment 5 Jessica Clarke freebsd_committer freebsd_triage 2023-07-28 18:11:15 UTC
Created attachment 243671 [details]
Proposed fix

Can you confirm whether the attached fixes the issue? This should match the semantics of glibc's implementation (we shouldn't be reporting success when asked to actually enable exceptions), and aligns symbol exporting with x86 and powerpc (though arm also exports fegetexcept, and aarch64 doesn't export any of them like current riscv (libgfortran has its own aarch64-specific implementation so nobody noticed), so the situation is a bit inconsistent and unprincipled).
Comment 6 dgilbert 2023-07-28 18:34:44 UTC
NB: for others: I had to remove the ^M's from the patch to apply it.
Comment 7 Jessica Clarke freebsd_committer freebsd_triage 2023-07-28 18:37:45 UTC
(In reply to dgilbert from comment #6)

Depending on how you download the patch, Bugzilla helpfully does that. Copying from https://bugs.freebsd.org/bugzilla/attachment.cgi?id=243671&action=edit avoids the issue.
Comment 8 Piotr Kubaj freebsd_committer freebsd_triage 2023-07-29 08:06:11 UTC
(In reply to Jessica Clarke from comment #4)
We had exactly the same issue on powerpc*, it was fixed in https://cgit.freebsd.org/src/commit/?id=448c505c33cc334193590f3844406d6a74f26e2a.
There's still time to do the same for riscv64 before releng/14.0.
Comment 9 Lorenzo Salvadore freebsd_committer freebsd_triage 2023-07-29 09:45:48 UTC
Please note that riscv64 is not a tier 1 platform at the moment: it is a tier 3 platform on FreeBSD 12 and tier 2 on FreeBSD 13 and 14, so support is limited.
https://www.freebsd.org/platforms/

Unfortunately I lack the resources for testing riscv64 too properly, so please feel free to propose patches, test them and commit them.

Also please note that the issue described here most probably involves GCC 12 as default GCC version, but I am planning to switch it to GCC 13 soon, so you should probably fix lang/gcc13 as well. Fixing lang/gcc14-devel could also be helpful for the future as lang/gcc14 will be created from lang/gcc14-devel when GCC 14 will be released (it will not happen soon).

Thanks.
Comment 10 Gerald Pfeifer freebsd_committer freebsd_triage 2023-08-27 20:35:50 UTC
I recommend making GCC 13 the GCC_DEFAULT for riscv64 right away,
ahead of changing the default for other architectures, and focus
on that.

Nothing to lose, possibly something to winn...
Comment 11 Mikael Urankar freebsd_committer freebsd_triage 2023-11-28 07:54:11 UTC
Created attachment 246629 [details]
v0

I don't know what I'm doing but the attached patch allows the build to finish.
Comment 12 commit-hook freebsd_committer freebsd_triage 2024-03-21 23:50:44 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=1947a9383ec3a048e334022365aa199a6ae55289

commit 1947a9383ec3a048e334022365aa199a6ae55289
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2024-03-21 23:45:53 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2024-03-21 23:48:37 +0000

    msun/riscv: expose fe{disable,enable}except

    This is required for GCC to build.

    PR:             272759
    Reported by:    dgilbert@eicat.ca
    Submitted by:   jrtc27
    Differential Revision:  https://reviews.freebsd.org/D44333

 lib/msun/riscv/Symbol.map | 10 ++++------
 lib/msun/riscv/fenv.h     |  7 +++----
 2 files changed, 7 insertions(+), 10 deletions(-)
Comment 13 Robert Clausecker freebsd_committer freebsd_triage 2024-05-11 21:26:32 UTC
@salvadore I'm currently conducting a riscv64 build test on lang/gcc13.  Do I have permission to enable the arch if it builds fine?
Comment 14 Mikael Urankar freebsd_committer freebsd_triage 2024-05-12 06:29:05 UTC
(In reply to Robert Clausecker from comment #13)
Gcc13 fails the samedi, still needs the patch @comment 11
Comment 15 Robert Clausecker freebsd_committer freebsd_triage 2024-05-12 07:56:02 UTC
(In reply to Mikael Urankar from comment #14)

gcc13 builds fine for me on riscv64 15-CURRENT.
Testing gcc12 next.
Comment 16 Lorenzo Salvadore freebsd_committer freebsd_triage 2024-05-12 09:03:16 UTC
(In reply to Robert Clausecker from comment #13)

Sure! Feel free to commit whatever you need to get riscv support.
Thanks!
Comment 17 Robert Clausecker freebsd_committer freebsd_triage 2024-05-12 09:22:29 UTC
(In reply to Lorenzo Salvadore from comment #16)

Thanks, will do.  I suppose the build on FreeBSD 13 will still be broken as the patch has not been merged into stable/13, but I can't test that right now.  If there's any fallout, it might make sense to just mark the port as

    BROKEN_FreeBSD_13_riscv64= ...
Comment 18 commit-hook freebsd_committer freebsd_triage 2024-05-13 21:22:47 UTC
A commit in branch main references this bug:

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

commit 16ebcbbc24a6fca734affcd38a2b3dba29a9145d
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2024-05-12 09:27:35 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2024-05-13 21:19:50 +0000

    lang/gcc13: enable on riscv64

    Builds fine on 15-CURRENT.

    PR:             272759
    Approved by:    salvadore (maintainer)
    MFH:            2024Q2

 lang/gcc13/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 19 commit-hook freebsd_committer freebsd_triage 2024-05-13 21:22:48 UTC
A commit in branch main references this bug:

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

commit f040d259aeda3ec5cd7c440c8f03364bdcac9311
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2024-05-12 18:55:24 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2024-05-13 21:19:50 +0000

    lang/gcc12: enable for riscv64

    Builds fine on riscv64 15-CURRENT.

    PR:             272759
    Approved by:    salvadore (maintainer)
    MFH:            2024Q2

 lang/gcc12/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 20 commit-hook freebsd_committer freebsd_triage 2024-05-13 21:22:58 UTC
A commit in branch main references this bug:

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

commit 936504b6bbea6d54a74e46820aead68a34a85021
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2024-05-12 23:49:22 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2024-05-13 21:19:49 +0000

    lang/gcc11: enable on riscv64

    Builds fine on 15-CURRENT.

    PR:             272759
    Approved by:    salvadore (maintainer)
    MFH:            2024Q2

 lang/gcc11/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 21 commit-hook freebsd_committer freebsd_triage 2024-05-13 21:24:04 UTC
A commit in branch 2024Q2 references this bug:

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

commit e19b50accd34d4604bab6729f55c702fe5992622
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2024-05-12 23:49:22 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2024-05-13 21:23:07 +0000

    lang/gcc11: enable on riscv64

    Builds fine on 15-CURRENT.

    PR:             272759
    Approved by:    salvadore (maintainer)
    MFH:            2024Q2

    (cherry picked from commit 936504b6bbea6d54a74e46820aead68a34a85021)

 lang/gcc11/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 22 commit-hook freebsd_committer freebsd_triage 2024-05-13 21:24:06 UTC
A commit in branch 2024Q2 references this bug:

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

commit a9c7a01ff01411690f08d084ecba3bf3cdb87f92
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2024-05-12 09:27:35 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2024-05-13 21:23:07 +0000

    lang/gcc13: enable on riscv64

    Builds fine on 15-CURRENT.

    PR:             272759
    Approved by:    salvadore (maintainer)
    MFH:            2024Q2

    (cherry picked from commit 16ebcbbc24a6fca734affcd38a2b3dba29a9145d)

 lang/gcc13/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 23 commit-hook freebsd_committer freebsd_triage 2024-05-13 21:24:07 UTC
A commit in branch 2024Q2 references this bug:

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

commit 6d2593199d1e82b25c0156d930fea95a413dbeec
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2024-05-12 18:55:24 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2024-05-13 21:23:07 +0000

    lang/gcc12: enable for riscv64

    Builds fine on riscv64 15-CURRENT.

    PR:             272759
    Approved by:    salvadore (maintainer)
    MFH:            2024Q2

    (cherry picked from commit f040d259aeda3ec5cd7c440c8f03364bdcac9311)

 lang/gcc12/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 24 Robert Clausecker freebsd_committer freebsd_triage 2024-05-13 21:29:40 UTC
gcc11/12/13 have been enabled for riscv64 following succesful build testing.  I hope that addresses your issue.
Comment 25 Mikael Urankar freebsd_committer freebsd_triage 2024-05-14 06:55:33 UTC
Why was it closed? It's still an issue for 14.0 and earlier version.
Comment 26 Robert Clausecker freebsd_committer freebsd_triage 2024-05-14 07:47:01 UTC
(In reply to Mikael Urankar from comment #25)

Fair enough, reopening.

@brooks, has your commit been merged into stable/14?  If yes, could you look into that before 14.1 is out?
Comment 27 commit-hook freebsd_committer freebsd_triage 2024-05-20 21:16:21 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=7ad17751074ca79a89ca503f5ac647819579e858

commit 7ad17751074ca79a89ca503f5ac647819579e858
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2024-03-21 23:45:53 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2024-05-20 20:49:06 +0000

    msun/riscv: expose fe{disable,enable}except

    This is required for GCC to build.

    PR:             272759
    Reported by:    dgilbert@eicat.ca
    Submitted by:   jrtc27
    Differential Revision:  https://reviews.freebsd.org/D44333

    (cherry picked from commit 1947a9383ec3a048e334022365aa199a6ae55289)

 lib/msun/riscv/Symbol.map | 10 ++++------
 lib/msun/riscv/fenv.h     |  7 +++----
 2 files changed, 7 insertions(+), 10 deletions(-)
Comment 28 commit-hook freebsd_committer freebsd_triage 2024-05-20 22:24:43 UTC
A commit in branch releng/14.1 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=07f986601620e6edee11a7000af681c1cc135403

commit 07f986601620e6edee11a7000af681c1cc135403
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2024-03-21 23:45:53 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2024-05-20 22:23:30 +0000

    msun/riscv: expose fe{disable,enable}except

    This is required for GCC to build.

    PR:             272759
    Reported by:    dgilbert@eicat.ca
    Approved by:    re (cperciva)
    Submitted by:   jrtc27
    Differential Revision:  https://reviews.freebsd.org/D44333

    (cherry picked from commit 1947a9383ec3a048e334022365aa199a6ae55289)
    (cherry picked from commit 7ad17751074ca79a89ca503f5ac647819579e858)

 lib/msun/riscv/Symbol.map | 10 ++++------
 lib/msun/riscv/fenv.h     |  7 +++----
 2 files changed, 7 insertions(+), 10 deletions(-)
Comment 29 commit-hook freebsd_committer freebsd_triage 2024-05-21 00:05:53 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=364133901a8dcd228e975e88ded0c3f624992150

commit 364133901a8dcd228e975e88ded0c3f624992150
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2024-03-21 23:45:53 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2024-05-20 22:26:02 +0000

    msun/riscv: expose fe{disable,enable}except

    This is required for GCC to build.

    PR:             272759
    Reported by:    dgilbert@eicat.ca
    Submitted by:   jrtc27
    Differential Revision:  https://reviews.freebsd.org/D44333

    (cherry picked from commit 1947a9383ec3a048e334022365aa199a6ae55289)

 lib/msun/riscv/Symbol.map | 10 ++++------
 lib/msun/riscv/fenv.h     |  7 +++----
 2 files changed, 7 insertions(+), 10 deletions(-)
Comment 30 Robert Clausecker freebsd_committer freebsd_triage 2024-05-25 14:59:54 UTC
(In reply to Mikael Urankar from comment #25)

With the backports, this should now be fixed in 14.1.  Could you confirm please and close the bug if so?
Comment 31 Mikael Urankar freebsd_committer freebsd_triage 2024-05-27 06:40:12 UTC
(In reply to Robert Clausecker from comment #30)
gcc12 builds fine, thanks.