【问题标题】:Error when installing GMP on Windows with MinGW使用 MinGW 在 Windows 上安装 GMP 时出错
【发布时间】:2020-06-24 09:50:09
【问题描述】:

我正在使用 WinLibs 提供的 MinGW 的 Windows10。

我尝试按照GMP Install Instruction for Windows Platform 的说明安装 GMP 库。

这些我都做了

  1. C:/mingw64中安装MinGW
  2. C:/MSYS/1.0 中安装 MSYS
  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 来完成安装,但由于最后一步失败,我不能。

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

【问题讨论】:

  • 既然已经安装了MSYS,为什么不安装它提供的GMP包呢?
  • 否则,它看起来像是某个地方的错误,configure 应该检测 localeconv 是否可用,并且只有当 configure 说是时才会启用失败的代码。
  • @Marc Glisse:CMP 是否与 MSYS 一起提供?我在安装 MSYS 的过程中没有任何选项。
  • msys2.org "MSYS2 是一个软件发行版",它是一个包管理器。所以一旦安装,你就可以用它来安装其他软件了。
  • @Marc Glisse:好的,我去看看。谢谢。

标签: c++ c mingw gmp msys


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-02-01
    • 1970-01-01
    • 2023-03-27
    • 2017-04-15
    • 1970-01-01
    • 1970-01-01
    • 2021-10-28
    相关资源
    最近更新 更多