libcCross: Remove! (#414321)

This commit is contained in:
John Ericson 2025-06-06 14:10:32 -04:00 committed by GitHub
commit bfc3acf8f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 115 additions and 111 deletions

View file

@ -53,7 +53,7 @@ python3.pkgs.buildPythonApplication rec {
pkgsCross.avr.buildPackages.binutils pkgsCross.avr.buildPackages.binutils
pkgsCross.avr.buildPackages.binutils.bintools pkgsCross.avr.buildPackages.binutils.bintools
pkgsCross.avr.buildPackages.gcc pkgsCross.avr.buildPackages.gcc
pkgsCross.avr.libcCross pkgsCross.avr.libc
]; ];
# no tests implemented # no tests implemented

View file

@ -14,7 +14,7 @@
libxslt, libxslt,
libxcrypt, libxcrypt,
pkg-config, pkg-config,
glibcCross ? null, glibc ? null,
pam ? null, pam ? null,
withLibbsd ? lib.meta.availableOn stdenv.hostPlatform libbsd, withLibbsd ? lib.meta.availableOn stdenv.hostPlatform libbsd,
libbsd, libbsd,
@ -24,7 +24,7 @@
let let
glibc = glibc =
if stdenv.hostPlatform != stdenv.buildPlatform then if stdenv.hostPlatform != stdenv.buildPlatform then
glibcCross glibc
else else
assert stdenv.hostPlatform.libc == "glibc"; assert stdenv.hostPlatform.libc == "glibc";
stdenv.cc.libc; stdenv.cc.libc;

View file

@ -2,10 +2,9 @@
lib, lib,
stdenv, stdenv,
pkgs, pkgs,
targetPackages,
callPackage, callPackage,
isl_0_20, isl_0_20,
libcCross,
threadsCross,
noSysDirs, noSysDirs,
lowPrio, lowPrio,
wrapCC, wrapCC,
@ -27,9 +26,15 @@ let
reproducibleBuild = true; reproducibleBuild = true;
profiledCompiler = false; profiledCompiler = false;
libcCross = libcCross =
if !lib.systems.equals stdenv.targetPlatform stdenv.buildPlatform then args.libcCross else null; if !lib.systems.equals stdenv.targetPlatform stdenv.buildPlatform then
targetPackages.libc or pkgs.libc
else
null;
threadsCross = threadsCross =
if !lib.systems.equals stdenv.targetPlatform stdenv.buildPlatform then threadsCross else { }; if !lib.systems.equals stdenv.targetPlatform stdenv.buildPlatform then
targetPackages.threads or pkgs.threads
else
{ };
isl = if stdenv.hostPlatform.isDarwin then null else isl_0_20; isl = if stdenv.hostPlatform.isDarwin then null else isl_0_20;
# do not allow version skew when cross-building gcc # do not allow version skew when cross-building gcc
# #

View file

@ -38,7 +38,7 @@
enablePlugin ? (lib.systems.equals stdenv.hostPlatform stdenv.buildPlatform), # Whether to support user-supplied plug-ins enablePlugin ? (lib.systems.equals stdenv.hostPlatform stdenv.buildPlatform), # Whether to support user-supplied plug-ins
name ? "gcc", name ? "gcc",
libcCross ? null, libcCross ? null,
threadsCross ? null, # for MinGW threadsCross ? { }, # for MinGW
withoutTargetLibc ? false, withoutTargetLibc ? false,
flex, flex,
gnused ? null, gnused ? null,

View file

