make failure trying to build gmp-5.1.0a on Tru64unix v5.1b system

Bill.Glessner at cwu.EDU Bill.Glessner at cwu.EDU
Tue Feb 19 21:32:23 CET 2013


Hello,

The patch below to ./mini-gmp/mini.gmp.c resolved the assert issue.
The GMP-5.1.1 release using '--disable-cxx' option in the ./configure run
built and tested successfully. 
My original report with
>>>   mp_limb_t dpVAL;
>>>   dpVAL = dp[dn-1];
>>>   assert ((dpVAL & GMP_LIMB_HIGHBIT) != 0);
was not intended as an actual attempt to fix anything, only a way to
confirm that the array reference in the assert was involved in producing
the make exception that I observed.

Restoring the '--enable-cxx CPPFLAGS=-D__USE_STD_IOSTREAM' on the
configure run and adding '#include <algorithm>' to the top of the
./cxx/limits.cc file resulted in the subsequent 'make' being successful.
However, the 'make check' failed in the ./tests/cxx part. 
Removing the '#include <algorithm>' from the top of the ./cxx/limits.cc
file and adding it to the top of the ./gmpxx.h file, 

...
#include <iosfwd>

#include <algorithm> /* suggested fix for std::swap */
#include <cstring>  /* for strlen */
...

which is probably what Marc meant in his message, resulted in the 'make'
run copleting successfully.
The 'make check' run produced some unresolved references to trunc, ceil and
floor for ./tests/cxx/t-ops2.cc. Changing 'include <cmath>' to 
'include <math>' and adding '-lm' to the ./tests/cxx/Makefile line for
building t-ops2 removed the last 'make check' issues and the 'make check'
was successful.

Thank you for your assistance with getting GMP-5.1.1 to build on the
Tru64unix 5.1B platform. If I can be of any further help, please let me
know.

Regards,
Bill

>Return-path: <bodrato at mail.dm.unipi.it>
>Date: Sat, 16 Feb 2013 10:55:11 +0100 (CET)
>From: bodrato at mail.dm.unipi.it
>Subject: [SPAM] Re: make failure trying to build gmp-5.1.0a on Tru64unix v5.1b
> system
>To: gmp-bugs at gmplib.org
>Cc: bill.glessner at cwu.edu
>
>Ciao,
>
>Il Sab, 16 Febbraio 2013 8:23 am, Niels ha scritto:
>> Bill.Glessner at cwu.EDU writes:
>
>>> Replace
>>>
>>> /*  assert ((dp[dn-1] & GMP_LIMB_HIGHBIT) != 0); */
>>>
>>>> With
>>>
>>>   mp_limb_t dpVAL;
>>>   dpVAL = dp[dn-1];
>>>   assert ((dpVAL & GMP_LIMB_HIGHBIT) != 0);
>>
>> I really don't like adding extra variables just for use in the assert.
>
>In both functions, we already have a copy of dp[dn-1] in another variable.
>Can you please try the attached patch?
>
>Regards,
>m
>
>-- 
>http://bodrato.it/toom-cook/binary/
>
>diff -ru a/mini-gmp/mini-gmp.c b/mini-gmp/mini-gmp.c
>--- a/mini-gmp/mini-gmp.c	2013-02-16 10:30:50.000000000 +0100
>+++ b/mini-gmp/mini-gmp.c	2013-02-16 10:43:43.000000000 +0100
>@@ -930,11 +930,11 @@
> 
>   assert (dn > 2);
>   assert (nn >= dn);
>-  assert ((dp[dn-1] & GMP_LIMB_HIGHBIT) != 0);
> 
>   d1 = dp[dn - 1];
>   d0 = dp[dn - 2];
> 
>+  assert ((d1 & GMP_LIMB_HIGHBIT) != 0);
>   /* Iteration variable is the index of the q limb.
>    *
>    * We divide <n1, np[dn-1+i], np[dn-2+i], np[dn-3+i],..., np[i]>
>@@ -994,7 +994,9 @@
>       mp_limb_t nh;
>       unsigned shift;
> 
>-      assert (dp[dn-1] & GMP_LIMB_HIGHBIT);
>+      assert (inv->d1 == dp[dn-1]);
>+      assert (inv->d0 == dp[dn-2]);
>+      assert ((inv->d1 & GMP_LIMB_HIGHBIT) != 0);
> 
>       shift = inv->shift;
>       if (shift > 0)
>@@ -1002,9 +1004,6 @@
>       else
> 	nh = 0;
> 
>-      assert (inv->d1 == dp[dn-1]);
>-      assert (inv->d0 == dp[dn-2]);
-
>       mpn_div_qr_pi1 (qp, np, nn, nh, dp, dn, inv->di);
> 
>       if (shift > 0)

>Return-path: <marc.glisse at inria.fr>
>Date: Sat, 16 Feb 2013 18:26:53 +0100 (CET)
>From: Marc Glisse <marc.glisse at inria.fr>
>Subject: Re: make failure trying to build gmp-5.1.0a on Tru64unix v5.1b system
>To: gmp-bugs at gmplib.org
>Cc: Bill.Glessner at cwu.edu, maybird1776 at YAHOO.com
>Reply-to: gmp-bugs at gmplib.org
>
>On Fri, 15 Feb 2013, Marc Glisse wrote:
>
> On Fri, 15 Feb 2013, Bill.Glessner at cwu.EDU wrote:
>
>> Later in the build I encountered the following C++ issues:
>> 
>> libtool: compile:  cxx -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMPXX -I.. 
>> -D__US
>> E_STD_IOSTREAM -nocompress -c limits.cc  -DPIC -o .libs/limits.o
>> cxx: Error: ../gmpxx.h, line 1516: no instance of function template
>>          "std::swap" matches the argument list
>>            argument types are: (__mpz_struct, __mpz_struct)
>>  void swap(__gmp_expr& z) __GMPXX_NOEXCEPT { std::swap(*mp, *z.mp); }
>> ----------------------------------------------^
>> cxx: Error: ../gmpxx.h, line 1710: no instance of function template
>>          "std::swap" matches the argument list
>>            argument types are: (__mpq_struct, __mpq_struct)
>>  void swap(__gmp_expr& q) __GMPXX_NOEXCEPT { std::swap(*mp, *q.mp); }
>> ----------------------------------------------^
>> cxx: Error: ../gmpxx.h, line 1931: no instance of function template
>>          "std::swap" matches the argument list
>>            argument types are: (__mpf_struct, __mpf_struct)
>>  void swap(__gmp_expr& f) __GMPXX_NOEXCEPT { std::swap(*mp, *f.mp); }
>> ----------------------------------------------^
>> cxx: Info: 3 errors detected in the compilation of "limits.cc".
>
>Oups, does adding:
>
>#include <algorithm>
>
>at the top fix it? If so it is my fault, no bug in the compiler.
>
>-- 
>Marc Glisse


More information about the gmp-bugs mailing list