Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 829955

Summary: sys-devel/gcc: fails when building on NixOS during bootstrap (cc1: error: no include path in which to search for stdc-predef.h) (tries to use system /usr/include?)
Product: Gentoo/Alt Reporter: Fabian Leimgruber <fabio.leimgruber>
Component: Prefix SupportAssignee: Gentoo Prefix <prefix>
Status: UNCONFIRMED ---    
Severity: normal CC: atharvaamritkar, fabio.leimgruber, sam
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Configuration of gcc
Last 90 lines of error log

Description Fabian Leimgruber 2021-12-25 10:30:44 UTC
Running `bootstrap-prefix.sh` on NixOS errors in stage2 building gcc with the error: "cc1: error: no include path in which to search for stdc-predef.h".

This is how GCC was configured: https://pastebin.com/yAnHj840

Last 100 lines from log: https://pastebin.com/UHUBeuXh

As noted on IRC the problem is:

"The directory that should contain system headers does not exist:
  /usr/include"

Which indeed does not exist on a NixOS host system.

For reference, this is the Nix derivation (recipe) for building gcc on NixOS: https://github.com/NixOS/nixpkgs/blob/a0dbe47318bbab7559ffbfa7c4872a517833409f/pkgs/development/compilers/gcc/10/default.nix

Maybe related: https://bugs.gentoo.org/681742
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-25 10:34:16 UTC
Thanks a lot! Could I bother you to compress the logs and attach them to the bug for posterity?
Comment 2 Fabian Leimgruber 2021-12-25 10:38:55 UTC
> Thanks a lot! Could I bother you to compress the logs and attach them to the bug for posterity?

Sure, what is the preferred/standard compression for this bug tracker?
Comment 3 Fabian Leimgruber 2021-12-25 10:44:27 UTC
Created attachment 760190 [details]
Configuration of gcc
Comment 4 Fabian Leimgruber 2021-12-25 10:45:20 UTC
Created attachment 760191 [details]
Last 90 lines of error log
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-25 10:50:38 UTC
(In reply to fabio.leimgruber from comment #2)
> > Thanks a lot! Could I bother you to compress the logs and attach them to the bug for posterity?
> 
> Sure, what is the preferred/standard compression for this bug tracker?

I usually do bzip2 but anything "normal" is fine!
Comment 6 Fabian Leimgruber 2021-12-25 10:59:22 UTC
> I usually do bzip2 but anything "normal" is fine!

Ok, added with `xz` as described in https://wiki.gentoo.org/wiki/Attach_the_logs_to_the_bug_ticket.
Comment 7 Fabian Leimgruber 2021-12-27 11:20:01 UTC
I understand this might be quite low priority, but I would be interested in assisting and getting into dev and bug fixing workflows on Gentoo. I don't know how soon others with a NixOS system can test themselves, so in the meantime I could support with further debugging and testing at least to zone in on the root cause? In case there is interest, and for a deeper look, you can also reach me via mail directly.
Comment 8 Fabian Groffen gentoo-dev 2021-12-27 18:39:49 UTC
sounds like this would need a setup like on macOS, where the whole system root lives in a different place than /
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-28 02:05:58 UTC
(In reply to Fabian Groffen from comment #8)
> sounds like this would need a setup like on macOS, where the whole system
> root lives in a different place than /

Right.

We currently do:
$ grep -rsin "with-native-system-header-dir" ~/git/prefix
/home/sam/git/prefix/eclass/toolchain.eclass:1007:				confgcc+=( --with-native-system-header-dir="${EPREFIX}/MacOSX.sdk/usr/include" )

We want some sort of equivalent for nix, I guess. I'm not sure how we discover the right path though.

(In reply to Fabian Leimgruber from comment #7)
> I understand this might be quite low priority, but I would be interested in
> assisting and getting into dev and bug fixing workflows on Gentoo. I don't
> know how soon others with a NixOS system can test themselves, so in the
> meantime I could support with further debugging and testing at least to zone
> in on the root cause? In case there is interest, and for a deeper look, you
> can also reach me via mail directly.

That'd be great! I think the best thing to do for now is play with the above ^ / what grobian suggests. You may also need to copy some of the SDK piping within bootstrap-prefix.sh that we do for macOS.
Comment 10 Fabian Groffen gentoo-dev 2021-12-28 07:53:11 UTC
step one is how do we figure out we're on NixOS

step two is how do we figure out where the system headers/libs are