@ -8,7 +8,7 @@
mailcap, mailcap,
buildPackages, buildPackages,
pkgsBuildTarget, pkgsBuildTarget,
threadsCross, targetPackages,
testers, testers,
skopeo, skopeo,
buildGo123Module, buildGo123Module,
@ -42,7 +42,7 @@ stdenv.mkDerivation (finalAttrs: {
depsBuildTarget = lib.optional isCross targetCC; depsBuildTarget = lib.optional isCross targetCC;
depsTargetTarget = lib.optional stdenv.targetPlatform.isWindows threadsCross.package; depsTargetTarget = lib.optional stdenv.targetPlatform.isWindows targetPackages.threads.package;
postPatch = '' postPatch = ''
patchShebangs . patchShebangs .

View file

@ -8,7 +8,7 @@
mailcap, mailcap,
buildPackages, buildPackages,
pkgsBuildTarget, pkgsBuildTarget,
threadsCross, targetPackages,
testers, testers,
skopeo, skopeo,
buildGo124Module, buildGo124Module,
@ -42,7 +42,7 @@ stdenv.mkDerivation (finalAttrs: {
depsBuildTarget = lib.optional isCross targetCC; depsBuildTarget = lib.optional isCross targetCC;
depsTargetTarget = lib.optional stdenv.targetPlatform.isWindows threadsCross.package; depsTargetTarget = lib.optional stdenv.targetPlatform.isWindows targetPackages.threads.package;
postPatch = '' postPatch = ''
patchShebangs . patchShebangs .

View file

@ -2,9 +2,9 @@
lowPrio, lowPrio,
newScope, newScope,
pkgs, pkgs,
targetPackages,
lib, lib,
stdenv, stdenv,
preLibcCrossHeaders,
libxcrypt, libxcrypt,
substitute, substitute,
replaceVars, replaceVars,
@ -255,7 +255,7 @@ let
bintoolsNoLibc = wrapBintoolsWith { bintoolsNoLibc = wrapBintoolsWith {
bintools = tools.bintools-unwrapped; bintools = tools.bintools-unwrapped;
libc = preLibcCrossHeaders; libc = targetPackages.preLibcHeaders;
}; };
bintools = wrapBintoolsWith { bintools = tools.bintools-unwrapped; }; bintools = wrapBintoolsWith { bintools = tools.bintools-unwrapped; };

View file

@ -2,10 +2,10 @@
lib, lib,
stdenv, stdenv,
buildPackages, buildPackages,
pkgs,
newScope, newScope,
overrideCC, overrideCC,
stdenvNoLibc, stdenvNoLibc,
libcCross,
}: }:
lib.makeScope newScope ( lib.makeScope newScope (
@ -31,9 +31,9 @@ lib.makeScope newScope (
else else
buildPackages.gccWithoutTargetLibc.override (old: { buildPackages.gccWithoutTargetLibc.override (old: {
bintools = old.bintools.override { bintools = old.bintools.override {
libc = libcCross; libc = pkgs.libc;
}; };
libc = libcCross; libc = pkgs.libc;
}) })
); );

View file

@ -320,7 +320,6 @@ mapAliases {
autoadb = throw "'autoadb' has been removed due to lack of maintenance upstream"; # Added 2025-01-25 autoadb = throw "'autoadb' has been removed due to lack of maintenance upstream"; # Added 2025-01-25
avldrums-lv2 = throw "'avldrums-lv2' has been renamed to/replaced by 'x42-avldrums'"; # Converted to throw 2024-10-17 avldrums-lv2 = throw "'avldrums-lv2' has been renamed to/replaced by 'x42-avldrums'"; # Converted to throw 2024-10-17
avr-sim = throw "'avr-sim' has been removed as it was broken and unmaintained. Possible alternatives are 'simavr', SimulAVR and AVRStudio."; # Added 2025-05-31 avr-sim = throw "'avr-sim' has been removed as it was broken and unmaintained. Possible alternatives are 'simavr', SimulAVR and AVRStudio."; # Added 2025-05-31
avrlibcCross = avrlibc; # Added 2024-09-06
axmldec = throw "'axmldec' has been removed as it was broken and unmaintained for 8 years"; # Added 2025-05-17 axmldec = throw "'axmldec' has been removed as it was broken and unmaintained for 8 years"; # Added 2025-05-17
awesome-4-0 = awesome; # Added 2022-05-05 awesome-4-0 = awesome; # Added 2022-05-05
aws-env = throw "aws-env has been removed as the upstream project was unmaintained"; # Added 2024-06-11 aws-env = throw "aws-env has been removed as the upstream project was unmaintained"; # Added 2024-06-11
@ -1956,7 +1955,6 @@ mapAliases {
ubootBeagleboneBlack = throw "'ubootBeagleboneBlack' has been renamed to/replaced by 'ubootAmx335xEVM'"; # Converted to throw 2024-10-17 ubootBeagleboneBlack = throw "'ubootBeagleboneBlack' has been renamed to/replaced by 'ubootAmx335xEVM'"; # Converted to throw 2024-10-17
ubuntu_font_family = ubuntu-classic; # Added 2024-02-19 ubuntu_font_family = ubuntu-classic; # Added 2024-02-19
uclibc = uclibc-ng; # Added 2022-06-16 uclibc = uclibc-ng; # Added 2022-06-16
uclibcCross = uclibc-ng; # Added 2022-06-16
unicap = "'unicap' has been removed because it is unmaintained"; # Added 2025-05-17 unicap = "'unicap' has been removed because it is unmaintained"; # Added 2025-05-17
unicorn-emu = throw "'unicorn-emu' has been renamed to/replaced by 'unicorn'"; # Converted to throw 2024-10-17 unicorn-emu = throw "'unicorn-emu' has been renamed to/replaced by 'unicorn'"; # Converted to throw 2024-10-17
uniffi-bindgen = throw "uniffi-bindgen has been removed since upstream no longer provides a standalone package for the CLI"; uniffi-bindgen = throw "uniffi-bindgen has been removed since upstream no longer provides a standalone package for the CLI";

View file

@ -5174,7 +5174,7 @@ with pkgs;
gccWithoutTargetLibc = gccWithoutTargetLibc =
assert stdenv.targetPlatform != stdenv.hostPlatform; assert stdenv.targetPlatform != stdenv.hostPlatform;
let let
libcCross1 = binutilsNoLibc.libc; libc1 = binutilsNoLibc.libc;
in in
wrapCCWith { wrapCCWith {
cc = gccFun { cc = gccFun {
@ -5189,7 +5189,7 @@ with pkgs;
withoutTargetLibc = true; withoutTargetLibc = true;
langCC = false; langCC = false;
libcCross = libcCross1; libcCross = libc1;
targetPackages.stdenv.cc.bintools = binutilsNoLibc; targetPackages.stdenv.cc.bintools = binutilsNoLibc;
enableShared = enableShared =
stdenv.targetPlatform.hasSharedLibraries stdenv.targetPlatform.hasSharedLibraries
@ -5200,7 +5200,7 @@ with pkgs;
&& !(stdenv.targetPlatform.useLLVM or false); && !(stdenv.targetPlatform.useLLVM or false);
}; };
bintools = binutilsNoLibc; bintools = binutilsNoLibc;
libc = libcCross1; libc = libc1;
extraPackages = [ ]; extraPackages = [ ];
}; };
@ -6141,7 +6141,7 @@ with pkgs;
libcxx ? null, libcxx ? null,
extraPackages ? lib.optional ( extraPackages ? lib.optional (
cc.isGNU or false && stdenv.targetPlatform.isMinGW cc.isGNU or false && stdenv.targetPlatform.isMinGW
) threadsCross.package, ) targetPackages.threads.package,
nixSupport ? { }, nixSupport ? { },
... ...
}@extraArgs: }@extraArgs:
@ -6181,7 +6181,7 @@ with pkgs;
wrapBintoolsWith = wrapBintoolsWith =
{ {
bintools, bintools,
libc ? if stdenv.targetPlatform != stdenv.hostPlatform then libcCross else stdenv.cc.libc, libc ? if stdenv.targetPlatform != stdenv.hostPlatform then targetPackages.libc else stdenv.cc.libc,
... ...
}@extraArgs: }@extraArgs:
callPackage ../build-support/bintools-wrapper ( callPackage ../build-support/bintools-wrapper (
@ -6999,7 +6999,7 @@ with pkgs;
}); });
binutilsNoLibc = wrapBintoolsWith { binutilsNoLibc = wrapBintoolsWith {
bintools = binutils-unwrapped; bintools = binutils-unwrapped;
libc = preLibcCrossHeaders; libc = targetPackages.preLibcHeaders;
}; };
libbfd = callPackage ../development/tools/misc/binutils/libbfd.nix { }; libbfd = callPackage ../development/tools/misc/binutils/libbfd.nix { };
@ -7053,7 +7053,7 @@ with pkgs;
null; null;
bintoolsNoLibc = wrapBintoolsWith { bintoolsNoLibc = wrapBintoolsWith {
bintools = bintools-unwrapped; bintools = bintools-unwrapped;
libc = preLibcCrossHeaders; libc = targetPackages.preLibcHeaders;
}; };
bintools = wrapBintoolsWith { bintools = wrapBintoolsWith {
bintools = bintools-unwrapped; bintools = bintools-unwrapped;
@ -8153,9 +8153,21 @@ with pkgs;
withMinecraftPatch = true; withMinecraftPatch = true;
}; };
glibc = callPackage ../development/libraries/glibc { glibc = callPackage ../development/libraries/glibc (
stdenv = gccStdenv; # doesn't compile without gcc if stdenv.hostPlatform != stdenv.buildPlatform then
}; {
stdenv = gccCrossLibcStdenv; # doesn't compile without gcc
libgcc = callPackage ../development/libraries/gcc/libgcc {
gcc = gccCrossLibcStdenv.cc;
glibc = glibc.override { libgcc = null; };
stdenvNoLibs = gccCrossLibcStdenv;
};
}
else
{
stdenv = gccStdenv; # doesn't compile without gcc
}
);
mtrace = callPackage ../development/libraries/glibc/mtrace.nix { }; mtrace = callPackage ../development/libraries/glibc/mtrace.nix { };
@ -8166,96 +8178,85 @@ with pkgs;
withGd = true; withGd = true;
}; };
# Being redundant to avoid cycles on boot. TODO: find a better way musl = callPackage ../by-name/mu/musl/package.nix (
glibcCross = callPackage ../development/libraries/glibc { lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) {
stdenv = gccCrossLibcStdenv; # doesn't compile without gcc stdenv = stdenvNoLibc;
libgcc = callPackage ../development/libraries/gcc/libgcc { }
gcc = gccCrossLibcStdenv.cc; );
glibc = glibcCross.override { libgcc = null; };
stdenvNoLibs = gccCrossLibcStdenv;
};
};
muslCross = musl.override {
stdenv = stdenvNoLibc;
};
# These are used when building compiler-rt / libgcc, prior to building libc. # These are used when building compiler-rt / libgcc, prior to building libc.
preLibcCrossHeaders = preLibcHeaders =
let let
inherit (stdenv.targetPlatform) libc; inherit (stdenv.hostPlatform) libc;
in in
if stdenv.targetPlatform.isMinGW then if stdenv.hostPlatform.isMinGW then
targetPackages.windows.mingw_w64_headers or windows.mingw_w64_headers windows.mingw_w64_headers or fallback
else if libc == "nblibc" then else if libc == "nblibc" then
targetPackages.netbsd.headers or netbsd.headers netbsd.headers
else else
null; null;
# We can choose: # We can choose:
libcCrossChooser = libc =
name: if stdenv.hostPlatform == stdenv.buildPlatform then
# libc is hackily often used from the previous stage. This `or` # TODO get rid of this branch after the native boostrap is reworked
# hack fixes the hack, *sigh*. stdenv.cc.libc
if name == null then else
null let
else if name == "glibc" then inherit (stdenv.hostPlatform) libc;
targetPackages.glibcCross or glibcCross # libc is hackily often used from the previous stage. This `or`
else if name == "bionic" then # hack fixes the hack, *sigh*.
targetPackages.bionic or bionic in
else if name == "uclibc" then if libc == null then
targetPackages.uclibc or uclibc null
else if name == "avrlibc" then else if libc == "glibc" then
targetPackages.avrlibc or avrlibc glibc
else if name == "newlib" && stdenv.targetPlatform.isMsp430 then else if libc == "bionic" then
targetPackages.msp430Newlib or msp430Newlib bionic
else if name == "newlib" && stdenv.targetPlatform.isVc4 then else if libc == "uclibc" then
targetPackages.vc4-newlib or vc4-newlib uclibc
else if name == "newlib" && stdenv.targetPlatform.isOr1k then else if libc == "avrlibc" then
targetPackages.or1k-newlib or or1k-newlib avrlibc
else if name == "newlib" then else if libc == "newlib" && stdenv.hostPlatform.isMsp430 then
targetPackages.newlib or newlib msp430Newlib
else if name == "newlib-nano" then else if libc == "newlib" && stdenv.hostPlatform.isVc4 then
targetPackages.newlib-nano or newlib-nano vc4-newlib
else if name == "musl" then else if libc == "newlib" && stdenv.hostPlatform.isOr1k then
targetPackages.muslCross or muslCross or1k-newlib
else if name == "msvcrt" then else if libc == "newlib" then
targetPackages.windows.mingw_w64 or windows.mingw_w64 newlib
else if name == "ucrt" then else if libc == "newlib-nano" then
targetPackages.windows.mingw_w64 or windows.mingw_w64 newlib-nano
else if name == "libSystem" then else if libc == "musl" then
if stdenv.targetPlatform.useiOSPrebuilt then musl
targetPackages.darwin.iosSdkPkgs.libraries or darwin.iosSdkPkgs.libraries else if libc == "msvcrt" then
windows.mingw_w64
else if libc == "ucrt" then
windows.mingw_w64
else if libc == "libSystem" then
if stdenv.hostPlatform.useiOSPrebuilt then darwin.iosSdkPkgs.libraries else darwin.libSystem
else if libc == "fblibc" then
freebsd.libc
else if libc == "oblibc" then
openbsd.libc
else if libc == "nblibc" then
netbsd.libc
else if libc == "wasilibc" then
wasilibc
else if libc == "relibc" then
relibc
else if name == "llvm" then
llvmPackages_20.libc
else else
targetPackages.darwin.libSystem or darwin.libSystem throw "Unknown libc ${libc}";
else if name == "fblibc" then
targetPackages.freebsd.libc or freebsd.libc
else if name == "oblibc" then
targetPackages.openbsd.libc or openbsd.libc
else if name == "nblibc" then
targetPackages.netbsd.libc or netbsd.libc
else if name == "wasilibc" then
targetPackages.wasilibc or wasilibc
else if name == "relibc" then
targetPackages.relibc or relibc
else if name == "llvm" then
targetPackages.llvmPackages_20.libc or llvmPackages_20.libc
else
throw "Unknown libc ${name}";
libcCross = threads =
if stdenv.targetPlatform == stdenv.buildPlatform then lib.optionalAttrs (stdenv.hostPlatform.isMinGW && !(stdenv.hostPlatform.useLLVM or false))
null
else
libcCrossChooser stdenv.targetPlatform.libc;
threadsCross =
lib.optionalAttrs (stdenv.targetPlatform.isMinGW && !(stdenv.targetPlatform.useLLVM or false))
{ {
# other possible values: win32 or posix # other possible values: win32 or posix
model = "mcf"; model = "mcf";
# For win32 or posix set this to null # For win32 or posix set this to null
package = targetPackages.windows.mcfgthreads or windows.mcfgthreads; package = windows.mcfgthreads;
}; };
wasilibc = callPackage ../development/libraries/wasilibc { wasilibc = callPackage ../development/libraries/wasilibc {
@ -8771,7 +8772,7 @@ with pkgs;
"fblibc" "fblibc"
] ]
then then
libcIconv (if stdenv.hostPlatform != stdenv.buildPlatform then libcCross else stdenv.cc.libc) libcIconv (if stdenv.hostPlatform != stdenv.buildPlatform then libc else stdenv.cc.libc)
else if stdenv.hostPlatform.isDarwin then else if stdenv.hostPlatform.isDarwin then
darwin.libiconv darwin.libiconv
else else
@ -9578,7 +9579,7 @@ with pkgs;
simavr = callPackage ../development/tools/simavr { simavr = callPackage ../development/tools/simavr {
avrgcc = pkgsCross.avr.buildPackages.gcc; avrgcc = pkgsCross.avr.buildPackages.gcc;
avrlibc = pkgsCross.avr.libcCross; avrlibc = pkgsCross.avr.libc;
}; };
simpleitk = callPackage ../development/libraries/simpleitk { lua = lua5_4; }; simpleitk = callPackage ../development/libraries/simpleitk { lua = lua5_4; };

