From 40f7300227019403d00965fc37709149ba4eadca Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Mon, 25 Apr 2022 00:00:11 -0700 Subject: gcc: if isPower64 && !isMusl use --with-long-double-format=ieee Use IEEE-standard floating point on `powerpc64le` instead of IBM-proprietary formats. The GCC wiki has more details on the history here: https://gcc.gnu.org/wiki/Ieee128PowerPC Nixpkgs' stdenv has no legacy `powerpc64le` installs to deal with (stdenv did not bootstrap on powerpc64le until very recenty), so it's much easier decision for us. Red Hat (i.e. IBM) has tried to do this in each of the last *six* releases: https://fedoraproject.org/wiki/Changes/PPC64LE_Float128_Transition they and finally shipped it in May with Fedora 36: https://bugzilla.redhat.com/show_bug.cgi?id=1649936 Apparently glibc 2.35 fixes the last blocker. Co-authored-by: Sandro --- pkgs/development/compilers/gcc/common/platform-flags.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'pkgs/development/compilers/gcc') diff --git a/pkgs/development/compilers/gcc/common/platform-flags.nix b/pkgs/development/compilers/gcc/common/platform-flags.nix index bd5a72f960364..fc068c194d2b0 100644 --- a/pkgs/development/compilers/gcc/common/platform-flags.nix +++ b/pkgs/development/compilers/gcc/common/platform-flags.nix @@ -10,7 +10,11 @@ in lib.concatLists [ (lib.optional (p ? fpu) "--with-fpu=${p.fpu}") (lib.optional (p ? float) "--with-float=${p.float}") (lib.optional (p ? mode) "--with-mode=${p.mode}") - (lib.optional - (let tp = targetPlatform; in tp.isPower && tp.libc == "glibc" && tp.is64bit) - "--with-long-double-128") + (lib.optionals targetPlatform.isPower64 + # musl explicitly rejects 128-bit long double on + # powerpc64; see musl/arch/powerpc64/bits/float.h + (lib.optionals (!targetPlatform.isMusl) [ + "--with-long-double-128" + "--with-long-double-format=ieee" + ])) ] -- cgit 1.4.1 From 29b395309fbd55626087ed60e319aa86e5b70264 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Mon, 8 Aug 2022 03:51:28 -0700 Subject: gcc: make --with-long-double-format configurable by targetPlatform.gcc --- pkgs/development/compilers/gcc/common/platform-flags.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pkgs/development/compilers/gcc') diff --git a/pkgs/development/compilers/gcc/common/platform-flags.nix b/pkgs/development/compilers/gcc/common/platform-flags.nix index fc068c194d2b0..111af8ed430d4 100644 --- a/pkgs/development/compilers/gcc/common/platform-flags.nix +++ b/pkgs/development/compilers/gcc/common/platform-flags.nix @@ -1,7 +1,8 @@ { lib, targetPlatform }: let - p = targetPlatform.gcc or {} + gcc = targetPlatform.gcc or {}; + p = gcc // targetPlatform.parsed.abi; in lib.concatLists [ (lib.optional (!targetPlatform.isx86_64 && p ? arch) "--with-arch=${p.arch}") # --with-arch= is unknown flag on x86_64 @@ -15,6 +16,6 @@ in lib.concatLists [ # powerpc64; see musl/arch/powerpc64/bits/float.h (lib.optionals (!targetPlatform.isMusl) [ "--with-long-double-128" - "--with-long-double-format=ieee" + "--with-long-double-format=${gcc.long-double-format or "ieee"}" ])) ] -- cgit 1.4.1 From deda18bae8a38ec76c9366e227e3a2b8610ad697 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Mon, 8 Aug 2022 04:09:33 -0700 Subject: gcc: only pass --with-long-double-format if gcc allows it --- pkgs/development/compilers/gcc/common/platform-flags.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'pkgs/development/compilers/gcc') diff --git a/pkgs/development/compilers/gcc/common/platform-flags.nix b/pkgs/development/compilers/gcc/common/platform-flags.nix index 111af8ed430d4..c0593cd781ed4 100644 --- a/pkgs/development/compilers/gcc/common/platform-flags.nix +++ b/pkgs/development/compilers/gcc/common/platform-flags.nix @@ -14,7 +14,14 @@ in lib.concatLists [ (lib.optionals targetPlatform.isPower64 # musl explicitly rejects 128-bit long double on # powerpc64; see musl/arch/powerpc64/bits/float.h - (lib.optionals (!targetPlatform.isMusl) [ + (lib.optionals + (!targetPlatform.isMusl + && (targetPlatform.isLittleEndian || + # "... --with-long-double-format is only supported if the default cpu is power7 or newer" + # https://github.com/NixOS/nixpkgs/pull/170215#issuecomment-1202164709 + (lib.lists.elem + (lib.strings.substring 0 6 (p.cpu or "")) + [ "power7" "power8" "power9" "power1"/*0, 11, etc*/ ]))) [ "--with-long-double-128" "--with-long-double-format=${gcc.long-double-format or "ieee"}" ])) -- cgit 1.4.1 From 84822c43fcf6787f3680868d6f63e80b69244fbe Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Mon, 10 Apr 2023 17:04:03 +0100 Subject: gcc: drop include-fixed/bits/statx.h At least on armv7l-linux bootstrapTools fixed version of bits/statx.h breaks the header: https://github.com/NixOS/nixpkgs/pull/209870#issuecomment-1501201452 Drop the header along with other already cleaned ones. --- pkgs/development/compilers/gcc/builder.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs/development/compilers/gcc') diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh index a2155360edeed..5147df1e4cc0d 100644 --- a/pkgs/development/compilers/gcc/builder.sh +++ b/pkgs/development/compilers/gcc/builder.sh @@ -262,7 +262,7 @@ postInstall() { fi # Get rid of some "fixed" header files - rm -rfv $out/lib/gcc/*/*/include-fixed/{root,linux,sys/mount.h} + rm -rfv $out/lib/gcc/*/*/include-fixed/{root,linux,sys/mount.h,bits/statx.h} # Replace hard links for i686-pc-linux-gnu-gcc etc. with symlinks. for i in $out/bin/*-gcc*; do -- cgit 1.4.1 From b1d4dfddaf961fe8eab1207fb840fe9a67a3b72d Mon Sep 17 00:00:00 2001 From: Artturin Date: Mon, 10 Apr 2023 21:37:31 +0300 Subject: Revert "julia{18,19,}: fix build by a temporary hack" This reverts commit e2691227cdc424c643511d40fd6234acdf77372e. --- pkgs/build-support/cc-wrapper/default.nix | 7 +------ pkgs/development/compilers/gcc/12/default.nix | 2 +- pkgs/top-level/all-packages.nix | 17 ++--------------- 3 files changed, 4 insertions(+), 22 deletions(-) (limited to 'pkgs/development/compilers/gcc') diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 24680754c8d5d..597e8105fa1dd 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -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 ? @@ -408,11 +407,7 @@ stdenv.mkDerivation { touch "$out/nix-support/libcxx-cxxflags" touch "$out/nix-support/libcxx-ldflags" '' - # 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)) '' + + optionalString (libcxx == null && (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 diff --git a/pkgs/development/compilers/gcc/12/default.nix b/pkgs/development/compilers/gcc/12/default.nix index bf1c6e2ffae84..ffe94eab3ce39 100644 --- a/pkgs/development/compilers/gcc/12/default.nix +++ b/pkgs/development/compilers/gcc/12/default.nix @@ -29,7 +29,6 @@ , buildPackages , libxcrypt , disableGdbPlugin ? !enablePlugin -, disableBootstrap ? !stdenv.hostPlatform.isDarwin , nukeReferences , callPackage }: @@ -57,6 +56,7 @@ with builtins; let majorVersion = "12"; version = "${majorVersion}.2.0"; + disableBootstrap = !stdenv.hostPlatform.isDarwin; inherit (stdenv) buildPlatform hostPlatform targetPlatform; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3bec8181f2107..f0c79e15cf554 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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; @@ -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; -- cgit 1.4.1 From f06ab170fae68622dbfd254aac094fb13b0cfcaa Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Fri, 7 Apr 2023 13:50:35 -0700 Subject: gcc: never disableBootstrap for gfortran As suggested by @trofi here: https://github.com/NixOS/nixpkgs/pull/209870#issuecomment-1500635687 This should fix failures among packages which use gfortran: https://github.com/NixOS/nixpkgs/pull/209870#issuecomment-1500550903 https://hydra.nixos.org/build/215195834 --- pkgs/development/compilers/gcc/common/configure-flags.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pkgs/development/compilers/gcc') diff --git a/pkgs/development/compilers/gcc/common/configure-flags.nix b/pkgs/development/compilers/gcc/common/configure-flags.nix index eadc6967acfc9..e0f7ccc7b59a3 100644 --- a/pkgs/development/compilers/gcc/common/configure-flags.nix +++ b/pkgs/development/compilers/gcc/common/configure-flags.nix @@ -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"; @@ -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}" -- cgit 1.4.1