`

安装MPFR和GMP

 
阅读更多

本人的系统是RH4.0AS.想升级GCC到4.3.0版本,在安装前,需要先安装MPFR和GMP.
下载MPFR (mpfr-2.3.0), MPFR_patch 和GMP (gmp-4.2.2).

分别加压缩.
[root@ibm ~]# tar jxf mpfr-2.3.0.tar.bz2 &
[root@ibm ~]# tar jxf gmp-4.2.2.tar.bz2 &

安装过程是先安装gmp,然后再安装mpfr.

安装gmp
[root@ibm ~]# cd gmp-4.2.2
[root@ibm gmp-4.2.2]# ./configure
[root@ibm gmp-4.2.2]# make
[root@ibm gmp-4.2.2]# make check  
这一步是必要的,用来查看有没有文件不匹配或缺失,在最后提示,到时注意看有没有Erro之类的提示,如果没有说明安装正常了. 本人安装过程中没有出现错误, 如果网友编译过程中出了问题记得告诉我.
[root@ibm gmp-4.2.2]# make install
安装编译后的软件,完成了安装过程

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

安装mpfr
[root@ibm ~]# cd mpfr-2.3.0
接下来把补丁给安装上
[root@ibm ~]# patch -N -Z -p1 < mpfr-2.3.0.patch
在安装过程中,有两个.c文件因为时间参数不能匹配而不能应用补丁.mpfr.h和version.c 

Not setting time of file mpfr.h (time mismatch)
Not setting time of file version.c (time mismatch)

在接下来的安装似乎没有影响.希望知道的朋友告诉我
接着配置
[root@ibm mpfr-2.3.0]# ./configure --with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib
[root@ibm mpfr-2.3.0]#  make
[root@ibm mpfr-2.3.0]#  make check

如果出现如下信息
====================
All 132 tests passed
====================
make[2]: Leaving directory `/root/mpfr-2.3.0/tests'
make[1]: Leaving directory `/root/mpfr-2.3.0/tests'
make[1]: Entering directory `/root/mpfr-2.3.0'
make[1]: Nothing to be done for `check-am'.
make[1]: Leaving directory `/root/mpfr-2.3.0'
说明编译成功了.
接下来安装
[root@ibm mpfr-2.3.0]#  make install


注:
如果在配置mpfr的过程中出现如下信息
checking if gmp.h version and libgmp version are the same... (4.2.2/4.1.4) no
configure: WARNING: 'gmp.h' and 'libgmp' seems 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).
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: creating ./config.status
gmp.h的版本不匹配
原因多数是因为没有添加 --with-gmp-include 而造成的, 只要安我的做就可以通过

如果没有 --with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib 
很可能在 make check 的时候会出现以下错误
__gmp_get_memory_functions

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics