From 4966f075ca3027a87a6f942c4569cd2439b828bf Mon Sep 17 00:00:00 2001 From: Volker Braun Date: Sun, 15 Jun 2025 15:00:47 +0200 Subject: [PATCH 1/2] Upgrade to flint-3.3.0 --- .../patches/flint-3.3.0-compatibility.patch | 41 +++++++++++++++++++ build/pkgs/flint/checksums.ini | 4 +- build/pkgs/flint/package-version.txt | 2 +- .../patches/flint-3.3.0-compatibility.patch | 26 ++++++++++++ 4 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 build/pkgs/eclib/patches/flint-3.3.0-compatibility.patch create mode 100644 build/pkgs/singular/patches/flint-3.3.0-compatibility.patch diff --git a/build/pkgs/eclib/patches/flint-3.3.0-compatibility.patch b/build/pkgs/eclib/patches/flint-3.3.0-compatibility.patch new file mode 100644 index 00000000000..87c52de5f56 --- /dev/null +++ b/build/pkgs/eclib/patches/flint-3.3.0-compatibility.patch @@ -0,0 +1,41 @@ +diff --git a/libsrc/eclib/flinterface.h b/libsrc/eclib/flinterface.h +index a74049d..b9a582e 100644 +--- a/libsrc/eclib/flinterface.h ++++ b/libsrc/eclib/flinterface.h +@@ -58,14 +58,22 @@ typedef struct + hlimb_t * entries; + slong r; + slong c; ++#if (__FLINT_VERSION==3)&&(__FLINT_VERSION_MINOR<3) + hlimb_t ** rows; ++#else ++ slong stride; ++#endif + nmod_t mod; + } + hmod_mat_struct; + + typedef hmod_mat_struct hmod_mat_t[1]; + ++#if (__FLINT_VERSION==3)&&(__FLINT_VERSION_MINOR<3) + #define hmod_mat_entry(mat,i,j) ((mat)->rows[(i)][(j)]) ++#else ++#define hmod_mat_entry nmod_mat_entry ++#endif + #define hmod_mat_nrows(mat) ((mat)->r) + #define hmod_mat_ncols(mat) ((mat)->c) + +diff --git a/libsrc/mat.cc b/libsrc/mat.cc +index b0c6c08..948fc24 100644 +--- a/libsrc/mat.cc ++++ b/libsrc/mat.cc +@@ -1602,7 +1602,9 @@ hmod_mat_clear(hmod_mat_t mat) + if (mat->entries) + { + flint_free(mat->entries); ++#if (__FLINT_VERSION==3)&&(__FLINT_VERSION_MINOR<3) + flint_free(mat->rows); ++#endif + } + } + diff --git a/build/pkgs/flint/checksums.ini b/build/pkgs/flint/checksums.ini index b7ccee17ce3..1edcbee7f06 100644 --- a/build/pkgs/flint/checksums.ini +++ b/build/pkgs/flint/checksums.ini @@ -1,4 +1,4 @@ tarball=flint-VERSION.tar.gz -sha1=ebca3a55e48373c2eeee6c172051f3177845e121 -sha256=577d7729e4c2e79ca1e894ad2ce34bc73516a92f623d42562694817f888a17eb +sha1=1e60a03c108b3240cb3341c0d9f462ad0760e697 +sha256=d9ae0f1318253727068270dbfa3c4b55155e3f4b7be6ca9c056e58f2838f15b3 upstream_url=https://github.com/flintlib/flint/releases/download/vVERSION/flint-VERSION.tar.gz diff --git a/build/pkgs/flint/package-version.txt b/build/pkgs/flint/package-version.txt index be94e6f53db..15a27998172 100644 --- a/build/pkgs/flint/package-version.txt +++ b/build/pkgs/flint/package-version.txt @@ -1 +1 @@ -3.2.2 +3.3.0 diff --git a/build/pkgs/singular/patches/flint-3.3.0-compatibility.patch b/build/pkgs/singular/patches/flint-3.3.0-compatibility.patch new file mode 100644 index 00000000000..588e130c837 --- /dev/null +++ b/build/pkgs/singular/patches/flint-3.3.0-compatibility.patch @@ -0,0 +1,26 @@ +diff --git a/factory/FLINTconvert.cc b/factory/FLINTconvert.cc +index c36f6022d..67c271c5a 100644 +--- a/factory/FLINTconvert.cc ++++ b/factory/FLINTconvert.cc +@@ -652,7 +652,7 @@ convertFacCFMatrix2Fq_nmod_mat_t (fq_nmod_mat_t M, + { + for(j=m.columns();j>0;j--) + { +- convertFacCF2nmod_poly_t (M->rows[i-1]+j-1, m (i,j)); ++ convertFacCF2nmod_poly_t (fq_nmod_mat_entry (M, i-1, j-1), m (i,j)); + } + } + } +diff --git a/libpolys/polys/flintconv.cc b/libpolys/polys/flintconv.cc +index 89152f5e4..56d527c16 100644 +--- a/libpolys/polys/flintconv.cc ++++ b/libpolys/polys/flintconv.cc +@@ -331,7 +331,7 @@ void convSingMFlintFq_nmod_mat(matrix m, fq_nmod_mat_t M, const fq_nmod_ctx_t fq + { + for(j=MATCOLS(m);j>0;j--) + { +- convSingPFlintnmod_poly_t (M->rows[i-1]+j-1, MATELEM(m,i,j),r); ++ convSingPFlintnmod_poly_t (fq_nmod_mat_entry (M, i-1, j-1), MATELEM(m,i,j),r); + } + } + } From bd8c9ab1ed9a5e9c0b31c512e2fb51409ad0556e Mon Sep 17 00:00:00 2001 From: Volker Braun Date: Mon, 16 Jun 2025 18:53:51 +0200 Subject: [PATCH 2/2] Build flint with -fno-strict-aliasing Flint miscompiles with gcc 15, workaround is to compile with -fno-strict-aliasing This is also what Fedora does: https://src.fedoraproject.org/rpms/flint/blob/rawhide/f/flint.spec#_97-98 See https://github.com/flintlib/flint/issues/2340 for upstream bug report --- build/pkgs/flint/spkg-build.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/pkgs/flint/spkg-build.in b/build/pkgs/flint/spkg-build.in index ffb822c8a97..30f370e2d10 100644 --- a/build/pkgs/flint/spkg-build.in +++ b/build/pkgs/flint/spkg-build.in @@ -1,3 +1,7 @@ cd src + +# See https://github.com/flintlib/flint/issues/2340 +export CFLAGS="$CFLAGS -fno-strict-aliasing" + sdh_configure sdh_make