flint, ntl: Fix pkgsStatic builds, clean-up derivations (#445050)

authored by Weijia Wang and committed by GitHub e0fd47c4 b0c704f1

+104 -59
+26
pkgs/by-name/fl/flint/checkPhase.patch
··· 1 + https://github.com/flintlib/flint/pull/2411 2 + 3 + From 9957b17e6b08bd57790f7da1344b4d92eefc0b38 Mon Sep 17 00:00:00 2001 4 + From: Ross Smyth <18294397+RossSmyth@users.noreply.github.com> 5 + Date: Sun, 21 Sep 2025 15:58:57 -0400 6 + Subject: [PATCH] Fix duplicate symbols linker error 7 + 8 + When I run `make check` I get linker errors without 9 + this patch 10 + --- 11 + src/double_interval.h | 2 +- 12 + 1 file changed, 1 insertion(+), 1 deletion(-) 13 + 14 + diff --git a/src/double_interval.h b/src/double_interval.h 15 + index a423257db2..5f685c283f 100644 16 + --- a/src/double_interval.h 17 + +++ b/src/double_interval.h 18 + @@ -13,7 +13,7 @@ 19 + #define DOUBLE_INTERVAL_H 20 + 21 + #ifdef DOUBLE_INTERVAL_INLINES_C 22 + -#define DOUBLE_INTERVAL_INLINE 23 + +#define DOUBLE_INTERVAL_INLINE static 24 + #else 25 + #define DOUBLE_INTERVAL_INLINE static inline 26 + #endif
+2 -2
pkgs/by-name/ms/msolve/package.nix
··· 3 3 stdenv, 4 4 fetchFromGitHub, 5 5 autoreconfHook, 6 - flint3, 6 + flint, 7 7 gmp, 8 8 mpfr, 9 9 llvmPackages, ··· 29 29 ]; 30 30 31 31 buildInputs = [ 32 - flint3 32 + flint 33 33 gmp 34 34 mpfr 35 35 ]
+2 -2
pkgs/by-name/no/normaliz/package.nix
··· 4 4 fetchFromGitHub, 5 5 autoreconfHook, 6 6 gmpxx, 7 - flint3, 7 + flint, 8 8 nauty, 9 9 }: 10 10 ··· 21 21 22 22 buildInputs = [ 23 23 gmpxx 24 - flint3 24 + flint 25 25 nauty 26 26 ]; 27 27
+19 -14
pkgs/by-name/nt/ntl/package.nix
··· 13 13 14 14 assert withGf2x -> gf2x != null; 15 15 16 - stdenv.mkDerivation rec { 16 + stdenv.mkDerivation (finalAttrs: { 17 17 pname = "ntl"; 18 18 version = "11.5.1"; 19 19 20 20 src = fetchurl { 21 - url = "http://www.shoup.net/ntl/ntl-${version}.tar.gz"; 22 - sha256 = "sha256-IQ0GwxMGy8bq9oFEU8Vsd22djo3zbXTrMG9qUj0caoo="; 21 + url = "http://www.shoup.net/ntl/ntl-${finalAttrs.version}.tar.gz"; 22 + hash = "sha256-IQ0GwxMGy8bq9oFEU8Vsd22djo3zbXTrMG9qUj0caoo="; 23 23 }; 24 24 25 + strictDeps = true; 26 + depsBuildBuild = [ 27 + perl # needed for ./configure 28 + ]; 25 29 buildInputs = [ 26 30 gmp 27 31 ]; 28 32 29 - nativeBuildInputs = [ 30 - perl # needed for ./configure 31 - ]; 32 - 33 - sourceRoot = "${pname}-${version}/src"; 33 + sourceRoot = "ntl-${finalAttrs.version}/src"; 34 34 35 35 enableParallelBuilding = true; 36 36 ··· 42 42 configurePlatforms = [ ]; 43 43 44 44 # reference: http://shoup.net/ntl/doc/tour-unix.html 45 + dontAddStaticConfigureFlags = true; # perl config doesn't understand it. 45 46 configureFlags = [ 46 47 "DEF_PREFIX=$(out)" 47 - "SHARED=on" # genereate a shared library (as well as static) 48 48 "NATIVE=off" # don't target code to current hardware (reproducibility, portability) 49 49 "TUNE=${ 50 50 if tune then ··· 55 55 "generic" # "chooses options that should be OK for most platforms" 56 56 }" 57 57 "CXX=${stdenv.cc.targetPrefix}c++" 58 + "AR=${stdenv.cc.targetPrefix}ar" 59 + ] 60 + ++ lib.optionals (!stdenv.hostPlatform.isStatic) [ 61 + "SHARED=on" # genereate a shared library 58 62 ] 59 63 ++ lib.optionals withGf2x [ 60 64 "NTL_GF2X_LIB=on" 61 65 "GF2X_PREFIX=${gf2x}" 62 66 ]; 63 67 68 + enableParallelChecking = true; 64 69 doCheck = true; # takes some time 65 70 66 - meta = with lib; { 71 + meta = { 67 72 description = "Library for doing Number Theory"; 68 73 longDescription = '' 69 74 NTL is a high-performance, portable C++ library providing data ··· 76 81 homepage = "http://www.shoup.net/ntl/"; 77 82 # also locally at "${src}/doc/tour-changes.html"; 78 83 changelog = "https://www.shoup.net/ntl/doc/tour-changes.html"; 79 - teams = [ teams.sage ]; 80 - license = licenses.gpl2Plus; 81 - platforms = platforms.all; 84 + teams = [ lib.teams.sage ]; 85 + license = lib.licenses.gpl2Plus; 86 + platforms = lib.platforms.all; 82 87 # Does not cross compile 83 88 # https://github.com/libntl/ntl/issues/8 84 89 broken = !(stdenv.buildPlatform.canExecute stdenv.hostPlatform); 85 90 }; 86 - } 91 + })
+2 -2
pkgs/by-name/pp/pplite/package.nix
··· 3 3 lib, 4 4 fetchurl, 5 5 fetchpatch, 6 - flint3, 6 + flint, 7 7 gmp, 8 8 }: 9 9 ··· 17 17 }; 18 18 19 19 buildInputs = [ 20 - flint3 20 + flint 21 21 gmp 22 22 ]; 23 23
+2 -2
pkgs/by-name/s7/s7/package.nix
··· 3 3 fetchFromGitLab, 4 4 stdenv, 5 5 6 - flint3, 6 + flint, 7 7 gmp, 8 8 libmpc, 9 9 mpfr, ··· 37 37 }; 38 38 39 39 buildInputs = 40 - lib.optional withArb flint3 40 + lib.optional withArb flint 41 41 ++ lib.optionals withGMP [ 42 42 gmp 43 43 mpfr
+4 -4
pkgs/by-name/sa/sage/package.nix
··· 17 17 self: super: { 18 18 # `sagelib`, i.e. all of sage except some wrappers and runtime dependencies 19 19 sagelib = self.callPackage ./sagelib.nix { 20 - inherit flint3; 20 + inherit flint; 21 21 inherit sage-src env-locations singular; 22 22 inherit (maxima) lisp-compiler; 23 23 linbox = pkgs.linbox; ··· 79 79 python3 80 80 singular 81 81 palp 82 - flint3 82 + flint 83 83 pythonEnv 84 84 maxima 85 85 ; ··· 142 142 extraLibs = pythonRuntimeDeps; 143 143 }; # make the libs accessible 144 144 145 - singular = pkgs.singular.override { inherit flint3; }; 145 + singular = pkgs.singular.override { inherit flint; }; 146 146 147 147 maxima = pkgs.maxima-ecl.override { 148 148 lisp-compiler = pkgs.ecl.override { ··· 164 164 # openblas instead of openblasCompat. Apparently other packages somehow use flints 165 165 # blas when it is available. Alternative would be to override flint to use 166 166 # openblasCompat. 167 - flint3 = pkgs.flint3.override { withBlas = false; }; 167 + flint = pkgs.flint.override { withBlas = false; }; 168 168 169 169 # Multiple palp dimensions need to be available and sage expects them all to be 170 170 # in the same folder.
+3 -3
pkgs/by-name/sa/sage/sage-env.nix
··· 43 43 rubiks, 44 44 blas, 45 45 lapack, 46 - flint3, 46 + flint, 47 47 gmp, 48 48 mpfr, 49 49 zlib, ··· 167 167 export LDFLAGS='${ 168 168 lib.concatStringsSep " " ( 169 169 map (pkg: "-L${pkg}/lib") [ 170 - flint3 170 + flint 171 171 gap 172 172 glpk 173 173 gmp ··· 187 187 singular 188 188 gmp.dev 189 189 glpk 190 - flint3 190 + flint 191 191 gap 192 192 mpfr.dev 193 193 ]
+2 -2
pkgs/by-name/sa/sage/sagelib.nix
··· 21 21 eclib, 22 22 ecm, 23 23 fflas-ffpack, 24 - flint3, 24 + flint, 25 25 gap, 26 26 giac, 27 27 givaro, ··· 136 136 eclib 137 137 ecm 138 138 fflas-ffpack 139 - flint3 139 + flint 140 140 gap 141 141 giac 142 142 givaro
+3 -3
pkgs/by-name/si/singular/package.nix
··· 15 15 sharutils, 16 16 file, 17 17 getconf, 18 - flint3, 18 + flint, 19 19 ntl, 20 20 mpfr, 21 21 cddlib, ··· 52 52 configureFlags = [ 53 53 "--enable-gfanlib" 54 54 "--with-ntl=${ntl}" 55 - "--with-flint=${flint3}" 55 + "--with-flint=${flint}" 56 56 ] 57 57 ++ lib.optionals enableDocs [ 58 58 "--enable-doc-build" ··· 88 88 buildInputs = [ 89 89 # necessary 90 90 gmp 91 - flint3 91 + flint 92 92 # by upstream recommended but optional 93 93 ncurses 94 94 readline
+2 -2
pkgs/by-name/sy/symengine/package.nix
··· 4 4 fetchFromGitHub, 5 5 cmake, 6 6 gmp, 7 - flint3, 7 + flint, 8 8 mpfr, 9 9 libmpc, 10 10 withShared ? true, ··· 25 25 26 26 buildInputs = [ 27 27 gmp 28 - flint3 28 + flint 29 29 mpfr 30 30 libmpc 31 31 ];
+31 -14
pkgs/development/libraries/flint/3.nix pkgs/by-name/fl/flint/package.nix
··· 2 2 lib, 3 3 stdenv, 4 4 fetchurl, 5 - gmp, 6 - mpfr, 7 - ntl, 5 + fetchpatch, 8 6 windows, 9 7 autoconf, 10 8 automake, 11 9 gettext, 12 10 libtool, 13 - openblas ? null, 11 + gmp, 12 + mpfr, 13 + ntl, 14 14 blas, 15 15 lapack, 16 + boehmgc, 17 + openblas ? null, 16 18 withBlas ? true, 17 19 withNtl ? !ntl.meta.broken, 20 + withGc ? false, 18 21 }: 19 22 20 23 assert 21 24 withBlas 22 25 -> openblas != null && blas.implementation == "openblas" && lapack.implementation == "openblas"; 23 26 24 - stdenv.mkDerivation rec { 25 - pname = "flint3"; 27 + stdenv.mkDerivation (finalAttrs: { 28 + pname = "flint"; 26 29 version = "3.3.1"; 27 30 28 31 src = fetchurl { 29 - url = "https://flintlib.org/download/flint-${version}.tar.gz"; 32 + url = "https://flintlib.org/download/flint-${finalAttrs.version}.tar.gz"; 30 33 hash = "sha256-ZNcOUTB2z6lx4EELWMHaXTURKRPppWtE4saBtFnT6vs="; 31 34 }; 32 35 36 + patches = [ 37 + # Remove once/if https://github.com/flintlib/flint/pull/2411 is merged 38 + # Required or else during the check phase the build fails while 39 + # linking a test due to duplicate symbol errors 40 + ./checkPhase.patch 41 + ]; 42 + 43 + strictDeps = true; 33 44 nativeBuildInputs = [ 34 45 autoconf 35 46 automake ··· 50 61 ++ lib.optionals withNtl [ 51 62 ntl 52 63 ] 64 + ++ lib.optionals withGc [ 65 + boehmgc 66 + ] 53 67 ++ lib.optionals stdenv.hostPlatform.isMinGW [ 54 68 windows.pthreads 55 69 ]; ··· 70 84 ] 71 85 ++ lib.optionals withNtl [ 72 86 "--with-ntl=${ntl}" 87 + ] 88 + ++ lib.optionals withGc [ 89 + "--with-gc=${boehmgc}" 73 90 ]; 74 91 75 92 enableParallelBuilding = true; 76 - 93 + enableParallelChecking = true; 77 94 doCheck = true; 78 95 79 - meta = with lib; { 96 + meta = { 80 97 description = "Fast Library for Number Theory"; 81 - license = licenses.lgpl3Plus; 82 - maintainers = with maintainers; [ smasher164 ]; 83 - teams = [ teams.sage ]; 84 - platforms = platforms.all; 98 + license = lib.licenses.lgpl3Plus; 99 + maintainers = [ lib.maintainers.smasher164 ]; 100 + teams = [ lib.teams.sage ]; 101 + platforms = lib.platforms.all; 85 102 homepage = "https://www.flintlib.org/"; 86 103 downloadPage = "https://www.flintlib.org/downloads.html"; 87 104 }; 88 - } 105 + })
+2 -2
pkgs/development/ocaml-modules/apron/default.nix
··· 10 10 findlib, 11 11 camlidl, 12 12 mlgmpidl, 13 - flint3, 13 + flint, 14 14 pplite, 15 15 }: 16 16 ··· 34 34 mpfr 35 35 ppl 36 36 camlidl 37 - flint3 37 + flint 38 38 pplite 39 39 ]; 40 40 propagatedBuildInputs = [ mlgmpidl ];
+2 -2
pkgs/development/ocaml-modules/mopsa/default.nix
··· 5 5 clang, 6 6 libclang, 7 7 libllvm, 8 - flint3, 8 + flint, 9 9 mpfr, 10 10 pplite, 11 11 ocaml, ··· 39 39 buildInputs = [ 40 40 arg-complete 41 41 camlidl 42 - flint3 42 + flint 43 43 libclang 44 44 mpfr 45 45 pplite
+1 -1
pkgs/development/r-modules/default.nix
··· 503 503 pkg-config 504 504 gmp.dev 505 505 mpfr.dev 506 - flint3 506 + flint 507 507 ]; 508 508 fingerPro = [ pkgs.gsl ]; 509 509 Formula = [ pkgs.gmp ];
+1
pkgs/top-level/aliases.nix
··· 901 901 flashrom-stable = flashprog; # Added 2024-03-01 902 902 flatbuffers_2_0 = flatbuffers; # Added 2022-05-12 903 903 flatcam = throw "flatcam has been removed because it is unmaintained since 2022 and doesn't support Python > 3.10"; # Added 2025-01-25 904 + flint3 = flint; # Added 2025-09-21 904 905 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 905 906 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 906 907 flow-editor = flow-control; # Added 2025-03-05
-4
pkgs/top-level/all-packages.nix
··· 7371 7371 }; 7372 7372 fftwMpi = fftw.override { enableMpi = true; }; 7373 7373 7374 - flint = flint3; 7375 - 7376 - flint3 = callPackage ../development/libraries/flint/3.nix { }; 7377 - 7378 7374 fltk13 = callPackage ../development/libraries/fltk { }; 7379 7375 fltk14 = callPackage ../development/libraries/fltk/1.4.nix { }; 7380 7376 fltk13-minimal = fltk13.override {