Problem compiling 4.2.4 on Solaris 10 with Sun Studio 12

John Center john.center at villanova.edu
Fri Feb 20 06:10:10 CET 2009


Hi,

To follow up, I recompiled with GMP 4.2.4 with -library=stlport4.  I 
used the -enable-cxx option & the compile failed while building 
osdoprnti.cc.  The error was:

"../gmp.h", line 613: Error: va_list is not defined.
...
"../gmp-impl.h", line 3258: Error: va_list is not defined.
...

The problem was cstdarg was included instead of stdarg.h.

Here is a patch to fix this:

*** gmp-4.2.4-ORIG/cxx/osdoprnti.cc     Sat Sep  1 06:09:03 2007
--- gmp-4.2.4/cxx/osdoprnti.cc  Thu Feb 19 22:50:36 2009
***************
*** 22,28 ****
   along with the GNU MP Library.  If not, see 
http://www.gnu.org/licenses/.  */

   #include <iostream>
! #include <cstdarg>    /* for va_list and hence doprnt_funs_t */
   #include <cstring>    /* for strlen */

   #include "gmp.h"
--- 22,28 ----
   along with the GNU MP Library.  If not, see 
http://www.gnu.org/licenses/.  */

   #include <iostream>
! #include <stdarg.h>    /* for va_list and hence doprnt_funs_t */
   #include <cstring>    /* for strlen */

   #include "gmp.h"


On a different issue, when I ran "make check" one test failed, t-locale, 
& dumped core.

Here's the output from dbx:

# dbx .libs/t-locale /var/core/core_ra_t-locale_0_0_1235103740_10227
Reading t-locale
core file header read successfully
Reading ld.so.1
Reading libc.so.1
Reading libgmp.so.3.4.4
Reading libumem.so.1
Reading libstlport.so.1
Reading libCrun.so.1
Reading libm.so.1
Reading librt.so.1
Reading libaio.so.1
Reading libmd.so.1
Reading libc_psr.so.1
Reading libm.so.2
Reading libgmpxx.so.4.0.4
program terminated by signal SEGV (no mapping at the fault address)
0xffffffff7eb771f8: imbue+0x0078:       ldx      [%o0], %i5
Current function is check_output (optimized)
   141         ostringstream  got;
(dbx) where
   [1] std::basic_ios<char,std::char_traits<char> 
 >::imbue(0xffffffff7ffff018, 0xffffffff7ffff3a0, 0xffffffff7ffff010, 
0x5d8, 0x400, 0x400), at 0xffffffff7eb771f8
   [2] std::basic_ios<char,std::char_traits<char> 
 >::init(0xffffffff7ffff3a0, 0x0, 0x158, 0xffffffff7ed194c8, 
0xffffffff7ed194f0, 0xffffffff7ffff248), at 0xffffffff7eb76fc8
   [3] 
std::basic_ostringstream<char,std::char_traits<char>,std::allocator<char> 
 >::basic_ostringstream(0xffffffff7ffff248, 0x10, 0x6f0, 
0xffffffff7ffff3a0, 0xffffffff7ed19518, 0xffffffff7ed10300), at 
0xffffffff7eb796d0
=>[4] check_output() (optimized), at 0x10000658c (line ~141) in 
"t-locale.cc"
   [5] main() (optimized), at 0x100006ed0 (line ~184) in "t-locale.cc"

Here's the flags it was compiled & linked with:

cc -xc99=%all -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -I../../tests 
-I/opt/gnu/include -I/opt/local/include -I/usr/sfw/include 
-I/usr/include  -g -xs -fast -fsimple=1 -fns=no -xtarget=ultraT1 
-xarch=sparcvis2 -m64 -mt -xipo -xcode=pic32 -xpagesize=default 
-xlic_lib=sunperf  -c t-locale.c

cc -xc99=%all -g -xs -fast -fsimple=1 -fns=no -xtarget=ultraT1 
-xarch=sparcvis2 -m64 -mt -xipo -xcode=pic32 -xpagesize=default 
-xlic_lib=sunperf -Wl,-ztext -Wl,-Bdirect -Wl,-zlazyload -Wl,-zcombreloc 
-Wl,-zignore -o .libs/t-locale t-locale.o  -L/opt/gnu/lib/sparcv9 
-L/opt/local/lib/sparcv9 -L/usr/sfw/lib/sparcv9 -L/usr/lib/sparcv9 
../../tests/.libs/libtests.a /opt/ws/dists/gmp-4.2.4/.libs/libgmp.so 
../../.libs/libgmp.so -lumem -lpthread  -R/opt/gnu/lib/sparcv9 
-R/opt/local/lib/sparcv9 -R/usr/sfw/lib/sparcv9 -R/usr/lib/sparcv9

Could someone please tell me what might be wrong?

Thanks.

	-John


Marc Glisse wrote:
> On Tue, 17 Feb 2009, John Center wrote:
> 
>> I was unable to compile GMP 4.2.4 on Solaris 10 with Sun Studio 12.  The 
>> errors were:
>>
>> "ismpf.cc", line 53: Error: Could not find a match for 
>> std::use_facet<std::Facet
>>> (const std::locale) needed in operator>>(std::istream &, __mpf_struct*).
>> I found a patch on gmp-bugs for GMP 4.2.1 for Sun Studio 11 from July 2006 by 
>> Matthias Koeppe 
>> (http://gmplib.org/list-archives/gmp-bugs/2006-July/000519.html) that worked 
>> for me.
> 
> Good that you found it.
> 
>> Could this, or one similar to it, be added to the patch list on the 
>> home page & incorporated in the next release?
> 
> A FAQ about typical problems with solaris+gmp would help.
> 
> But do you really still need to use the old broken version of the standard 
> library? If you have a choice, you should really use -library=stlport4, or 
> some other self-compiled standard library like Apache stdcxx (used by 
> default in opensolaris and soon shipped with the compiler). Both should 
> work fine with gmp without any patch.
> 
> I somehow doubt TG will be happy to include such a workaround, but I may 
> be wrong. Note that such a workaround should test that 
> _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE is defined (hello MPIR...).
> 


More information about the gmp-bugs mailing list