gmp 4.2.4 bug on Cygwin 1.5.25

Vladimir Naidenko naidenko at
Wed Feb 18 13:07:31 CET 2009

I think that the variable ac_cv_sizeof_mp_limb_t gets
the carriage return symbol '\r' via the command
ac_cv_sizeof_mp_limb_t=`cat conftest.val`

In Windows (MinGW or Cygwin) the file conftest.val
contains '\r' along with '\n' if it is opened as a text file.

To fix this problem, instead of the command:

fopen ("conftest.val", "w")

put the command:

fopen ("conftest.val", "wb")

everywhere in "configure".

This corrected "configure" will be work in UNIX as well.


----- Original Message ----- 
From: "Torbjorn Granlund" <tg at>
To: "Vladimir Naidenko" <naidenko at>
Cc: <gmp-bugs at>
Sent: Saturday, February 14, 2009 10:20 AM
Subject: Re: gmp 4.2.4 bug on Cygwin 1.5.25

"Vladimir Naidenko" <naidenko at> writes:

  I found a bug when compiling gmp 4.2.4 on Cygwin 1.5.25

  The below command

  ./configure \
  "CFLAGS=-march=pentium3 -msse -O3 -fomit-frame-pointer" \
  --host=pentium3-pc-mingw32 --build=pentium3-pc-mingw32 \
  --disable-cxx --disable-shared --enable-static \
  "CPP=cpp -mno-cygwin" \
  "CC=gcc -mno-cygwin" \
  "CC_FOR_BUILD=gcc -mno-cygwin" \
  "CPP_FOR_BUILD=cpp -mno-cygwin"


  This error occurs since the variable ac_cv_sizeof_mp_limb_t is handled
  as a string rather than an integer because of the carriage return
  symbol '\r'
  in its tail.
  I corrected this file "configure" by inserting a new line
  ac_cv_sizeof_mp_limb_t=`expr $ac_cv_sizeof_mp_limb_t : '\([0-9]*\)'`
  which converts ac_cv_sizeof_mp_limb_t to the integer.

  Please find the corrected file "configure" attached in this letter.

The \r should probably not be there in the first place.  Removing it
from one ac_cv_* variable is not the right approach.  Instead, you
need to find out why it was added.


More information about the gmp-bugs mailing list