安装gcc-4.8 示例错误方法 和 正确方法 --linux下用c++ 11
来源:互联网 发布:龙虎榜数据 同花顺 编辑:程序博客网 时间:2024/06/04 18:18
国外网站比较慢,所以我会放上我下载的软件包。
1:
configure gcc,显示requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+。
2:
下载这三个文件。ftp://ftp.gnu.org/gnu/gmp 选择自己想要的版本。
其他同理。参考 http://www.multiprecision.org/mpc
http://ftp.gnu.org/gnu/mpfr
3:
安装GMP:直接./configure,make,make check,sudo make install
4:
安装MPFR:./configure --with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib ,
之后make顺利
make check显示有错,
问题如下:
[tversion] GMP: header 5.1.3, library 5.0.2
[tversion] MPFR tuning parameters from src/x86/core2/mparam.h
ERROR! The versions of gmp.h (5.1.3) and libgmp (5.0.2) do not match.
The possible causes are:
* A bad configuration in your include/library search paths.
* An inconsistency in the include/library search paths of
your development environment; an example:
http://gcc.gnu.org/ml/gcc-help/2010-11/msg00359.html
* GMP has been upgraded after the first "make check".
In such a case, try again after a "make clean".
* A new or non-standard version naming is used in GMP.
In this case, a patch may already be available on the
MPFR web site. Otherwise please report the problem.
In the first two cases, this may lead to errors, in particular with MPFR.
If some other tests fail, please solve that problem first.
FAIL: tversion
=====================
2 of 160 tests failed
(1 test was not run)
=====================
正确做法:
删除gmp,方法是进入gmp目录,sudo make uninstall.
重新做第3步:在gmp-5.1.3同级目录下建立一个临时的编译目录,这里命名为temp。然后开始配置安装选项,进入temp目录,输入以下命令进行配置:
../gmp-5.1.3/configure --prefix=/usr/local/gmp-5.1.3.
之前的方法在/usr/local没有单独的gmp-5.1.3这个单独文件。gmp-5.1.3的.h,gmplib,dir和.info这些文件分散在local里的include,lib,和share里。而
单独放到一个文件里在配置MPFR的时候--with-gmp=/usr/local/gmp-5.1.3而不是--with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib
可以防止出现出现The versions of gmp.h (5.1.3) and libgmp (5.0.2) do not match这样的情况出现。
之所以用temp这个临时的编译目录,而不是当前目录下configure,是因为tar.bz2是纯净的c语言源代码,在configure和make之后生成的和本机相关的二进制文件和源代码混到一起,怎么给别人用?如果安装失败的话,有时重新configure的时候,还要make distclean。
重新做第4步:./configure --with-gmp=/usr/local/gmp-5.1.3.
第5步:../mpc-1.0.1/configure --prefix=/usr/local/mpc-1.0.1 --with-gmp=/usr/local/gmp-5.1.3 --with-mpfr=/usr/local/mpfr-3.1.2
第6步:export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpc-1.0.1/lib:/usr/local/gmp-5.1.3/lib:/usr/local/mpfr-3.1.2/lib
第7步:再次建立一个temp(可选,我洁癖)../gcc-4.8.0/configure --prefix=/usr/local/gcc-4.8.0 --enable-threads=posix --disable-checking --disable-multilib --enable-languages=c,c++
--with-gmp=/usr/local/gmp-5.1.3 --with-mpfr=/usr/local/mpfr-3.1.2 --with-mpc=/usr/local/mpc-1.0.1
然后接着make,时间非常长,建议吃个饭,再散散步。
这次如果时间着急的话,可以不用make check,时间太漫长了
接着sudo make install
完成了。
不过,还不是完美。因为如果这个时候输入gcc -v 或者是 g++ -v,依旧是我原来的4.6.3.
因为文件安装在/usr/local/gcc-4.8.0里。
which g++看到在/usr/bin/gcc,所以系统原先的gcc没有被覆盖。默认的依旧是4.6.3,如果要用4.8.0还要每次改Makefile的CC =。我的办法是,把现有的/usr/bin做个备份,然后把gcc-4.8.0里的文件覆盖到里面,再g++ -v就对了。
但是,千万别着急删除备份,存一段时间,由于我用的NS-3目前尚不支持gcc-4.8.0,于是我只好再换回来,只能makefile了~
0 0
- 安装gcc-4.8 示例错误方法 和 正确方法 --linux下用c++ 11
- GCC安装方法 (Linux)
- linux gcc 安装方法
- Linux 下正确关机方法
- 详解Linux安装GCC方法
- 详解Linux安装GCC方法
- 详解Linux安装GCC方法
- linux下检查GCC是否安装的方法
- linux下安装2种GCC的方法
- Fedora 17安装gcc 和 g++(c++)方法命令
- Fedora 17安装gcc 和 g++(c++)方法命令
- linux下安装protoc-c的方法
- C/C++生成随机数字符串(错误方法和正确方法)
- CentOS下MRTG的正确安装方法
- Windows下正确安装IAR的方法
- Linux下正确编译jar的方法
- Ubuntu下安装低版本GCC方法
- Windows下和linux下禅道安装方法
- linux下编译出现空间不足解决办法
- Redis的安装部署
- OpenSUSE .desktop桌面配置文件编写
- 链接和共享库
- 广州传智播客送给高中毕业想学Java的同学
- 安装gcc-4.8 示例错误方法 和 正确方法 --linux下用c++ 11
- ASP.NET AJAX Timer 控件概述
- 算法竞赛入门经典-前四章-UVa10071 - Back to High School Physics-重温高中物理-难度0
- 老程序员学C# ------操作DataGridView控件详解
- 倒序输出(2)
- iOS7应用开发16:模态segue、文本框、警告、Action Sheet
- 归并排序
- VirtualBox下linux与win7之间数据空间的建立
- R12供应商和银行