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

Paulo César Pereira de Andrade at
Wed Jul 31 23:00:09 CEST 2013

2013/7/31 Torbjorn Granlund <tg at>:
> 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?

  Sorry for adding this noise. It is indeed wrong. It was just the
start of an attempt to patch it to use gmp...

>   -            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:
>   /home/pcpa/rpmbuild/BUILD/flint-2.3/libflint.a(fft_mulmod_2expp1.o):
>   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
>   enough:
> 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.)
>   /home/pcpa/rpmbuild/BUILD/flint-2.3/libflint.a(fft_butterfly_lshB.o):
>   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 missed some s/mpir.h/gmp.h/ and it ended up gmp'izing the name:

/home/pcpa/rpmbuild/BUILD/flint-2.3/ "mpir.h"
/home/pcpa/rpmbuild/BUILD/flint-2.3/ "mpir.h"
printf("#include \"mpir.h\"\n\n");

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

  No problems, and many thanks for the comments. I am just
trying to glue everything together to have a functional package,
and be able to upgrade my sagemath rpm package to 5.10.

> --
> Torbjörn


More information about the gmp-discuss mailing list