我想在 Windows 上使用 GMP,我需要构建静态程序。(这意味着,如果有人可以提供另一种使用 libgmp 编译 win32 x86_64 程序的解决方案,我也将不胜感激。)
现在我安装了 msys2,并在其中执行了
pacman -S base-devel gcc
然后我从 gmplib.org 下载了 gmp-6.2.0.tar.lz 并将其解压缩到某个地方,比如
C:\Users\xxx\gmp-6.2.0
然后我,使用msys2 mingw64,进入这个目录并执行
./configure
make
make check
make install
前两个命令似乎很好,输出似乎是正确的。但是,make check 并没有向我提供 make 是否正确。在其输出结束时,它说,
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'
并且 make install 以类似的消息结束。最后,当我尝试编译程序时,它说,
/usr/lib/gcc/x86_64-pc-msys/9.3.0/../../../../x86_64-pc-msys/bin/ld: cannot find -lgmp
事实上,我不是专业程序员,所以我不太确定如何为 mingw 安装 GMP。如果有人能告诉我如何从头开始执行此操作,我将不胜感激。