[bug#78334,science-team,0/1] Update flint.

Message ID cover.1746805010.git.code@greghogan.com
Headers
Series Update flint. |

Message

Greg Hogan May 9, 2025, 3:39 p.m. UTC
Our current version, flint 3.1.2, fails for me with:

  CC  fft_small/mpn_mul.c
In file included from src/fft_small/mpn_mul.c:17:
src/fft_small/mpn_mul.c: In function ‘_mpn_from_ffts_8’:
./src/crt_helpers.h:120:3: error: ‘asm’ operand has impossible constraints
  120 |   __asm__ ("addq %23,%q7\nadcq %21,%q6\nadcq %19,%q5\n\tadcq %17,%q4\n\tadcq %15,%q3\n\tadcq %13,%q2\n\tadcq %11,%q1\n\tadcq %9,%q0"    \
      |   ^~~~~~~
./src/crt_helpers.h:378:5: note: in expansion of macro ‘add_ssssssssaaaaaaaaaaaaaaaa’
  378 |     add_ssssssssaaaaaaaaaaaaaaaa(z[7],z[6],z[5],z[4],z[3],z[2],z[1],z[0],
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/crt_helpers.h:120:3: error: ‘asm’ operand has impossible constraints
  120 |   __asm__ ("addq %23,%q7\nadcq %21,%q6\nadcq %19,%q5\n\tadcq %17,%q4\n\tadcq %15,%q3\n\tadcq %13,%q2\n\tadcq %11,%q1\n\tadcq %9,%q0"    \
      |   ^~~~~~~
./src/crt_helpers.h:378:5: note: in expansion of macro ‘add_ssssssssaaaaaaaaaaaaaaaa’
  378 |     add_ssssssssaaaaaaaaaaaaaaaa(z[7],z[6],z[5],z[4],z[3],z[2],z[1],z[0],
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:616: build/fft_small/mpn_mul.lo] Error 1
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "make" arguments: ("-j" "1") exit-status: 2 term-signal: #f stop-signal: #f>
phase `build' failed after 260.7 seconds
command "make" "-j" "1" failed with status 2
build process 18 exited with status 256

Greg Hogan (1):
  gnu: flint: Update to 3.2.1.

 gnu/packages/algebra.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


base-commit: c3b6b57521404d223ae37d3dd91f7bb60ed0cebc
  

Comments

Andreas Enge May 9, 2025, 3:52 p.m. UTC | #1
Hello,

Am Fri, May 09, 2025 at 03:39:18PM +0000 schrieb Greg Hogan:
> Our current version, flint 3.1.2, fails for me with:
>   CC  fft_small/mpn_mul.c
> In file included from src/fft_small/mpn_mul.c:17:
> src/fft_small/mpn_mul.c: In function ‘_mpn_from_ffts_8’:
> ./src/crt_helpers.h:120:3: error: ‘asm’ operand has impossible constraints
>   120 |   __asm__ ("addq %23,%q7\nadcq %21,%q6\nadcq %19,%q5\n\tadcq %17,%q4\n\tadcq %15,%q3\n\tadcq %13,%q2\n\tadcq %11,%q1\n\tadcq %9,%q0"    \

we can update flint, but this message may indicate a different problem,
which surprises me. Flint includes assembly code, but does not use fat
binaries such as gmp. So it is possible that assembly code chosen on the
build machine (avx or whatever) is not executable on the machine where
you run your own code linked to flint.

But we build the package with
   #:configure-flags '("--disable-assembly")
so the problem should not occur.

Maybe it is indeed a bug in the version we currently package.

Andreas
  
Greg Hogan May 9, 2025, 3:55 p.m. UTC | #2
On Fri, May 9, 2025 at 11:53 AM Andreas Enge <andreas@enge.fr> wrote:
>
> Hello,
>
> Am Fri, May 09, 2025 at 03:39:18PM +0000 schrieb Greg Hogan:
> > Our current version, flint 3.1.2, fails for me with:
> >   CC  fft_small/mpn_mul.c
> > In file included from src/fft_small/mpn_mul.c:17:
> > src/fft_small/mpn_mul.c: In function ‘_mpn_from_ffts_8’:
> > ./src/crt_helpers.h:120:3: error: ‘asm’ operand has impossible constraints
> >   120 |   __asm__ ("addq %23,%q7\nadcq %21,%q6\nadcq %19,%q5\n\tadcq %17,%q4\n\tadcq %15,%q3\n\tadcq %13,%q2\n\tadcq %11,%q1\n\tadcq %9,%q0"    \
>
> we can update flint, but this message may indicate a different problem,
> which surprises me. Flint includes assembly code, but does not use fat
> binaries such as gmp. So it is possible that assembly code chosen on the
> build machine (avx or whatever) is not executable on the machine where
> you run your own code linked to flint.

I'm building flint on the same machine as I built the rest of Guix.
And this is the flint build itself, not dependent code.

> But we build the package with
>    #:configure-flags '("--disable-assembly")
> so the problem should not occur.
>
> Maybe it is indeed a bug in the version we currently package.

v3.2.2 builds fine for me.
  
Andreas Enge May 12, 2025, 3:27 p.m. UTC | #3
Unfortunately this flint update breaks singular:
facMul.cc: In function ‘void kronSubFp(nmod_poly_struct*, const CanonicalForm&, int)’:
facMul.cc:1258:3: error: ‘flint_mpn_zero’ was not declared in this scope
 1258 |   flint_mpn_zero (result->coeffs, d*(degAy+1));
      |   ^~~~~~~~~~~~~~
facMul.cc:1267:5: error: ‘flint_mpn_copyi’ was not declared in this scope
 1267 |     flint_mpn_copyi (result->coeffs+k, buf->coeffs, nmod_poly_length(buf));
      |     ^~~~~~~~~~~~~~~

Which also means it breaks sage. This is very annoying, we cannot just
push it, but need to wait for the depending packages to adapt to whatever
change was made. Or ship several versions.

Bug report submitted:
   https://github.com/flintlib/flint/issues/2315

Andreas
  
Andreas Enge June 6, 2025, 1:18 p.m. UTC | #4
Hello Greg,

upstream does not intend to fix the problem.

In the meantime, I have updated flint to 3.1.3 and pushed after making
sure all dependents (of which sage) still build.

I suppose this does not solve your build problem?

We should try to update to 3.2.1 (see
   https://github.com/flintlib/flint/issues/2311
concerning 3.2.2); but this might force us to patch quite a few
upstream projects:
$ ./pre-inst-env guix build -P 1 flint
guix build: computing dependents of package flint@3.1.3...
/gnu/store/hxdxlay89xd257f0346igxbr08qsz7sz-flint-3.1.3
/gnu/store/fz75wpdqf4c05wxbm5wr26f0ri3rvakb-singular-4.4.0p8
/gnu/store/gh4905v8pchpmj5pn339vsk9an91g4pk-cm-0.4.3
/gnu/store/3jy8lgkwanf3bka9vwhlqvxr9mwamqk7-python-pynormaliz-2.21
/gnu/store/3jc1734h8j105y7bq2542z1pblpx5a16-msolve-0.7.3
/gnu/store/9jkvnbf9hgl2xspr7gyfcrabcmjqxqxb-python-flint-0.5.0
/gnu/store/svyx62248p96bb2ywmhl9ng67vc44j32-symengine-0.14.0
/gnu/store/h89qp3v60wmpyx55idpdl4z0cbwzg4k5-normaliz-3.10.4
/gnu/store/21wp3b5zas3iwx7z3i91i9dwp5grgn9h-paritwine-0.2.1
/gnu/store/bh2zcvdkl3p0jn0ccmic6n99i8df5m2b-s7-24.1-0.23a64fa
/gnu/store/dgypsfqsg18ch17g6fvn32ngpjlg3872-s7-bootstrap-24.1-0.23a64fa
/gnu/store/2x9bhnla2szgxkkr614mvli5v8877hid-clingo-lpx-1.3.0
/gnu/store/2yw5y418wh8pcmdid98q143bkaqky006-sage-10.6
(depending on how many depend on flint internals)

Andreas
  
Andreas Enge June 11, 2025, 5:23 p.m. UTC | #5
Hello Greg,

Am Fri, Jun 06, 2025 at 03:18:52PM +0200 schrieb Andreas Enge:
> We should try to update to 3.2.1

in the end this was not as bad as I had feared. I needed to make a new
release of paritwine, apart from that everything built, including sage.
So I have pushed the update to master, and at the same time also updated
python-flint for good measure.

Andreas