building gmp with MSYS and MinGW for VC++

Sisyphus kalinabears at iinet.net.au
Sun May 9 04:10:27 CEST 2004


Kevin Ryde wrote:
> Sisyphus <kalinabears at iinet.net.au> writes:
> 
>>I know I didn't specify that option when I built 4.1.2 - and wouldn't
>>that affect *all* of GMP ?
> 
> 
> Well, what it sounds like is you used malloc in your 4.1.2 build and
> mpfr applications, then built 4.1.3 with alloca (the default).  Hence
> the mismatch trying to use the new dll with the old app.
> 
> This arises in mpfr because mpfr uses various gmp internals.  You
> should use mpfr with the libgmp it was built against.  (Or rebuild.)
> 

For the record, I stayed with the 4.1.3 that I built with the MinGW 
compiler using the build options '--disable-static --enable-shared 
--enable-mpfr'.

There weren't any problems rebuilding apps with MinGW, but a couple of 
issues with mpfr apps and VC 7.

Firstly there were fatal errors "unresolved external symbol: _alloca". I 
"fixed" that by linking to the MinGW library file 'libgcc.a'.

Secondly, there can be problems with '_strncasecmp' and '_strcasecmp' 
(with both 4.1.2 and 4.1.3). I had been fixing them by using the 
following (copied from MinGW/include/string.h):

strcasecmp (const char * __sz1, const char * __sz2)
   {return _stricmp (__sz1, __sz2);}

strncasecmp (const char * __sz1, const char * __sz2, size_t 
__sizeMaxCompare)
   {return _strnicmp (__sz1, __sz2, __sizeMaxCompare);}

As an alternative to that, I found that linking to the MinGW library 
file 'libcoldname.a' also worked - which was the only way I could get 
C++ scripts to build.

With C++ scripts only I also found that I had to
#define _MPFR_H_HAVE_FILE
before
#include <mpfr.h>
or there could be fatal errors with with 'undeclared identifier: 
mpfr_out_str'.

I'd be interested to hear how the OP (Radu) got on. Perhaps a different 
(better) solution - I doubt that my fixes are optimal, and there's no 
guarantee that they are even complete.

Incidentally, I'm finding that when I build with VC 7, I'm having to 
link explicitly to 'libc.lib' and 'msvcrt.lib'. (The same was also the 
case with GMP-4.1.2.)

Cheers,
Rob



More information about the gmp-discuss mailing list