GMP 5.0.2 'make check' problems with mingw64...

David Cleaver wraithx at morpheus.net
Sun Jun 12 17:28:18 CEST 2011


I am building GMP 5.0.2 on Windows XP x64 in an MSYS shell with MingW64 as my 
compiler.  I have run into two problems running 'make check'.  The problems 
occur in /tests/misc/ with t-printf and t-locale.  I was able to get both tests 
to pass after making some changes.  Apologies in advance if it is bad form to 
report two problems in one bug report.

I configured GMP 5.0.2 with the line:
./configure --host=x86_64-pc-mingw32 --target=x86_64-pc-mingw32

$ gcc -v
Using built-in specs.
Target: x86_64-w64-mingw32
Configured with: ../gcc44-svn/configure --host=x86_64-w64-mingw32 
--target=x86_64-w64-mingw32 --disable-multilib --enable-checking=release 
--prefix=/mingw64 --with-sysroot=/mingw64 
--enable-languages=c,c++,fortran,objc,obj-c++ --enable-libgomp 
--with-gmp=/mingw64 --with-mpfr=/mingw64 --disable-nls --disable-win32-registry
Thread model: win32
gcc version 4.4.5 20101001 (release) [svn/rev.164871 - mingw-w64/oz] (GCC)

$ uname -a
MINGW32_NT-5.2 NARUTO 1.0.16(0.48/3/2) 2010-09-29 00:07 i686 Msys

$ ./config.guess
i686-pc-mingw32

$ ./configfsf.guess
i686-pc-mingw32

*********************
*** For t-printf: ***
When 'make check' runs the t-printf test, it produces the following output:
---------------------------------------------------------------------------
make[4]: Entering directory `/d/Programming/gmp/gmp-5.0.2/tests/misc'
gmp_vsprintf wrong
   fmt      |%Mu|
   got      |4294967295|
   want     |8589934591|
   got_len  10
   want_len 10

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
FAIL: t-printf.exe
PASS: t-scanf.exe
Test skipped, replacing localeconv/nl_langinfo doesn't work
PASS: t-locale.exe
====================================
1 of 3 tests failed
Please report to gmp-bugs at gmplib.org
---------------------------------------------------------------------------
I have looked into the code and found out that %Mu gets translated to %llu. 
MingW64 has a problem printing 64-bit variables with %llu.  You can see talk 
about it here:
http://www.mail-archive.com/mingw-w64-public@lists.sourceforge.net/msg00476.html
What it boils down to is that in order to use the posix %llu specifier, MingW64 
needs a certain #define to use it.  I was able to get the t-printf test to pass 
in my environment by adding the following to the bottom of config.h
#ifdef __MINGW64__
#define __USE_MINGW_ANSI_STDIO 1
#endif
I'm not sure what the proper way to get that into config.h is, but I wanted to 
let you know a solution for MingW64 users.


*********************
*** For t-locale: ***
When 'make check' gets to the /tests/misc/ directory, it doesn't correctly 
compile the t-locale.c file.  It gives the following output:
---------------------------------------------------------------------------
make[1]: Entering directory `/d/Programming/gmp/gmp-5.0.2/tests/misc'
gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../../tests    -O2 -pedantic -m64 
-std=gnu99 -mtune=k8 -march=k8 -c t-printf.c
/bin/sh ../../libtool --tag=CC   --mode=link gcc  -O2 -pedantic -m64 -std=gnu99 
-mtune=k8 -march=k8   -o t-printf.exe t-printf.o ../../tests/libtests.la 
../../libgmp.la
libtool: link: gcc -O2 -pedantic -m64 -std=gnu99 -mtune=k8 -march=k8 -o 
t-printf.exe t-printf.o  ../../tests/.libs/libtests.a 
/d/Programming/gmp/gmp-5.0.2/.libs/libgmp.a ../../.libs/libgmp.a
gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../../tests    -O2 -pedantic -m64 
-std=gnu99 -mtune=k8 -march=k8 -c t-scanf.c
/bin/sh ../../libtool --tag=CC   --mode=link gcc  -O2 -pedantic -m64 -std=gnu99 
-mtune=k8 -march=k8   -o t-scanf.exe t-scanf.o ../../tests/libtests.la 
../../libgmp.la
libtool: link: gcc -O2 -pedantic -m64 -std=gnu99 -mtune=k8 -march=k8 -o 
t-scanf.exe t-scanf.o  ../../tests/.libs/libtests.a 
/d/Programming/gmp/gmp-5.0.2/.libs/libgmp.a ../../.libs/libgmp.a
gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../../tests    -O2 -pedantic -m64 
-std=gnu99 -mtune=k8 -march=k8 -c t-locale.c
t-locale.c:50: warning: 'localeconv' redeclared without dllimport attribute: 
previous dllimport ignored
/bin/sh ../../libtool --tag=CC   --mode=link gcc  -O2 -pedantic -m64 -std=gnu99 
-mtune=k8 -march=k8   -o t-locale.exe t-locale.o ../../tests/libtests.la 
../../libgmp.la
libtool: link: gcc -O2 -pedantic -m64 -std=gnu99 -mtune=k8 -march=k8 -o 
t-locale.exe t-locale.o  ../../tests/.libs/libtests.a 
/d/Programming/gmp/gmp-5.0.2/.libs/libgmp.a ../../.libs/libgmp.a
c:/mingw64-20101003/bin/../lib/gcc/x86_64-w64-mingw32/4.4.5/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a(dxrobs01029.o):(.text+0x0): 
multiple definition of `localeconv'
t-locale.o:t-locale.c:(.text+0x0): first defined here
collect2: ld returned 1 exit status
make[1]: *** [t-locale.exe] Error 1
make[1]: Leaving directory `/d/Programming/gmp/gmp-5.0.2/tests/misc'
make: *** [check-am] Error 2
---------------------------------------------------------------------------
I could only get rid of the 'multiple definition' error by wrapping the 
redefinition of localeconv with an #ifndef like so:
#ifndef __MINGW64__
#if HAVE_LOCALECONV
struct lconv *
localeconv (void)
{
   static struct lconv  l;
   l.decimal_point = decimal_point;
   return &l;
}
#endif
#endif

Once this change was made, 'make check' "successfully" passed this test with:
make[1]: Entering directory `/d/Programming/gmp/gmp-5.0.2/tests/misc'
PASS: t-printf.exe
PASS: t-scanf.exe
Test skipped, replacing localeconv/nl_langinfo doesn't work
PASS: t-locale.exe
==================
All 3 tests passed
==================

Once these two changes are made, 'make check' completes successfully for me on 
all tests.  If you need any more information, or would like me to try any 
patches, please let me know.  Thanks for your time.

-David C.


More information about the gmp-bugs mailing list