From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.bugs Subject: bug#10519: guile and (mini-)gmp Date: Fri, 10 Aug 2012 23:51:00 +0200 Message-ID: <874noawh4r.fsf@gnu.org> References: <874np05fwz.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1344635514 5189 80.91.229.3 (10 Aug 2012 21:51:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 10 Aug 2012 21:51:54 +0000 (UTC) Cc: 10519@debbugs.gnu.org, Torbjorn Granlund To: nisse@lysator.liu.se (Niels =?UTF-8?Q?M=C3=B6ller?=) Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri Aug 10 23:51:54 2012 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Szx7Z-00082W-OY for guile-bugs@m.gmane.org; Fri, 10 Aug 2012 23:51:53 +0200 Original-Received: from localhost ([::1]:46887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Szx7Y-0007IH-QH for guile-bugs@m.gmane.org; Fri, 10 Aug 2012 17:51:52 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Szx7U-0007I9-0n for bug-guile@gnu.org; Fri, 10 Aug 2012 17:51:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Szx7R-0002IX-JR for bug-guile@gnu.org; Fri, 10 Aug 2012 17:51:47 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38101) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Szx7R-0002IJ-Fb for bug-guile@gnu.org; Fri, 10 Aug 2012 17:51:45 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SzxFS-0001r0-2K for bug-guile@gnu.org; Fri, 10 Aug 2012 18:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 10 Aug 2012 22:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10519 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 10519-submit@debbugs.gnu.org id=B10519.13446359667058 (code B ref 10519); Fri, 10 Aug 2012 22:00:02 +0000 Original-Received: (at 10519) by debbugs.gnu.org; 10 Aug 2012 21:59:26 +0000 Original-Received: from localhost ([127.0.0.1]:47646 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SzxEq-0001pm-VO for submit@debbugs.gnu.org; Fri, 10 Aug 2012 17:59:25 -0400 Original-Received: from xanadu.aquilenet.fr ([88.191.123.111]:48637) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SzxEn-0001pc-NX for 10519@debbugs.gnu.org; Fri, 10 Aug 2012 17:59:23 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by xanadu.aquilenet.fr (Postfix) with ESMTP id 1EA5011F0; Fri, 10 Aug 2012 23:51:02 +0200 (CEST) Original-Received: from xanadu.aquilenet.fr ([127.0.0.1]) by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wy1uHCj4fgGT; Fri, 10 Aug 2012 23:51:02 +0200 (CEST) Original-Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by xanadu.aquilenet.fr (Postfix) with ESMTPSA id 590C82B8; Fri, 10 Aug 2012 23:51:01 +0200 (CEST) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 24 Thermidor an 220 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu In-Reply-To: ("Niels \=\?iso-8859-1\?Q\?M\=F6ller\=22's\?\= message of "Mon, 23 Jul 2012 01:17:51 +0200") User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.1 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:6471 Archived-At: Hi Niels, nisse@lysator.liu.se (Niels M=C3=B6ller) skribis: > ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> Reviving the discussion, as we=E2=80=99ve been discussing this at the GH= M, and >> some people would really like to see it happen. :-) > > Great! Any summary of the discussion, for those of us who couldn't make > it there? Mostly a few people reaffirmed the need for this. > I'm attaching a patch from I tree I have around, without reading it > carefully. I'm not sure this is the latest version I worked with. Maybe > it's of some use. Yes, thanks. I just tried it, and here=E2=80=99s the status: - numbers.c uses =E2=80=98GMP_NUMB_BITS=E2=80=99, which is lacking; - it also still uses mpq=E2=80=99s, as Mark noted; - random.c uses =E2=80=98mpz_realloc2=E2=80=99, also lacking. >>> 1. The header file libguile.h. As far as I understand, this is a public >>> header file and it's use of means that the public guile ABI >>> depends on gmp. >> >> The problem is that there=E2=80=99s a public API dealing with mpz_t: > > Exactly. To me, that seems like a potentially hairy problem to get > right. > >> SCM_API void scm_to_mpz (SCM x, mpz_t rop); >> SCM_API SCM scm_from_mpz (mpz_t rop); >> >> So, when mini-gmp is used, a header should be installed as well, >> say under . WDYT? > > Maybe it would make sense with a level of indirection. User's could > include libguile/bignum.h, which would in turn include either mini-gmp.h > or the real gmp.h, depending on how guile was configured. Users are only supposed to include ; headers under libguile/ aren=E2=80=99t meant to be included directly. Currently including pulls . When mini-GMP is used instead, then would be pulled instead, transparently. > 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. >>> Since mini-gmp is not binary compatible, >> >> I don=E2=80=99t think there=E2=80=99s a problem, because only mpz_t obje= cts appear in >> the API, and they=E2=80=99re pointers. [...] > Hmm, or if you're saying that the use of mpz_t in guile's public API is > pointers only, that that might make things a little simpler. But things > will still break badly if the user's code is linked with gmp and guile > uses mini-gmp, or vice versa. Exactly, that=E2=80=99s the only case where it would break, AFAICS. And it= =E2=80=99s probably an unlikely use case: users who want to use both GMP and Guile surely have libguile linked against GMP. >>> 4. mini-gmp has no mp_set_memory_functions. > > That's added now, with the subtle difference that mini-gmp doesn't pass > a valid size for the old_size argument for the free and realloc > functions. I don't think guile depends on that feature. No, it doesn=E2=80=99t. I=E2=80=99m slightly concerned about mini-gmp, though. It=E2=80=99s almost= 5000 lines, mostly copied from GMP AIUI, but with no way to synchronize. How do you consider the maintenance cost of this? I understand some people want this, and I=E2=80=99m happy you=E2=80=99re he= lping, but the amount of work and duplication involved would definitely be a showstopper for me if you and Mark weren=E2=80=99t helping. Thanks, Ludo=E2=80=99.