c-在哪里可以找到“ gmp.h”?

我正在安装一个库,并收到以下错误消息:

xxxx@ubuntu$ make
(cd num; make all)
make[1]: Entering directory `/home/xxxx/num'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/xxxx/num'
(cd itv; make all)
make[1]: Entering directory `/home/xxxx/itv'
gcc -Wcast-qual -Wswitch -Werror-implicit-function-declaration -Wall -Wextra -Wundef -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wno-unused -std=c99 -U__STRICT_ANSI__ -O3 -DNDEBUG -I../num -I../apron -I/usr/include -I/usr/include -DNUM_MPQ -c -o itvMPQ.o itv.c
In file included from itv.h:9:0,
             from itv.c:5:
../num/num.h:15:17: fatal error: gmp.h: No such file or directory
compilation terminated.
make[1]: *** [itvMPQ.o] Error 1
make[1]: Leaving directory `/home/xxxx/itv'
make: *** [c] Error 2

因此,问题在于它找不到libgmp3-dev,有人知道该文件位于何处,以及如何由安装程序找到它吗? 顺便说一下,目前我的../num/num.h:16:18: fatal error: mpfr.h: No such file or directory主要指向/usr/usr/local ...

Edit1:按照建议安装libgmp3-dev后,当前错误消息为../num/num.h:16:18: fatal error: mpfr.h: No such file or directory,有人知道它与哪个软件包有关吗?

Edit2:我已经按照此页面安装了apt-file search camlidlruntime,这确实有所帮助,现在错误消息是camlidl: /usr/lib/ocaml/caml/camlidlruntime.h,有人可以帮助吗?

Edit3:我已经完成了apt-file search camlidlruntime,它返回了camlidl: /usr/lib/ocaml/caml/camlidlruntime.h,但是文件夹/usr/lib/ocaml/caml/中没有camlidlruntime.h,如何检查是否已安装dev package of MPFR? 到底是哪个包装?

SoftTimur asked 2020-02-13T19:36:18Z
6个解决方案
78 votes

你需要安装  libgmp3-dev

取决于您的Linux

yum install  libgmp3-dev

apt-get install  libgmp3-dev
Vivek Goel answered 2020-02-13T19:36:35Z
13 votes

在OS X上(如果您使用的是Homebrew),请执行以下操作:

brew install gmp
mpontillo answered 2020-02-13T19:36:55Z
5 votes

在Centos 6.5中为sudo yum install gmp gmp-devel gmp-status

ProTip:只需在yum中搜索gmp,然后查看yum提供的命令。

Nishant answered 2020-02-13T19:37:19Z
3 votes

因为出于某种特殊原因,您可能需要32位格式的库(就像对我而言)

您将需要运行(在Ubuntu / Debian上):

apt-get install  libgmp3-dev:i386

任何库后面的后缀:i386将安装它的32位版本。

Valentin Montmirail answered 2020-02-13T19:37:48Z
2 votes

我做了很多研究,最后可以使用以下环境变量编译色相:

    export CPFLAGS="-I/usr/local/include/gmp.h -I/usr/local/opt/openssl/include"
    export CFLAGS="-I/usr/local/include/gmp.h"
    export CXXFLAGS="-I/usr/local/include/gmp.h"
    export LDFLAGS="-L/usr/local/lib -L/usr/local/opt/openssl/lib"

    export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"
Joachim answered 2020-02-13T19:38:08Z
1 votes

对我来说,这有效:

apt-get install  libgmp3-dev   (Might vary in linux distro; this is for Ubuntu)
pip3 install gmpy --user
Prabhat Soni answered 2020-02-13T19:38:29Z
translate from https://stackoverflow.com:/questions/7351205/where-to-find-gmp-h