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

This commit is contained in:
Weijia Wang
2025-09-28 12:18:39 +00:00
committed by GitHub
17 changed files with 104 additions and 59 deletions
+26
View File
@@ -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
@@ -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 {
pname = "flint3";
stdenv.mkDerivation (finalAttrs: {
pname = "flint";
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";
};
}
})
+2 -2
View File
@@ -3,7 +3,7 @@
stdenv,
fetchFromGitHub,
autoreconfHook,
flint3,
flint,
gmp,
mpfr,
llvmPackages,
@@ -29,7 +29,7 @@ stdenv.mkDerivation (finalAttrs: {
];
buildInputs = [
flint3
flint
gmp
mpfr
]
+2 -2
View File
@@ -4,7 +4,7 @@
fetchFromGitHub,
autoreconfHook,
gmpxx,
flint3,
flint,
nauty,
}:
@@ -21,7 +21,7 @@ stdenv.mkDerivation (finalAttrs: {
buildInputs = [
gmpxx
flint3
flint
nauty
];
+19 -14
View File
@@ -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);
};
}
})
+2 -2
View File
@@ -3,7 +3,7 @@
lib,
fetchurl,
fetchpatch,
flint3,
flint,
gmp,
}:
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
};
buildInputs = [
flint3
flint
gmp
];
+2 -2
View File
@@ -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
+4 -4
View File
@@ -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.
+3 -3
View File
@@ -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
]
+2 -2
View File
@@ -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
+3 -3
View File
@@ -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
+2 -2
View File
@@ -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
];
@@ -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 ];
@@ -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
+1 -1
View File
@@ -503,7 +503,7 @@ let
pkg-config
gmp.dev
mpfr.dev
flint3
flint
];
fingerPro = [ pkgs.gsl ];
Formula = [ pkgs.gmp ];
+1
View File
@@ -901,6 +901,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
-4
View File
@@ -7371,10 +7371,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 {