安装gcc4.8.5
安装gcc4.8.5
1. g++ --version, 4.4.7不支持c++11
2. 升级gcc-c++, 下载gcc
https://gcc.gnu.org/ 官网,镜像下载地址https://gcc.gnu.org/mirrors.html,随便找个镜像下载就行了
http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.8.5/gcc-4.8.5.tar.bz2
3. 解压,配置configure --prefix=yourprefix --enable-languages=c,c++
报错:
configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also
http://gcc.gnu.org/install/prerequisites.html for additional info. If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files. They may be located in separate packages.
去ftp://gcc.gnu.org/pub/gcc/infrastructure/下载所需的gmp-4.3.2.tar.bz2,mpc-0.8.1.tar.gz,mpfr-2.4.2.tar.bz2
分别解压安装
4. 重新配置,configure --prefix=yourprefix --enable-languages=c,c++ --with-gmp=gmp_path --with-mpc=mpc_path --with-mpfr=mpfr_path
再报错:
checking for suffix of object files... configure: error: in `xxx/gcc-4.8.5/x86_64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory `xxx/gcc-4.8.5'
不要打开xxx/gcc-4.8.5/config.log, 错误信息xxx/gcc-4.8.5/x86_64-unknown-linux-gnu/libgcc/config.log
共有3类错误信息:
1. xgcc: error: unrecognized command line option '-V', fatal error: no input files
2. xgcc: error: unrecognized command line option '-qversion', fatal error: no input files
3. xxx/gcc-4.8.5/x86_64-unknown-linux-gnu/gcc/cc1: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory
Google了半天,结果是1/2类错误可以忽略不计,3类错误我们上面明明已经安装了mpc,也指定了路径,结果还是找不到。。。
需要设置LD_LIBRARY_PATH,export LD_LIBRARY_PATH=mpc_path/lib
参考:http://blog.csdn.net/gaara_fan/article/details/7436940
5. 编译,make -j8
报错: Error “gnu/stubs-32.h: No such file or directory”
原因是缺少32位libc开发包(http://stackoverflow.com/questions/7412548/error-gnu-stubs-32-h-no-such-file-or-directory-while-compiling-nachos-source)
yum install glibc-devel.i686
6. 再编译,make -j8
等待…………………………………………………………………………
7. make install
8. 编写helloworld.cpp,编译: g++ helloworld.cpp
报错: cc1plus: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory
add LD_LIBRARY_PATH=mpc_path/lib
9. 运行,./a.out, OK
10. debug,gdb a.out
加断点,run,Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.47.el6_2.9.x86_64 libgcc-4.4.6-3.el6.x86_64 libstdc++-4.4.6-3.el6.x86_64
参考:http://stackoverflow.com/questions/10389988/missing-separate-debuginfos-use-debuginfo-install-glibc-2-12-1-47-el6-2-9-i686
#debuginfo-install glibc-2.12-1.47.el6_2.9.x86_64 libgcc-4.4.6-3.el6.x86_64 libstdc++-4.4.6-3.el6.x86_64
n运行下一条,Single stepping until exit from function main, which has no line number info
参考:http://stackoverflow.com/questions/20474668/gdb-compile-with-g-option-but-single-stepping-until-exit-from-function-main
gdb版本太低……7.2-90.e16
http://ftp.gnu.org/gnu/gdb/下载新版本:gdb-7.6.tar.bz2
解压安装
再次调试,OK……
安装gcc4.8.5的更多相关文章
- Debian7安装GCC4.8
参考一 参考二 参考三 参考四 Ubuntu13.04下编译GCC-4.8.2源码并安装成功 CentOS 6编译安装GCC4.8 CentOS 6.4系统编译安装gcc-4.8. ...
- 安装在ubuntu12.04上安装gcc4.8
因为gcc4.8支持最新的c++11标准,所有开始c++11标准系列学习前,请按照gcc4.8,方便边学习边写代码练习. 安装编译好的gcc4.8 sudo add-apt-repository pp ...
- CentOS下编译安装Gcc-4.9
给公司测试服务器搭环境,手工安装gcc-4.9.0颇费功夫,记录如下. 1.安装gcc.g++,系统源默认安装版本为4.4.7: 2.安装依赖包GMP.MPFR.MPC,注意安装顺序: 3.修改动态库 ...
- Ubuntu 13.04 安装 GCC4.8.1
终于有了完整实现C++11的GCC 4.8.1. 给自己的系统升级吧. 下面的步骤可以安装GCC4.8.1, 内容来自:http://askubuntu.com/questions/312620/ho ...
- (原)ubuntu14.04中安装gcc4.9和g++4.9
http://stackoverflow.com/questions/28683747/installing-gcc4-9-on-ubuntu-14-04-lts http://askubuntu.c ...
- linux(Centos)下编译安装gcc4.8.2
欢迎转载.转载请注明原文地址:http://blog.csdn.net/majianfei1023/article/details/46811159 近期要用到c++ 11,所以没办法仅仅得把那台ce ...
- 源码安装GCC-4.9.2
本文参考:http://cuchadanfan.blog.51cto.com/9940284/1689556 感谢原作者的分享! 首先安装基础包,安装网络依赖的时候要用 [root@localhos ...
- CentOS6.5升级手动安装GCC4.8.2 与 CentOS 6.4 编译安装 gcc 4.8.1
http://blog.163.com/zhu329599788@126/blog/static/6669335020161179259975 http://www.cnblogs.com/codem ...
- 手动安装GCC4.8.5
服务器是 redhat 6,安装xgboost时,提示自带gcc 太老, 需要手动升级. 1). 手动安装 mpc-0.8.2.tar.gz, 用默认参数, 安装完后添加系统变量 export LD_ ...
随机推荐
- marquee实现跑马灯
<!DOCTYPE html><html> <head><title>跑马灯大全</title> </head> <bod ...
- tensorflow训练自己的数据集实现CNN图像分类1
利用卷积神经网络训练图像数据分为以下几个步骤 读取图片文件 产生用于训练的批次 定义训练的模型(包括初始化参数,卷积.池化层等参数.网络) 训练 1 读取图片文件 def get_files(file ...
- Jmeter响应内容显示乱码问题的解决办法
Jmeter在访问接口的时候,响应内容如果有中文可能会显示乱码,原因应该是响应页面没有做编码处理,jmeter默认按照ISO-8859-1编码格式进行解析. 下面把解决步骤列一下: 现象:jmeter ...
- linux服务器文件索引inodes满了
inode节点中,记录了文件的类型.大小.权限.所有者.文件连接的数目.创建时间与更新时间等重要的信息,还有一个比较重要的内容就是指向数据块的指针.一般情况不需要特殊配置,如果存放文件很多,需要配置. ...
- Sybase 存储过程中IF的用法
Sybase 存储过程中IF的用法 --@i_val 为参数 or @i_val is null then begin --执行内容 end; end if;
- 20145334赵文豪网络对抗Web安全基础实践
1.SQL注入攻击原理,如何防御? SQL注入攻击就是通过把SQL命令插入到Web表单递交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行恶意SQL命令的目的. 对于SQL注入攻击的防范,我觉 ...
- Android实践项目汇报(一)
# 我要做的是Google天气客户端 一.Need(需求): 1. 功能性需求分析 天气预报客户端,顾名思义就是为用户提供实时准确的天气信息,方便用户出行生活.根据用户日常需求,软件实现后所达到的功能 ...
- 面向对象第一话,大战java正则表达式
本周我们迎来第一项任务,java面向对象之实现对一串字符的匹配以及构造出计算的多项式,最终得出计算的结果.简而言之,可以用以下的要求来看题目: 输入的多项式字符串中不得出现非法字符 多项式的输入型式, ...
- TI 实时操作系统SYS/BIOS使用总结
1:概述: SYS/BIOS 是一个可扩展的实时的操作系统.具有非常快速的响应时间(在中断和任务切换时达到较短的延迟),响应时间的确定性,强壮的抢占系统,优化的内存分配和堆栈管理(尽量少的消耗和碎片) ...
- linux下安装evernote国际版
一.背景 由于之前一直将笔记记录在evernote,因此现在转到linux下需要使用工具来记录笔记到evernote上 OS : Ubuntu 16.04 (xenial) 二.linux版everp ...