GCC can't find libstdc++ headers when cross-compiling back to same platform #264865
Labels
0.kind: bug
Something is broken
6.topic: cross-compilation
Building packages on a different platform than they will be used on
Describe the bug
When cross-compiling back to the same platform, such as with
pkgsLLVM.buildPackages.gcc
, GCC can't find its own libstdc++ headers. If I look atpkgsLLVM.buildPackages.gcc.cc
theinclude/
folder is empty and the libstdc++ headers are instead found inx86_64-unknown-linux-gnu/include/c++/12.3.0/
. However, GCC doesn't actually look there. If I ask GCC to print its include paths withecho | result/bin/x86_64-unknown-linux-gnu-g++ -xc++ -E -v -
it saysWhen I compare this with a non-cross-compiled gcc the headers are all in
include/c++/12.3.0/
and the same command printsSteps To Reproduce
Working example:
That should print the contents of the iostream header.
Broken example:
This produces the following:
Additional context
I don't know if the problem is that the headers are in the wrong place, or if GCC is looking in the wrong place. It seems reasonable for GCC to conclude that because the target platform config matches the host platform config that it doesn't need the target-prefixed path, but I haven't managed to find any code on the Nix side that moves the includes so I think the GCC build process is putting them there and then forgetting about it.
My example here uses
pkgsLLVM
for convenience, but in my actual code I'm using cross-compiling with a different dummycrossSystem
key in order to replace glibc usingcrossOverlays
.Notify maintainers
@Synthetica9 @vcunat @Ericson2314
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.The text was updated successfully, but these errors were encountered: