Build failure: gcc
fails to compile on linux when nixpkgs is configured to cross-compile back to the same system and libcCross
does not contain passthru.libgcc
#263040
Labels
0.kind: build failure
6.topic: cross-compilation
Building packages on a different sort platform than than they will be run on
GCC fails to compile when nixpkgs is configured to cross-compile back to the same system and
libcCross
does not containpassthru.libgcc
. Most of the GCC build determines whether it's cross-compiling by testing iftargetPlatform != hostPlatform
, butpreFixupLibGccPhase
instead testshostPlatform.config != targetPlatform.config
. This means that when building under these circumstances it does most of the build and then fails to findlibgcc_s.so
as it's looking in the wrong place. ThepreFixupLibGccPhase
code needs to use the same test as the code that definestargetConfig
.This isn't normally noticed as
glibcCross
includespassthru.libgcc
, but if I usecrossOverlays
to replace it with a libc that does not have this passthru, that's when GCC breaks. This is blocking me as I am attempting to backdate glibc to an older version that doesn't bundle libgcc (for symbol versioning reasons).targetConfig
definition:nixpkgs/pkgs/development/compilers/gcc/default.nix
Line 356 in 38d33bc
preFixupLibGccPhase
tests:nixpkgs/pkgs/development/compilers/gcc/common/libgcc.nix
Lines 38 to 41 in ca03f20
nixpkgs/pkgs/development/compilers/gcc/common/libgcc.nix
Lines 86 to 89 in ca03f20
Steps To Reproduce
Build log
Relevant output from the end of the log:
Notice now the
libgcc_s.so.1
path includes the target config in the lib path, but thepreFixupLibGccPhase
tries to look for it without the target config.Additional context
If I override the package to set
targetConfig
tonull
it seems to skip buildinglibgcc_s.so
entirely, so it looks like thetargetConfig
definition is correct and thelibgcc.nix
code needs to be updated to use the same test (or possibly to just check iftargetConfig != null
instead of trying to independently test for cross-compilation).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: