Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cc-wrapper: gross hack for staging-next to fix scipy **revert this when merging staging-next to staging** #225273

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkgs/build-support/cc-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
, buildPackages ? {}
, libcxx ? null
, grossHackForStagingNext ? false

# Whether or not to add `-B` and `-L` to `nix-support/cc-{c,ld}flags`
, useCcForLibs ?
Expand Down Expand Up @@ -407,7 +408,11 @@ stdenv.mkDerivation {
touch "$out/nix-support/libcxx-cxxflags"
touch "$out/nix-support/libcxx-ldflags"
''
+ optionalString (libcxx == null && (useGccForLibs && gccForLibs.langCC or false)) ''
# Adding -isystem flags should be done only for clang; gcc
# already knows how to find its own libstdc++, and adding
# additional -isystem flags will confuse gfortran (see
# https://github.com/NixOS/nixpkgs/pull/209870#issuecomment-1500550903)
+ optionalString (libcxx == null && (if grossHackForStagingNext then isClang else true) && (useGccForLibs && gccForLibs.langCC or false)) ''
for dir in ${gccForLibs}${lib.optionalString (hostPlatform != targetPlatform) "/${targetPlatform.config}"}/include/c++/*; do
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
done
Expand Down
5 changes: 4 additions & 1 deletion pkgs/development/compilers/gcc/common/configure-flags.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ let
inherit (stdenv)
buildPlatform hostPlatform targetPlatform;

# See https://github.com/NixOS/nixpkgs/pull/209870#issuecomment-1500550903
disableBootstrap' = disableBootstrap && !langFortran;

crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";

Expand Down Expand Up @@ -217,7 +220,7 @@ let
# TODO: aarch64-darwin has clang stdenv and its arch and cpu flag values are incompatible with gcc
++ lib.optionals (!(stdenv.isDarwin && stdenv.isAarch64)) (import ../common/platform-flags.nix { inherit (stdenv) targetPlatform; inherit lib; })
++ lib.optionals (targetPlatform != hostPlatform) crossConfigureFlags
++ lib.optional disableBootstrap "--disable-bootstrap"
++ lib.optional disableBootstrap' "--disable-bootstrap"

# Platform-specific flags
++ lib.optional (targetPlatform == hostPlatform && targetPlatform.isx86_32) "--with-arch=${stdenv.hostPlatform.parsed.cpu.name}"
Expand Down
4 changes: 2 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14834,13 +14834,13 @@ with pkgs;
gcc_latest = gcc12;

# Use the same GCC version as the one from stdenv by default
gfortran = wrapCC (gcc.cc.override {
gfortran = wrapCCWith { grossHackForStagingNext = true; cc = (gcc.cc.override {
name = "gfortran";
langFortran = true;
langCC = false;
langC = false;
profiledCompiler = false;
});
}); };

gfortran48 = wrapCC (gcc48.cc.override {
name = "gfortran";
Expand Down