View file

@ -6,7 +6,6 @@
generateSplicesForMkScope, generateSplicesForMkScope,
makeScopeWithSplicing', makeScopeWithSplicing',
stdenv, stdenv,
preLibcCrossHeaders,
config, config,
}: }:
@ -57,7 +56,8 @@ makeScopeWithSplicing' {
}; };
binutils = pkgs.wrapBintoolsWith { binutils = pkgs.wrapBintoolsWith {
libc = if stdenv.targetPlatform != stdenv.hostPlatform then pkgs.libcCross else pkgs.stdenv.cc.libc; libc =
if stdenv.targetPlatform != stdenv.hostPlatform then targetPackages.libc else pkgs.stdenv.cc.libc;
bintools = self.binutils-unwrapped; bintools = self.binutils-unwrapped;
}; };
@ -88,7 +88,7 @@ makeScopeWithSplicing' {
}; };
binutilsNoLibc = pkgs.wrapBintoolsWith { binutilsNoLibc = pkgs.wrapBintoolsWith {
libc = preLibcCrossHeaders; libc = targetPackages.preLibcHeaders;
bintools = self.binutils-unwrapped; bintools = self.binutils-unwrapped;
}; };

View file

@ -71,13 +71,13 @@ let
embedded = { embedded = {
buildPackages.binutils = nativePlatforms; buildPackages.binutils = nativePlatforms;
buildPackages.gcc = nativePlatforms; buildPackages.gcc = nativePlatforms;
libcCross = nativePlatforms; libc = nativePlatforms;
}; };
common = { common = {
buildPackages.binutils = nativePlatforms; buildPackages.binutils = nativePlatforms;
gmp = nativePlatforms; gmp = nativePlatforms;
libcCross = nativePlatforms; libc = nativePlatforms;
nix = nativePlatforms; nix = nativePlatforms;
nixVersions.git = nativePlatforms; nixVersions.git = nativePlatforms;
mesa = nativePlatforms; mesa = nativePlatforms;