安装GMP 和 MPFR

来源:互联网 发布:上海巨人网络客服电话 编辑:程序博客网 时间:2024/05/07 00:29

先安装GMP, 在安装MPFR

下载  gmp-5.0.5.tar.bz2 包

解压.tar.bz2 包: bzip2 -d  gmp-5.0.5.tar.bz2  解压完会出现一个文件 gmp-5.0.5.tar

解压.tar 包:tar -xvf gmp-5.0.5.tar 解压完会出现一个文件 gmp-5.0.5

安装gmp

进入到gmp-5.0.5目录下: cd gmp-5.0.5

开始编译

执行命令: ./configure  执行完之后

执行命令: make  执行完之后

执行命令:make check  作用是 查看配置文件是否缺失,是否有Error之类的提示。如果没有,开始安装过程

开始安装

执行命令: make install

有必要说明程序的头文件(.h)和库文件(lib*)的位置,本次安装会安装在 /usr/local/include 和 /usr/local/lib . 这个对后面安装mpfr很有作用.

下载  mpfr-3.1.0.tar.gz 包

解压.tar.gz 包:tar -zxvf mpfr-3.1.0.tar.gz  解压完会出现一个文件 mpfr-3.1.0

安装gmp

进入到mpfr-3.1.0 目录下: cd mpfr-3.1.0

安装补丁: patch -N -Z -p1 < mpfr-3.1.0.patch   补丁可以在http://www.mpfr.org/mpfr-current/allpatches 找到

开始编译

执行命令:

./configure  --prefix=/usr        \             --enable-thread-safe \             --docdir=/usr/share/doc/mpfr-3.1.0
  编译过程中 出现如下警告:

configure: WARNING: ==========================================================
configure: WARNING: 'gmp.h' and 'libgmp' seem to have different versions or
configure: WARNING: we cannot run a program linked with GMP (if you cannot
configure: WARNING: see the version numbers above). A cause may be different
configure: WARNING: GMP versions with different ABI's or the use of --with-gmp
configure: WARNING: or --with-gmp-include with a system include directory
configure: WARNING: (such as /usr/include or /usr/local/include).
configure: WARNING: However since we can't use 'libtool' inside the configure,
configure: WARNING: we can't be sure. See 'config.log' for details.
configure: WARNING: ==========================================================

原因是在执行 ./configure 时 没有添加 --with-gmp-include 而造成的

重新执行命令: ./configure --with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib 

警告消除

执行命令: make  执行完之后

执行命令:make check  作用是 查看配置文件是否缺失,是否有Error之类的提示。如果没有,开始安装过程

开始安装

执行命令: make install




原创粉丝点击