I thought I would give the new gcc92 machine a spin and tried bootstrapping gcc on it. Configure was done with ../Gcc/configure --disable-multilib --prefix=$HOME --enable-languages=c,c++,fortran and the last few lines of output were /home/tkoenig/trunk-bin/./gcc/xgcc -B/home/tkoenig/trunk-bin/./gcc/ -B/home/tkoenig/riscv64-unknown-linux-gnu/bin/ -B/home/tkoenig/riscv64-unknown-linux-gnu/lib/ -isystem /home/tkoenig/riscv64-unknown-linux-gnu/include -isystem /home/tkoenig/riscv64-unknown-linux-gnu/sys-include -fno-checking -g -O2 -O2 -g -O2 -DIN_GCC -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fPIC -I. -I. -I../.././gcc -I../../../Gcc/libgcc -I../../../Gcc/libgcc/. -I../../../Gcc/libgcc/../gcc -I../../../Gcc/libgcc/../include -DHAVE_CC_TLS -o _ashrdi3.o -MT _ashrdi3.o -MD -MP -MF _ashrdi3.dep -DL_ashrdi3 -c ../../../Gcc/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS In file included from ../../../Gcc/libgcc/../gcc/tsystem.h:87, from ../../../Gcc/libgcc/libgcc2.c:27: /usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory 27 | #include <bits/libc-header-start.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../../../Gcc/libgcc/../gcc/tsystem.h:87, from ../../../Gcc/libgcc/libgcc2.c:27: /usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory 27 | #include <bits/libc-header-start.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. compilation terminated. In file included from ../../../Gcc/libgcc/../gcc/tsystem.h:87, from ../../../Gcc/libgcc/libgcc2.c:27: /usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory 27 | #include <bits/libc-header-start.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[3]: *** [Makefile:501: _negdi2.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[3]: *** [Makefile:501: _lshrdi3.o] Error 1 make[3]: *** [Makefile:501: _ashldi3.o] Error 1 In file included from ../../../Gcc/libgcc/../gcc/tsystem.h:87, from ../../../Gcc/libgcc/libgcc2.c:27: /usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory 27 | #include <bits/libc-header-start.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[3]: *** [Makefile:501: _ashrdi3.o] Error 1
I suspect configure is not detecting multi-arch correctly or --disable-multilib interacting with multi-arch support which causes things to be broken. OR multi-arch support is not in the riscv backend yet.
(In reply to Andrew Pinski from comment #1) > I suspect configure is not detecting multi-arch correctly or > --disable-multilib interacting with multi-arch support which causes things > to be broken. > OR multi-arch support is not in the riscv backend yet. I get the same result without --disable-multilib.
Gah, I ran into the same issue on gcc92. I 'configure'd '--with-arch=rv64imafdc --with-abi=lp64d --enable-multilib'. (In reply to Andrew Pinski from comment #1) > OR multi-arch support is not in the riscv backend yet. That seems to be the case indeed; at least I'm not seeing any 'if_multiarch' etc. in 'gcc/config/riscv/'. $ find /usr/include/ -name libc-header-start.h /usr/include/riscv64-linux-gnu/bits/libc-header-start.h Also, do potentially further distribution packages have to be installed, for additional multilibs? Like I have on an Ubuntu x86_64 GN/Linux system: $ find /usr/include/ -name libc-header-start.h /usr/include/i386-linux-gnu/bits/libc-header-start.h /usr/include/x86_64-linux-gnu/bits/libc-header-start.h $ dpkg -S /usr/include/i386-linux-gnu/bits/libc-header-start.h /usr/include/x86_64-linux-gnu/bits/libc-header-start.h libc6-dev:i386: /usr/include/i386-linux-gnu/bits/libc-header-start.h libc6-dev:amd64: /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
..., and then I wondered: but how, then, are Debian/Ubuntu building GCC? Per <https://packages.debian.org/experimental/gcc-13>, <http://deb.debian.org/debian/pool/main/g/gcc-13/gcc-13_13.1.0-3.debian.tar.xz>, there is a 'debian/patches/gcc-multiarch.diff' file, which contains "Remaining multiarch patches, not yet submitted upstream", which (amongst others) includes: --- a/src/gcc/config/riscv/t-linux +++ b/src/gcc/config/riscv/t-linux @@ -1,3 +1,5 @@ # Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/ MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES))) MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES)) + +MULTIARCH_DIRNAME := $(call if_multiarch,$(firstword $(subst -, ,$(target)))-linux-gnu)
With the latter hunk applied (plus manual 'rm gcc/s-mlib gcc/multilib.h' to regenerate the latter file), I find that this apparently does only address the '--disable-multilib' case, but not my '--enable-multilib'?
I noticed recent commit r14-3387-g47f95bc4be4eb14730ab3eaaaf8f6e71fda47690 "RISC-V: Add multiarch support on riscv-linux-gnu" -- but can't tell off-hand whether that fixed all the issues here?
(In reply to Thomas Schwinge from comment #6) > I noticed recent commit r14-3387-g47f95bc4be4eb14730ab3eaaaf8f6e71fda47690 > "RISC-V: Add multiarch support on riscv-linux-gnu" -- but can't tell > off-hand whether that fixed all the issues here? As soon as gcc92 is back up, we can test... https://lists.tetaneutral.net/pipermail/cfarm-users/2023-August/000975.html
I wasn't aware of this BZ when I made the commit referenced in c#6. But yes, the whole point of that commit was to fix this problem.
yes, that's one which could be also backported. Let me submit the other bits upstream as well.
There still seems to be something amiss here: I've recently tried bootstrapping trunk on cfarm95: when configuring with just --enable-languages=c++, I got the same error building the stage 1 libgcc: In file included from /home/ro/gcc/src/master/libgcc/../gcc/tsystem.h:95, from /home/ro/gcc/src/master/libgcc/libgcc2.c:27: /usr/include/stdio.h:28:10: fatal error: bits/libc-header-start.h: No such file or directory 28 | #include <bits/libc-header-start.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[3]: *** [Makefile:512: _negdi2.o] Error 1 Isn't this supposed to have been fixed in GCC 14?
this is fixed in the 14 branch and in 15.
also note that the Debian and Ubuntu builds are configured with --disable-multilib
> --- Comment #11 from Matthias Klose <doko at gcc dot gnu.org> --- > this is fixed in the 14 branch and in 15. I know that's the claim; still the error happened when trying to build trunk two days ago.
> --- Comment #12 from Matthias Klose <doko at gcc dot gnu.org> --- > also note that the Debian and Ubuntu builds are configured with > --disable-multilib While I hadn't passed that, the error occured when building the default (64-bit) multilib.
are you able to check this with 24.04 LTS as well?
> --- Comment #15 from Matthias Klose <doko at gcc dot gnu.org> --- > are you able to check this with 24.04 LTS as well? No, the only RISC-V systems I have access to are in the cfarm, none of which run Ubuntu 24.04 AFAICS (mostly Debian).