Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 890636 - sys-devel/gcc-12.2.1_p20221231 fails during bootstrap stage 2: cannot find bits/libc-header-start.h
Summary: sys-devel/gcc-12.2.1_p20221231 fails during bootstrap stage 2: cannot find bi...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: riscv Linux
: Normal normal (vote)
Assignee: Gentoo Prefix
URL: https://gcc.gnu.org/bugzilla/show_bug...
Whiteboard:
Keywords:
: 923410 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-01-13 09:38 UTC by Bob Dröge
Modified: 2024-02-28 00:34 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
GCC build logs (gcc-build-logs.tar.xz,96.19 KB, application/x-xz)
2023-01-13 09:39 UTC, Bob Dröge
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bob Dröge 2023-01-13 09:38:32 UTC
I'm trying to do a Prefix bootstrap on a Starfive VisionFive 2 (RISC-V), and during the 2nd stage the build of sys-devel/gcc-12.2.1_p20221231 fails due to:

In file included from /nvme/gentoo/tmp/var/tmp/portage/sys-devel/gcc-12.2.1_p20221231/work/gcc-12-20221231/libgcc/../gcc/tsystem.h:87,
                 from /nvme/gentoo/tmp/var/tmp/portage/sys-devel/gcc-12.2.1_p20221231/work/gcc-12-20221231/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.

The file is available (on the host, at least; I don't know if it should be somewhere in the Prefix build dir?) in:
/usr/include/riscv64-linux-gnu/bits/libc-header-start.h


Reproducible: Always
Comment 1 Bob Dröge 2023-01-13 09:39:11 UTC
Created attachment 848348 [details]
GCC build logs
Comment 2 Jakov Smolić archtester gentoo-dev 2024-02-04 01:22:39 UTC
*** Bug 923410 has been marked as a duplicate of this bug. ***
Comment 3 Julián 2024-02-14 11:47:39 UTC
I think the problem comes from this bug in GCC:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106271

Actually, I see that the file:

gentoo/tmp/var/tmp/portage/sys-devel/gcc-13.2.1_p20240113-r1/work/gcc-13-20240113/gcc/config/riscv/t-linux 

looks like:

# 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))

So, probably applying this patch: 

https://gcc.gnu.org/git/?p=gcc.git;a=blobdiff;f=gcc/config/riscv/t-linux;h=a6f64f88d25c989159207cbef19778b703c95797;hp=216d2776a183d13ade76642b73b9bf04b0c4694e;hb=47f95bc4be4eb14730ab3eaaaf8f6e71fda47690;hpb=0698c9fddfc5a41dd7f233928b7a486cb044fea3

would solve the problem.
Comment 4 Fabian Groffen gentoo-dev 2024-02-17 10:19:45 UTC
Do we know if applying this patch actually makes the compilation go through?
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-02-18 06:47:54 UTC
Happy to add it to patchset etc if it's confirmed to work.
Comment 6 Julián 2024-02-19 13:01:40 UTC
(In reply to Fabian Groffen from comment #4)
> Do we know if applying this patch actually makes the compilation go through?

Yes, I added the line manually after the bootstrap script downloads and decompress gcc and the compilation definitely goes through this point.
Comment 7 Julián 2024-02-27 13:25:16 UTC
(In reply to Fabian Groffen from comment #4)
> Do we know if applying this patch actually makes the compilation go through?

Yes, I can confirm that applying this patch makes the compilation go through :)
Comment 8 Julián 2024-02-27 13:26:31 UTC
(In reply to Sam James from comment #5)
> Happy to add it to patchset etc if it's confirmed to work.

It would be great if you can add it to patchset, I can confirm that it works.
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-02-28 00:21:13 UTC
OK, will do. Thanks!
Comment 10 Larry the Git Cow gentoo-dev 2024-02-28 00:29:45 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=d5e5f9b252f00c9485c34446efc01bdd2eaaa9b1

commit d5e5f9b252f00c9485c34446efc01bdd2eaaa9b1
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-02-28 00:28:36 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-02-28 00:29:43 +0000

    13.2.0: add 91_all_riscv_PR106271-multilib-bootstrap.patch
    
    Fixes prefix bootstrap for riscv.
    
    Bug: https://gcc.gnu.org/PR106271
    Bug: https://bugs.gentoo.org/890636
    Signed-off-by: Sam James <sam@gentoo.org>

 .../91_all_riscv_PR106271-multilib-bootstrap.patch | 37 ++++++++++++++++++++++
 13.2.0/gentoo/README.history                       |  4 +++
 2 files changed, 41 insertions(+)

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=f373ff919da62443ca59681f219b4899e72a6f2f

commit f373ff919da62443ca59681f219b4899e72a6f2f
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-02-28 00:27:00 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-02-28 00:29:43 +0000

    12.3.0: add 77_all_riscv_PR106271-multilib-bootstrap.patch
    
    Fixes prefix bootstrap for riscv.
    
    Bug: https://gcc.gnu.org/PR106271
    Bug: https://bugs.gentoo.org/890636
    Signed-off-by: Sam James <sam@gentoo.org>

 .../77_all_riscv_PR106271-multilib-bootstrap.patch | 36 ++++++++++++++++++++++
 12.3.0/gentoo/README.history                       |  5 +++
 2 files changed, 41 insertions(+)
Comment 11 Larry the Git Cow gentoo-dev 2024-02-28 00:34:08 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7d55c7c1d2d179894998a18dc311714e05f0d913

commit 7d55c7c1d2d179894998a18dc311714e05f0d913
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-02-28 00:33:40 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-02-28 00:33:40 +0000

    sys-devel/gcc: fix prefix riscv bootstrap for 13
    
    Fixes prefix bootstrap for riscv.
    
    Bug: https://gcc.gnu.org/PR106271
    Closes: https://bugs.gentoo.org/890636
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/gcc/Manifest                    | 2 +-
 sys-devel/gcc/gcc-13.2.1_p20240210.ebuild | 2 +-
 sys-devel/gcc/gcc-13.2.1_p20240224.ebuild | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1849c746cd35fb74c6014d1bfd2b1e287bad0a0f

commit 1849c746cd35fb74c6014d1bfd2b1e287bad0a0f
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-02-28 00:32:14 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-02-28 00:32:14 +0000

    sys-devel/gcc: fix prefix riscv bootstrap for 12
    
    Fixes prefix bootstrap for riscv.
    
    Bug: https://gcc.gnu.org/PR106271
    Bug: https://bugs.gentoo.org/890636
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/gcc/Manifest                    | 1 +
 sys-devel/gcc/gcc-12.3.1_p20240209.ebuild | 2 +-
 sys-devel/gcc/gcc-12.3.1_p20240223.ebuild | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)