首页 > 解决方案 > 使用 MinGW 在 Windows 上安装 GMP 时出错

问题描述

我在WinLibs提供的带有 MinGW 的 Windows10 上。

我尝试使用GMP Install Instruction for Windows Platform给出的说明安装 GMP 库。

我做过这些

  1. 安装 MinGWC:/mingw64
  2. 安装 MSYSC:/MSYS/1.0
  3. 下载GMP源码并解压到D:/desktop/gmp-6.2.0
  4. 运行 MSYS 并cd进入D:/desktop/gmp-6.2.0
  5. 运行./configure --prefix="D:/GMP" --disable-static --enable-shared。这成功生成了一个Makefile,并在控制台中显示这些信息:
configure: summary of build options:

  Version:           GNU MP 6.2.0
  Host type:         skylake-pc-mingw32
  ABI:               64
  Install prefix:    D:/GMP
  Compiler:          gcc
  Static libraries:  no
  Shared libraries:  yes
  1. 运行make。该过程因这些错误信息而失败
In file included from set_str.c:57:
set_str.c: In function '__gmpf_set_str':
../gmp-impl.h:4435:29: warning: implicit declaration of function 'localeconv' [-Wimplicit-function-declaration]
 4435 | #define GMP_DECIMAL_POINT  (localeconv()->decimal_point)
      |                             ^~~~~~~~~~
set_str.c:132:24: note: in expansion of macro 'GMP_DECIMAL_POINT'
  132 |   const char  *point = GMP_DECIMAL_POINT;
      |                        ^~~~~~~~~~~~~~~~~
../gmp-impl.h:4435:41: error: invalid type argument of '->' (have 'int')
 4435 | #define GMP_DECIMAL_POINT  (localeconv()->decimal_point)
      |                                         ^~
set_str.c:132:24: note: in expansion of macro 'GMP_DECIMAL_POINT'
  132 |   const char  *point = GMP_DECIMAL_POINT;
      |                        ^~~~~~~~~~~~~~~~~
make[2]: *** [set_str.lo] Error 1
make[2]: Leaving directory `/d/Desktop/gmp-6.2.0/mpf'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/d/Desktop/gmp-6.2.0'
make: *** [all] Error 2
  1. 我应该运行make install以完成安装,但由于最后一步失败,我不能。

这里有什么问题?我该如何解决?

标签: c++cmingwgmpmsys

解决方案


我自己修好了。(推断的)问题是,当我完成安装 MSYS 时,安装后脚本的自动运行失败,我只是忽略了它。

在我postinstall.bat手动运行之后,GMP 库根据需要编译。


推荐阅读