I would like to use GMP on windows, and I need to build static programs. (which means that, if anyone can provide another solution to compile win32 x86_64 programs using libgmp, I will also appreciate it.)
Now I have msys2 installed, and in it I have executed
pacman -S base-devel gcc
and then I downloaded gmp-6.2.0.tar.lz from gmplib.org and extracted it to somewhere, like
C:\Users\xxx\gmp-6.2.0
Then I, using msys2 mingw64, entered this directory and executed
./configure
make
make check
make install
The first two commands seems to be fine, the output seems to be right. However, make check didn't provide me with whether the make is right or not. At the end of its output it says,
make[5]: Leaving directory '/c/Users/Fred/gmp-6.2.0/tests/cxx'
make[4]: Leaving directory '/c/Users/Fred/gmp-6.2.0/tests/cxx'
make[3]: Leaving directory '/c/Users/Fred/gmp-6.2.0/tests/cxx'
make[2]: Leaving directory '/c/Users/Fred/gmp-6.2.0/tests'
Making check in mpn
make[2]: Entering directory '/c/Users/Fred/gmp-6.2.0/mpn'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory '/c/Users/Fred/gmp-6.2.0/mpn'
Making check in mpz
make[2]: Entering directory '/c/Users/Fred/gmp-6.2.0/mpz'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory '/c/Users/Fred/gmp-6.2.0/mpz'
Making check in mpq
make[2]: Entering directory '/c/Users/Fred/gmp-6.2.0/mpq'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory '/c/Users/Fred/gmp-6.2.0/mpq'
Making check in mpf
make[2]: Entering directory '/c/Users/Fred/gmp-6.2.0/mpf'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory '/c/Users/Fred/gmp-6.2.0/mpf'
Making check in printf
make[2]: Entering directory '/c/Users/Fred/gmp-6.2.0/printf'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory '/c/Users/Fred/gmp-6.2.0/printf'
Making check in scanf
make[2]: Entering directory '/c/Users/Fred/gmp-6.2.0/scanf'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory '/c/Users/Fred/gmp-6.2.0/scanf'
Making check in rand
make[2]: Entering directory '/c/Users/Fred/gmp-6.2.0/rand'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory '/c/Users/Fred/gmp-6.2.0/rand'
Making check in cxx
make[2]: Entering directory '/c/Users/Fred/gmp-6.2.0/cxx'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory '/c/Users/Fred/gmp-6.2.0/cxx'
Making check in demos
make[2]: Entering directory '/c/Users/Fred/gmp-6.2.0/demos'
Making check in calc
make[3]: Entering directory '/c/Users/Fred/gmp-6.2.0/demos/calc'
make check-am
make[4]: Entering directory '/c/Users/Fred/gmp-6.2.0/demos/calc'
make[4]: Nothing to be done for 'check-am'.
make[4]: Leaving directory '/c/Users/Fred/gmp-6.2.0/demos/calc'
make[3]: Leaving directory '/c/Users/Fred/gmp-6.2.0/demos/calc'
Making check in expr
make[3]: Entering directory '/c/Users/Fred/gmp-6.2.0/demos/expr'
make[3]: Nothing to be done for 'check'.
make[3]: Leaving directory '/c/Users/Fred/gmp-6.2.0/demos/expr'
make[3]: Entering directory '/c/Users/Fred/gmp-6.2.0/demos'
make[3]: Nothing to be done for 'check-am'.
make[3]: Leaving directory '/c/Users/Fred/gmp-6.2.0/demos'
make[2]: Leaving directory '/c/Users/Fred/gmp-6.2.0/demos'
Making check in tune
make[2]: Entering directory '/c/Users/Fred/gmp-6.2.0/tune'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory '/c/Users/Fred/gmp-6.2.0/tune'
Making check in doc
make[2]: Entering directory '/c/Users/Fred/gmp-6.2.0/doc'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory '/c/Users/Fred/gmp-6.2.0/doc'
make[2]: Entering directory '/c/Users/Fred/gmp-6.2.0'
make[2]: Leaving directory '/c/Users/Fred/gmp-6.2.0'
make[1]: Leaving directory '/c/Users/Fred/gmp-6.2.0'
And make install ended up in similar messages. At last when I tried to compile programs, it says,
/usr/lib/gcc/x86_64-pc-msys/9.3.0/../../../../x86_64-pc-msys/bin/ld: cannot find -lgmp
As a matter of fact, I am not a professional programmer so I'm not quite sure about how to install GMP for mingw. I would be deeply grateful if anyone can tell me how to do this from scratch.
With the help of @HolyBlackCat, I solved this problem and successfully compiled my programs. Here is the process:
Install msys2
Compile your programs
Other info
If you needs to use autoconf tools, you can install them with