Help with some mpn function to package flint using gmp instead of mpir

Torbjorn Granlund tg at
Wed Jul 31 20:53:23 CEST 2013

Paulo César Pereira de Andrade
< at> writes:

    I have been packaging sagemath since early sagemath 3.x in Mandriva,
  and recently have been packaging in Fedora also. Only yesterday I had
  time to start working on packaging sagemath 5.10, but learned that now
  it requires flint 2.3, and that (flint 2.3) uses several mpir internals not
  available in gmp.
    I cannot easily build flint using mpir if willing to use system packages,
  because everything else uses gmp, and system wide, mpir is not an
  alternative to gmp, that is, it is not the owner of gmp headers, so, there
  are conflicts starting there...
    So, my initial patch looks like this:
  -            mpn_com_n(arr, ptr->_mp_d, size);
  +            mpn_copyi(arr, ptr->_mp_d, size);
  +            mpn_com(arr, ptr->_mp_d, size);
Are you sure the mpn_copyi call should be there?

  -            mpn_com_n(p, p, l);
  +            mpn_com(p, p, l);
  -         mpn_neg_n(coeffs_f[i], coeff, size_j);
  +         mpn_neg(coeffs_f[i], coeff, size_j);
The MPIR folks are not up-to-date with the current GMP interface.
Their claim of GMP compatibility is false.

  but I am unsure how to patch the next ones:
  In function `_fft_mulmod_2expp1':
  /home/pcpa/rpmbuild/BUILD/flint-2.3/fft/mulmod_2expp1.c:124: undefined
  reference to `mpn_mulmod_2expp1'
Unfortunately I don't know what these functions do.  They might be
renamed from some internal GMP functions (we indeed have similarly named
functions).  One should not depend on internal functions, so we cannot
recommend renaming the calls back.

  maybe I can just cut&paste these?
  the next one I am not sure, but could just cut&paste mpir implementation
  in flint source as a patch, as the implementation appears to be small/simple
You should evaluate the MPIR copyright policy before doing anything of
the sort.  They have shown to have a *very* relaxed attitude towards
copyright, which may or may not be compatible with your projects.

(GMP requires FSF paperwork, even if that is turning into a nightmare,
given that FSF manages its part of this quite poorly.)

  In function `butterfly_lshB':
  /home/pcpa/rpmbuild/BUILD/flint-2.3/fft/butterfly_lshB.c:59: undefined
  reference to `__gmpn_sumdiff_n'
I don't know what that function is supposed to do.  Given its name, it
appears to be a GMP function, but alas it is not.

I am afraid I cannot be of much help in this project.


More information about the gmp-discuss mailing list