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: deunify clang/gcc treatment of -isystem #225220

Merged
merged 5 commits into from Apr 11, 2023
Merged
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
3 changes: 1 addition & 2 deletions pkgs/build-support/cc-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
, 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 @@ -412,7 +411,7 @@ stdenv.mkDerivation {
# 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)) ''
+ optionalString (libcxx == null && isClang && (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
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/12/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
, buildPackages
, libxcrypt
, disableGdbPlugin ? !enablePlugin
, disableBootstrap ? !stdenv.hostPlatform.isDarwin
, nukeReferences
, callPackage
}:
Expand Down Expand Up @@ -57,6 +56,7 @@ with builtins;

let majorVersion = "12";
version = "${majorVersion}.2.0";
disableBootstrap = !stdenv.hostPlatform.isDarwin;

inherit (stdenv) buildPlatform hostPlatform targetPlatform;

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/development/python-modules/kaldi-active-grammar/fork.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
, python3
, openblas
, zlib
, gfortran-tmp-noisystem
, gfortran
}:

let
Expand Down Expand Up @@ -56,7 +56,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [
pkg-config
python3
gfortran-tmp-noisystem
gfortran
];

buildFlags = [
Expand Down
3 changes: 0 additions & 3 deletions pkgs/development/python-modules/scikit-learn/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ buildPythonPackage rec {
export SKLEARN_BUILD_PARALLEL=$NIX_BUILD_CORES
'';

# TODO: a proper fix? See around PR #225220
NIX_LDFLAGS = if stdenv.cc.isGNU then "-L${stdenv.cc.cc.lib}/lib" else null;

doCheck = !stdenv.isAarch64;

disabledTests = [
Expand Down
17 changes: 2 additions & 15 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14855,15 +14855,6 @@ with pkgs;
profiledCompiler = false;
});

gfortran-tmp-noisystem = wrapCCWith { grossHackForStagingNext = true; cc = (gcc.cc.override {
name = "gfortran";
langFortran = true;
langCC = false;
langC = false;
profiledCompiler = false;
disableBootstrap = false;
}); };

gfortran48 = wrapCC (gcc48.cc.override {
name = "gfortran";
langFortran = true;
Expand Down Expand Up @@ -15345,12 +15336,8 @@ with pkgs;
julia_16-bin = callPackage ../development/compilers/julia/1.6-bin.nix { };
julia_18-bin = callPackage ../development/compilers/julia/1.8-bin.nix { };

julia_18 = callPackage ../development/compilers/julia/1.8.nix {
gfortran = gfortran-tmp-noisystem;
};
julia_19 = callPackage ../development/compilers/julia/1.9.nix {
gfortran = gfortran-tmp-noisystem;
};
julia_18 = callPackage ../development/compilers/julia/1.8.nix { };
julia_19 = callPackage ../development/compilers/julia/1.9.nix { };

julia-lts-bin = julia_16-bin;
julia-stable-bin = julia_18-bin;
Expand Down