# GMP from source with MinGW-64

Under Cygwin, you can install the 64 bit mingw version of GCC, but you don't get the gnu multiprecision library for free with it, you'll much rather have to compile it from source. I ran into a bit of trouble here: It will not suffice to tell the configuration script about the new compiler, there are now mingw-64 versions of all relevant binaries that should be used instead. Basically, you go like
tar -xjf gmp-5.0.4.tar.bz2
cd gmp-5.0.4
./configure                          \
AR=x86_64-w64-mingw32-ar           \
AS=x86_64-w64-mingw32-as           \
DLLTOOL=x86_64-w64-mingw32-dlltool \
DLLWRAP=x86_64-w64-mingw32-dllwrap \
CC=x86_64-w64-mingw32-gcc-4.5.3    \
NM=x86_64-w64-mingw32-nm           \
LD=x86_64-w64-mingw32-ld           \
OBJDUMP=x86_64-w64-mingw32-objdump \
RANLIB=x86_64-w64-mingw32-ranlib   \
STRIP=x86_64-w64-mingw32-strip

I am not sure if all of these are needed, but it won't hurt either. After that, you should
make && make check

the whole thing. Worked perfectly for me, so now I can link with libgmp.a in .libs and native 64 bit bignum action ensues!

Tags: - - - - -

## 2 Replies to “GMP from source with MinGW-64”

1. rattle says:
Factor of two. And that is in an application which just partly uses gmp, so I suppose the actual speedup is way beyond that. I am too lazy to bench it properly.