gmp 5.0.2 configuration error on mingw

Bruno Haible bruno at
Sat Jan 14 22:58:31 CET 2012


I've built dozens of packages already for mingw, from a Cygwin environment,
using the commands

./configure --host=i586-pc-mingw32 --prefix=/usr/local/mingw \
            CC="gcc-3 -mno-cygwin" CXX="g++-3 -mno-cygwin" \
            CPPFLAGS="-I/usr/local/mingw/include -Wall" \

With gmp 5.0.2 this configuration fails:

configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
-pc' not recognizede `atom... Invalid configuration `atom
-pc-cygwin failed /bin/sh ./config.sub atom

Apparently this is because the config.guess program of gmp-5.0.2
returns a weird result on this platform:

$ CC="gcc-3 -mno-cygwin" ./config.guess | od -t x1
0000000 61 74 6f 6d 0d 2d 70 63 2d 63 79 67 77 69 6e 0a

As you can see, the output is "atom\r-pc-cygwin\n" with a CR in the
middle and a NL at the end.

The correct result should be "i586-pc-cygwin\n" or "atom-pc-cygwin\n"
if you prefer.

This suggested patch fixes it. Together with the upgrade to libtool 2.4.2
(see the mail with subject "gmp fails to configure when I pass --host")
this patch allows the configuration to succeed.

2012-01-14  Bruno Haible  <bruno at>

	Fix determination of build platform when cross-compiling to mingw.
	* config.guess: Don't emit a newline after the detailed cpuid.
	This newline may end up being a CR-LF sequence.

--- config.guess.bak    2011-05-08 11:49:29.000000000 +0200
+++ config.guess        2012-01-14 22:40:41.936875000 +0100
@@ -787,7 +787,7 @@
-  printf ("%s\n", modelstr);
+  printf ("%s", modelstr);
   return 0;

More information about the gmp-bugs mailing list