MinGW/MSYS, GMP make check fails

Dave Odell dmo2118 at gmail.com
Sat Jul 12 08:06:28 CEST 2008

So under MinGW/MSYS, I did this:

(Caveat: I also did a number of other configure/make runs using
different switches in the same build tree, originally the goal was to
get a build of "configure --disable-static --enable-shared
--disable-fft --build=i586-pc-mingw32 --enable-cxx" working.)

Dave at SHUTTLE /c/src/gmp-4.2.2
$ make clean
(make clean runs OK.)
$ configure --disable-static --enable-shared
(configure runs OK. It correctly detects a system type of athlon64-pc-mingw32.)
$ make -j 8
(make runs OK.)
$ make install
(make install runs OK.)
$ make check

And got this...

make[4]: Leaving directory `/c/src/gmp-4.2.2/tests'
make  check-TESTS
make[4]: Entering directory `/c/src/gmp-4.2.2/tests'
FAIL: t-bswap.exe
FAIL: t-constants.exe
FAIL: t-count_zeros.exe
FAIL: t-gmpmax.exe
FAIL: t-hightomask.exe
FAIL: t-modlinv.exe
FAIL: t-popc.exe
FAIL: t-parity.exe
FAIL: t-sub.exe
9 of 9 tests failed
Please report to gmp-bugs at swox.com
make[4]: *** [check-TESTS] Error 1
make[4]: Leaving directory `/c/src/gmp-4.2.2/tests'
make[3]: *** [check-am] Error 2
make[3]: Leaving directory `/c/src/gmp-4.2.2/tests'
make[2]: *** [check-recursive] Error 1
make[2]: Leaving directory `/c/src/gmp-4.2.2/tests'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/c/src/gmp-4.2.2'
make: *** [check] Error 2

Some things I noticed:

(1) Dependency Walker (www.dependencywalker.com) reports that the test
programs do not reference libgmp-3.dll. Given that I'm building a DLL,
this seems like the problem

(2) I noticed that MinGW has had some problems in the past with GMP,
so I wrote the following test program. (Note

The following program works (compiled in MinGW, with --image-base
0x68A80000 passed to the linker so as to force a relocation of
libgmp-3.dll; Microsoft DUMPBIN says that 0x68A80000 is the image base
for libgmp-3.dll for some reason, not sure why):

#include <gmp.h>
#include <stdio.h>
#include <windows.h>

int main()
	printf("GMP Version: %s\n", gmp_version);
	printf("GMP base address: %p\n", GetModuleHandle("libgmp-3.dll"));

	mpf_t pi, n22, n7, n22d7, result;

	mpf_init_set_str(pi, "3.1415926535897932384626433832795", 10);
	mpf_init_set_str(n22, "22", 10);
	mpf_init_set_str(n7, "7", 10);

	mpf_div(n22d7, n22, n7);
	mpf_sub(result, n22d7, pi);

	mpf_out_str(stdout, 10, 32, result);

	return 0;

...and gives the following as output:

GMP Version: 4.2.2
GMP base address: 68A80000

...Which is what I expect.

(3) Considering that the test programs might not be executing at all,
I modified t_bswap.c so that it looked like this:

#include "windows.h"

main (void)
  MessageBox(NULL, "Hello from t-bswap.exe.", NULL, MB_OK);
  mp_limb_t  src, want, got;
  int        i;

No message box appeared when I ran "make check".

When I ran t-bswap from the (Windows) command prompt, I didn't get a
message box either. Instead I got:


t-bswap: FATAL: Couldn't find t-bswap.


And finally, when I ran t-bswap from the Visual C++ debugger:

't-bswap.exe': Loaded 'C:\src\gmp-4.2.2\tests\t-bswap.exe', Binary was
not built with debug information.
't-bswap.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
't-bswap.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.
't-bswap.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No symbols loaded.
't-bswap.exe': Loaded 'C:\WINDOWS\system32\shimeng.dll', No symbols loaded.
't-bswap.exe': Unloaded 'C:\WINDOWS\system32\shimeng.dll'
The program '[5152] t-bswap.exe: Native' has exited with code 127 (0x7f).

And still no message box.


>> Please include the following in any report,

>> * The GMP version number, and if pre-packaged or patched then say so.
4.2.2, the latest as of today, pre-packaged from

>> * A test program that makes it possible for us to reproduce the bug. Include instructions on how to run the program.
The test program is what comes with GMP 4.2.2.

>> * A description of what is wrong. If the results are incorrect, in what way. If you get a crash, say so.
See above. Not a crash so much as the test programs exit before they
get to main().

>> * If you get a crash, include a stack backtrace from the debugger if it's informative (`where' in gdb, or `$C' in adb).
No crash, no stacktrace.

>> * Please do not send core dumps, executables or straces.
Alright, then.

>> * The configuration options you used when building GMP, if any.
configure --disable-static --enable-shared

>> * The name of the compiler and its version. For gcc, get the version with `gcc -v', otherwise perhaps `what `which cc`', or similar.
$ gcc -v
Reading specs from c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/specs
Configured with: ../gcc-3.4.5/configure --with-gcc --with-gnu-ld
--with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw
--enable-threads --disable-nls
--enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry
--disable-shared --enable-sjlj-exceptions --enable-libgcj
--disable-java-awt --without-x --enable-java-gc=boehm
--disable-libgcj-debug --enable-interpreter
--enable-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.5 (mingw special)

Since this might be a linker problem...
$ ld -v
GNU ld version 2.17.50 20060824

>> * The output from running `uname -a'.
$ uname -a
MINGW32_NT-5.1 SHUTTLE 1.0.10(0.46/3/2) 2004-03-15 07:17 i686 unknown

>> * The output from running `./config.guess', and from running `./configfsf.guess' (might be the same).
$ config.guess

$ configsf.guess
sh: configsf.guess: command not found

>> * If the bug is related to `configure', then the contents of config.log.
See attached. It might not be relevant, though.

>> * If the bug is related to an asm file not assembling, then the contents of config.m4 and the offending line or lines from the temporary mpn/tmp-<file>.s.
It isn't.

Dave Odell
dmo2118 at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.log.gz
Type: application/x-gzip
Size: 19088 bytes
Desc: not available
Url : http://gmplib.org/list-archives/gmp-bugs/attachments/20080712/380f457d/attachment-0001.bin 

More information about the gmp-bugs mailing list