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.
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
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)...
Created attachment 243670 [details] Poudriere log fragment with the error.
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.
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).
NB: for others: I had to remove the ^M's from the patch to apply it.
(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.
(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.
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.
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...
Created attachment 246629 [details] v0 I don't know what I'm doing but the attached patch allows the build to finish.
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(-)
@salvadore I'm currently conducting a riscv64 build test on lang/gcc13. Do I have permission to enable the arch if it builds fine?
(In reply to Robert Clausecker from comment #13) Gcc13 fails the samedi, still needs the patch @comment 11
(In reply to Mikael Urankar from comment #14) gcc13 builds fine for me on riscv64 15-CURRENT. Testing gcc12 next.
(In reply to Robert Clausecker from comment #13) Sure! Feel free to commit whatever you need to get riscv support. Thanks!
(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= ...
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(-)
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(-)
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(-)
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(-)
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(-)
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(-)
gcc11/12/13 have been enabled for riscv64 following succesful build testing. I hope that addresses your issue.
Why was it closed? It's still an issue for 14.0 and earlier version.
(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?
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(-)
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(-)
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(-)
(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?
(In reply to Robert Clausecker from comment #30) gcc12 builds fine, thanks.