GNU bug report logs - #10519
guile and (mini-)gmp

Previous Next

Package: guile;

Reported by: nisse <at> lysator.liu.se (Niels Möller)

Date: Sun, 15 Jan 2012 22:01:02 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: nisse <at> lysator.liu.se (Niels Möller)
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 10519 <at> debbugs.gnu.org, Torbjorn Granlund <tg <at> gmplib.org>
Subject: bug#10519: guile and (mini-)gmp
Date: Sat, 11 Aug 2012 11:37:35 +0200
ludo <at> gnu.org (Ludovic Courtès) writes:

> Yes, thanks.  I just tried it, and here’s the status:
>
>   - numbers.c uses ‘GMP_NUMB_BITS’, which is lacking;

If that's really needed, it can be substituted with something like
  
  #ifndef GMP_NUMB_BITS
  #include <limits.h>
  #define GMP_NUMB_BITS (CHAR_BIT*sizeof(mp_limb_t))
  #endif

I hesitate to add it to mini-gmp.h, unless I can find a way to define it
without relying on limits.h or autoconf.

>   - it also still uses mpq’s, as Mark noted;

This is being addressed, I hope.

>   - random.c uses ‘mpz_realloc2’, also lacking.

That call could be conditional on HAVE_LIBGMP, I think.

> Currently including <libguile.h> pulls <gmp.h>.  When mini-GMP is used
> instead, then <libguile/mini-gmp.h> would be pulled instead,
> transparently.

Might work. You'd need to document that a guile application which wants
to work with mini-gmp should never include gmp.h directly.

>> Users may also need some way of figuring out if they need to link with
>> -lgmp or not.
>
> libguile-2.0.la and guile-2.0.pc would provide that info.

And on ELF-systems, you should record the dependency (or lack thereof)
directly in libguile.so.

> I’m slightly concerned about mini-gmp, though.  It’s almost 5000 lines,
> mostly copied from GMP AIUI, but with no way to synchronize.  How do you
> consider the maintenance cost of this?

My view is that you should copy mini-gmp from some gmp release or from
the main gmp repo. When you have a version which works for you, you
shouldn't need to modify it or update it very often (maybe once for each
gmp release or so).

And if you need to make any modifications, you ought to bug-report the
corresponding problem. Hopefully, problems can be fixed in the gmp repo,
so that guile can simply upgrade to the latest version from the gmp
repo, rather than maintaining your own changes.

The GMP developers have also considered adding #ifdef:ery in mini-gmp.c,
to let the application specify precisely which features are wanted.

(And I'm not sure what you mean with "GMP AIUI").

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.




This bug report was last modified 8 years and 217 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.