From b5cfb40cc1690f06b32fa482814cb13635d29c46 Mon Sep 17 00:00:00 2001 From: Ross Smyth <18294397+RossSmyth@users.noreply.github.com> Date: Sun, 21 Sep 2025 00:12:46 -0400 Subject: [PATCH 1/4] ntl: to finalAttrs, strictDeps, fix static and cross builds. --- pkgs/by-name/nt/ntl/package.nix | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/pkgs/by-name/nt/ntl/package.nix b/pkgs/by-name/nt/ntl/package.nix index 41a6191654d9..f52ac96c7fba 100644 --- a/pkgs/by-name/nt/ntl/package.nix +++ b/pkgs/by-name/nt/ntl/package.nix @@ -13,24 +13,24 @@ assert withGf2x -> gf2x != null; -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "ntl"; version = "11.5.1"; src = fetchurl { - url = "http://www.shoup.net/ntl/ntl-${version}.tar.gz"; - sha256 = "sha256-IQ0GwxMGy8bq9oFEU8Vsd22djo3zbXTrMG9qUj0caoo="; + url = "http://www.shoup.net/ntl/ntl-${finalAttrs.version}.tar.gz"; + hash = "sha256-IQ0GwxMGy8bq9oFEU8Vsd22djo3zbXTrMG9qUj0caoo="; }; + strictDeps = true; + depsBuildBuild = [ + perl # needed for ./configure + ]; buildInputs = [ gmp ]; - nativeBuildInputs = [ - perl # needed for ./configure - ]; - - sourceRoot = "${pname}-${version}/src"; + sourceRoot = "ntl-${finalAttrs.version}/src"; enableParallelBuilding = true; @@ -42,9 +42,9 @@ stdenv.mkDerivation rec { configurePlatforms = [ ]; # reference: http://shoup.net/ntl/doc/tour-unix.html + dontAddStaticConfigureFlags = true; # perl config doesn't understand it. configureFlags = [ "DEF_PREFIX=$(out)" - "SHARED=on" # genereate a shared library (as well as static) "NATIVE=off" # don't target code to current hardware (reproducibility, portability) "TUNE=${ if tune then @@ -55,15 +55,20 @@ stdenv.mkDerivation rec { "generic" # "chooses options that should be OK for most platforms" }" "CXX=${stdenv.cc.targetPrefix}c++" + "AR=${stdenv.cc.targetPrefix}ar" + ] + ++ lib.optionals (!stdenv.hostPlatform.isStatic) [ + "SHARED=on" # genereate a shared library ] ++ lib.optionals withGf2x [ "NTL_GF2X_LIB=on" "GF2X_PREFIX=${gf2x}" ]; + enableParallelChecking = true; doCheck = true; # takes some time - meta = with lib; { + meta = { description = "Library for doing Number Theory"; longDescription = '' NTL is a high-performance, portable C++ library providing data @@ -76,11 +81,11 @@ stdenv.mkDerivation rec { homepage = "http://www.shoup.net/ntl/"; # also locally at "${src}/doc/tour-changes.html"; changelog = "https://www.shoup.net/ntl/doc/tour-changes.html"; - teams = [ teams.sage ]; - license = licenses.gpl2Plus; - platforms = platforms.all; + teams = [ lib.teams.sage ]; + license = lib.licenses.gpl2Plus; + platforms = lib.platforms.all; # Does not cross compile # https://github.com/libntl/ntl/issues/8 broken = !(stdenv.buildPlatform.canExecute stdenv.hostPlatform); }; -} +}) From 3ee909bfa441b9a9d0ea2b4c39de88abcfd1d3d6 Mon Sep 17 00:00:00 2001 From: Ross Smyth <18294397+RossSmyth@users.noreply.github.com> Date: Sun, 21 Sep 2025 15:42:34 -0400 Subject: [PATCH 2/4] flint: to finalAttrs, strictDeps, fix static build --- pkgs/development/libraries/flint/3.nix | 43 +++++++++++++------ .../libraries/flint/checkPhase.patch | 26 +++++++++++ 2 files changed, 56 insertions(+), 13 deletions(-) create mode 100644 pkgs/development/libraries/flint/checkPhase.patch diff --git a/pkgs/development/libraries/flint/3.nix b/pkgs/development/libraries/flint/3.nix index 3546022dc4f5..921b89be7005 100644 --- a/pkgs/development/libraries/flint/3.nix +++ b/pkgs/development/libraries/flint/3.nix @@ -2,34 +2,45 @@ lib, stdenv, fetchurl, - gmp, - mpfr, - ntl, + fetchpatch, windows, autoconf, automake, gettext, libtool, - openblas ? null, + gmp, + mpfr, + ntl, blas, lapack, + boehmgc, + openblas ? null, withBlas ? true, withNtl ? !ntl.meta.broken, + withGc ? false, }: assert withBlas -> openblas != null && blas.implementation == "openblas" && lapack.implementation == "openblas"; -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "flint3"; version = "3.3.1"; src = fetchurl { - url = "https://flintlib.org/download/flint-${version}.tar.gz"; + url = "https://flintlib.org/download/flint-${finalAttrs.version}.tar.gz"; hash = "sha256-ZNcOUTB2z6lx4EELWMHaXTURKRPppWtE4saBtFnT6vs="; }; + patches = [ + # Remove once/if https://github.com/flintlib/flint/pull/2411 is merged + # Required or else during the check phase the build fails while + # linking a test due to duplicate symbol errors + ./checkPhase.patch + ]; + + strictDeps = true; nativeBuildInputs = [ autoconf automake @@ -50,6 +61,9 @@ stdenv.mkDerivation rec { ++ lib.optionals withNtl [ ntl ] + ++ lib.optionals withGc [ + boehmgc + ] ++ lib.optionals stdenv.hostPlatform.isMinGW [ windows.pthreads ]; @@ -70,19 +84,22 @@ stdenv.mkDerivation rec { ] ++ lib.optionals withNtl [ "--with-ntl=${ntl}" + ] + ++ lib.optionals withGc [ + "--with-gc=${boehmgc}" ]; enableParallelBuilding = true; - + enableParallelChecking = true; doCheck = true; - meta = with lib; { + meta = { description = "Fast Library for Number Theory"; - license = licenses.lgpl3Plus; - maintainers = with maintainers; [ smasher164 ]; - teams = [ teams.sage ]; - platforms = platforms.all; + license = lib.licenses.lgpl3Plus; + maintainers = [ lib.maintainers.smasher164 ]; + teams = [ lib.teams.sage ]; + platforms = lib.platforms.all; homepage = "https://www.flintlib.org/"; downloadPage = "https://www.flintlib.org/downloads.html"; }; -} +}) diff --git a/pkgs/development/libraries/flint/checkPhase.patch b/pkgs/development/libraries/flint/checkPhase.patch new file mode 100644 index 000000000000..19de1b1f1e20 --- /dev/null +++ b/pkgs/development/libraries/flint/checkPhase.patch @@ -0,0 +1,26 @@ +https://github.com/flintlib/flint/pull/2411 + +From 9957b17e6b08bd57790f7da1344b4d92eefc0b38 Mon Sep 17 00:00:00 2001 +From: Ross Smyth <18294397+RossSmyth@users.noreply.github.com> +Date: Sun, 21 Sep 2025 15:58:57 -0400 +Subject: [PATCH] Fix duplicate symbols linker error + +When I run `make check` I get linker errors without +this patch +--- + src/double_interval.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/double_interval.h b/src/double_interval.h +index a423257db2..5f685c283f 100644 +--- a/src/double_interval.h ++++ b/src/double_interval.h +@@ -13,7 +13,7 @@ + #define DOUBLE_INTERVAL_H + + #ifdef DOUBLE_INTERVAL_INLINES_C +-#define DOUBLE_INTERVAL_INLINE ++#define DOUBLE_INTERVAL_INLINE static + #else + #define DOUBLE_INTERVAL_INLINE static inline + #endif From 2088c727470acbef55bcc029e77078cd913b3dff Mon Sep 17 00:00:00 2001 From: Ross Smyth <18294397+RossSmyth@users.noreply.github.com> Date: Sun, 21 Sep 2025 15:53:37 -0400 Subject: [PATCH 3/4] flint: Move to by-name --- .../libraries => by-name/fl}/flint/checkPhase.patch | 0 .../libraries/flint/3.nix => by-name/fl/flint/package.nix} | 2 +- pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 4 ---- 4 files changed, 2 insertions(+), 5 deletions(-) rename pkgs/{development/libraries => by-name/fl}/flint/checkPhase.patch (100%) rename pkgs/{development/libraries/flint/3.nix => by-name/fl/flint/package.nix} (99%) diff --git a/pkgs/development/libraries/flint/checkPhase.patch b/pkgs/by-name/fl/flint/checkPhase.patch similarity index 100% rename from pkgs/development/libraries/flint/checkPhase.patch rename to pkgs/by-name/fl/flint/checkPhase.patch diff --git a/pkgs/development/libraries/flint/3.nix b/pkgs/by-name/fl/flint/package.nix similarity index 99% rename from pkgs/development/libraries/flint/3.nix rename to pkgs/by-name/fl/flint/package.nix index 921b89be7005..a49d3165cf54 100644 --- a/pkgs/development/libraries/flint/3.nix +++ b/pkgs/by-name/fl/flint/package.nix @@ -25,7 +25,7 @@ assert -> openblas != null && blas.implementation == "openblas" && lapack.implementation == "openblas"; stdenv.mkDerivation (finalAttrs: { - pname = "flint3"; + pname = "flint"; version = "3.3.1"; src = fetchurl { diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 043041e28f8f..dfe17d01e5fd 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -900,6 +900,7 @@ mapAliases { flashrom-stable = flashprog; # Added 2024-03-01 flatbuffers_2_0 = flatbuffers; # Added 2022-05-12 flatcam = throw "flatcam has been removed because it is unmaintained since 2022 and doesn't support Python > 3.10"; # Added 2025-01-25 + flint3 = flint; # Added 2025-09-21 floorp = throw "floorp has been replaced with floorp-bin, as building from upstream sources has become unfeasible starting with version 12.x"; # Added 2025-09-06 floorp-unwrapped = throw "floorp-unwrapped has been replaced with floorp-bin-unwrapped, as building from upstream sources has become unfeasible starting with version 12.x"; # Added 2025-09-06 flow-editor = flow-control; # Added 2025-03-05 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b3b820574ef8..722dba0348e2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7446,10 +7446,6 @@ with pkgs; }; fftwMpi = fftw.override { enableMpi = true; }; - flint = flint3; - - flint3 = callPackage ../development/libraries/flint/3.nix { }; - fltk13 = callPackage ../development/libraries/fltk { }; fltk14 = callPackage ../development/libraries/fltk/1.4.nix { }; fltk13-minimal = fltk13.override { From 7e7469589bda977d07ef0c6a9d73388ab532c55f Mon Sep 17 00:00:00 2001 From: Ross Smyth <18294397+RossSmyth@users.noreply.github.com> Date: Sun, 21 Sep 2025 16:33:17 -0400 Subject: [PATCH 4/4] tree-wide: Remove uses of flint3 --- pkgs/by-name/ms/msolve/package.nix | 4 ++-- pkgs/by-name/no/normaliz/package.nix | 4 ++-- pkgs/by-name/pp/pplite/package.nix | 4 ++-- pkgs/by-name/s7/s7/package.nix | 4 ++-- pkgs/by-name/sa/sage/package.nix | 8 ++++---- pkgs/by-name/sa/sage/sage-env.nix | 6 +++--- pkgs/by-name/sa/sage/sagelib.nix | 4 ++-- pkgs/by-name/si/singular/package.nix | 6 +++--- pkgs/by-name/sy/symengine/package.nix | 4 ++-- pkgs/development/ocaml-modules/apron/default.nix | 4 ++-- pkgs/development/ocaml-modules/mopsa/default.nix | 4 ++-- pkgs/development/r-modules/default.nix | 2 +- 12 files changed, 27 insertions(+), 27 deletions(-) diff --git a/pkgs/by-name/ms/msolve/package.nix b/pkgs/by-name/ms/msolve/package.nix index 652d1c152409..e8d9d2f52ce4 100644 --- a/pkgs/by-name/ms/msolve/package.nix +++ b/pkgs/by-name/ms/msolve/package.nix @@ -3,7 +3,7 @@ stdenv, fetchFromGitHub, autoreconfHook, - flint3, + flint, gmp, mpfr, llvmPackages, @@ -29,7 +29,7 @@ stdenv.mkDerivation (finalAttrs: { ]; buildInputs = [ - flint3 + flint gmp mpfr ] diff --git a/pkgs/by-name/no/normaliz/package.nix b/pkgs/by-name/no/normaliz/package.nix index 5d0d2e6db329..66e5671f83c5 100644 --- a/pkgs/by-name/no/normaliz/package.nix +++ b/pkgs/by-name/no/normaliz/package.nix @@ -4,7 +4,7 @@ fetchFromGitHub, autoreconfHook, gmpxx, - flint3, + flint, nauty, }: @@ -21,7 +21,7 @@ stdenv.mkDerivation (finalAttrs: { buildInputs = [ gmpxx - flint3 + flint nauty ]; diff --git a/pkgs/by-name/pp/pplite/package.nix b/pkgs/by-name/pp/pplite/package.nix index c128142921ca..991ad0e03cdd 100644 --- a/pkgs/by-name/pp/pplite/package.nix +++ b/pkgs/by-name/pp/pplite/package.nix @@ -3,7 +3,7 @@ lib, fetchurl, fetchpatch, - flint3, + flint, gmp, }: @@ -17,7 +17,7 @@ stdenv.mkDerivation { }; buildInputs = [ - flint3 + flint gmp ]; diff --git a/pkgs/by-name/s7/s7/package.nix b/pkgs/by-name/s7/s7/package.nix index a8dbaa69e057..553c4afb5461 100644 --- a/pkgs/by-name/s7/s7/package.nix +++ b/pkgs/by-name/s7/s7/package.nix @@ -3,7 +3,7 @@ fetchFromGitLab, stdenv, - flint3, + flint, gmp, libmpc, mpfr, @@ -37,7 +37,7 @@ stdenv.mkDerivation (finalAttrs: { }; buildInputs = - lib.optional withArb flint3 + lib.optional withArb flint ++ lib.optionals withGMP [ gmp mpfr diff --git a/pkgs/by-name/sa/sage/package.nix b/pkgs/by-name/sa/sage/package.nix index 0244119055cd..a594c707256b 100644 --- a/pkgs/by-name/sa/sage/package.nix +++ b/pkgs/by-name/sa/sage/package.nix @@ -17,7 +17,7 @@ let self: super: { # `sagelib`, i.e. all of sage except some wrappers and runtime dependencies sagelib = self.callPackage ./sagelib.nix { - inherit flint3; + inherit flint; inherit sage-src env-locations singular; inherit (maxima) lisp-compiler; linbox = pkgs.linbox; @@ -79,7 +79,7 @@ let python3 singular palp - flint3 + flint pythonEnv maxima ; @@ -142,7 +142,7 @@ let extraLibs = pythonRuntimeDeps; }; # make the libs accessible - singular = pkgs.singular.override { inherit flint3; }; + singular = pkgs.singular.override { inherit flint; }; maxima = pkgs.maxima-ecl.override { lisp-compiler = pkgs.ecl.override { @@ -164,7 +164,7 @@ let # openblas instead of openblasCompat. Apparently other packages somehow use flints # blas when it is available. Alternative would be to override flint to use # openblasCompat. - flint3 = pkgs.flint3.override { withBlas = false; }; + flint = pkgs.flint.override { withBlas = false; }; # Multiple palp dimensions need to be available and sage expects them all to be # in the same folder. diff --git a/pkgs/by-name/sa/sage/sage-env.nix b/pkgs/by-name/sa/sage/sage-env.nix index 47028995d330..d1f0c104e183 100644 --- a/pkgs/by-name/sa/sage/sage-env.nix +++ b/pkgs/by-name/sa/sage/sage-env.nix @@ -43,7 +43,7 @@ rubiks, blas, lapack, - flint3, + flint, gmp, mpfr, zlib, @@ -167,7 +167,7 @@ writeTextFile rec { export LDFLAGS='${ lib.concatStringsSep " " ( map (pkg: "-L${pkg}/lib") [ - flint3 + flint gap glpk gmp @@ -187,7 +187,7 @@ writeTextFile rec { singular gmp.dev glpk - flint3 + flint gap mpfr.dev ] diff --git a/pkgs/by-name/sa/sage/sagelib.nix b/pkgs/by-name/sa/sage/sagelib.nix index 408a015a2a9a..7964c4b8fa25 100644 --- a/pkgs/by-name/sa/sage/sagelib.nix +++ b/pkgs/by-name/sa/sage/sagelib.nix @@ -21,7 +21,7 @@ eclib, ecm, fflas-ffpack, - flint3, + flint, gap, giac, givaro, @@ -136,7 +136,7 @@ buildPythonPackage rec { eclib ecm fflas-ffpack - flint3 + flint gap giac givaro diff --git a/pkgs/by-name/si/singular/package.nix b/pkgs/by-name/si/singular/package.nix index 608e4d3a4797..4278033373f2 100644 --- a/pkgs/by-name/si/singular/package.nix +++ b/pkgs/by-name/si/singular/package.nix @@ -15,7 +15,7 @@ sharutils, file, getconf, - flint3, + flint, ntl, mpfr, cddlib, @@ -52,7 +52,7 @@ stdenv.mkDerivation rec { configureFlags = [ "--enable-gfanlib" "--with-ntl=${ntl}" - "--with-flint=${flint3}" + "--with-flint=${flint}" ] ++ lib.optionals enableDocs [ "--enable-doc-build" @@ -88,7 +88,7 @@ stdenv.mkDerivation rec { buildInputs = [ # necessary gmp - flint3 + flint # by upstream recommended but optional ncurses readline diff --git a/pkgs/by-name/sy/symengine/package.nix b/pkgs/by-name/sy/symengine/package.nix index 9aaf8cde4269..5c71dfc1d5cb 100644 --- a/pkgs/by-name/sy/symengine/package.nix +++ b/pkgs/by-name/sy/symengine/package.nix @@ -4,7 +4,7 @@ fetchFromGitHub, cmake, gmp, - flint3, + flint, mpfr, libmpc, withShared ? true, @@ -25,7 +25,7 @@ stdenv.mkDerivation rec { buildInputs = [ gmp - flint3 + flint mpfr libmpc ]; diff --git a/pkgs/development/ocaml-modules/apron/default.nix b/pkgs/development/ocaml-modules/apron/default.nix index 308803b75ced..f1206bab6ffb 100644 --- a/pkgs/development/ocaml-modules/apron/default.nix +++ b/pkgs/development/ocaml-modules/apron/default.nix @@ -10,7 +10,7 @@ findlib, camlidl, mlgmpidl, - flint3, + flint, pplite, }: @@ -34,7 +34,7 @@ stdenv.mkDerivation rec { mpfr ppl camlidl - flint3 + flint pplite ]; propagatedBuildInputs = [ mlgmpidl ]; diff --git a/pkgs/development/ocaml-modules/mopsa/default.nix b/pkgs/development/ocaml-modules/mopsa/default.nix index 4e60eaff2f47..bccc33e7085a 100644 --- a/pkgs/development/ocaml-modules/mopsa/default.nix +++ b/pkgs/development/ocaml-modules/mopsa/default.nix @@ -5,7 +5,7 @@ clang, libclang, libllvm, - flint3, + flint, mpfr, pplite, ocaml, @@ -39,7 +39,7 @@ buildDunePackage rec { buildInputs = [ arg-complete camlidl - flint3 + flint libclang mpfr pplite diff --git a/pkgs/development/r-modules/default.nix b/pkgs/development/r-modules/default.nix index b20f8bcefeb0..c1bd7fb54744 100644 --- a/pkgs/development/r-modules/default.nix +++ b/pkgs/development/r-modules/default.nix @@ -503,7 +503,7 @@ let pkg-config gmp.dev mpfr.dev - flint3 + flint ]; fingerPro = [ pkgs.gsl ]; Formula = [ pkgs.gmp ];