安装gcc4.8.5

摘要:
//Gcc公司。gnu。org/pub/gcc/instructure/。另请参见http://configure:cannotcompile参见`config。log'表单详细信息。make[2]:***[configurate stage1 target libgcc]Error1make[2]:错误:libmpc。2:make-j8报告错误:

安装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》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇Shell命令合集SharePOint 2010 dashboard designer 使用说明下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

在GNU/Linux下制作Windows 10安装U盘

今年春节回家期间,我需要将家里的一台安装了Debian Stretch的ZaReason笔记本电脑更换为Windows 10系统,好让爸妈从老台式机上的XP系统升级到新的平台上来。回家前,小仙女已在微软官网帮我买好了正版软件,我也利用微软提供的Media Creation Tool创建了安装U盘。然而,等拿回家后安装的时候才发现,安装密码无效。联系客服后得...

FFmpeg在Linux下编译使用

1.FFmpeg编译 1.1.安装yasm 这里我是直接通过ubuntu包安装的,当然也可以通过编译源码来安装。 sudo apt-get install yasm 1.2.下载FFmpeg git clone https://git.ffmpeg.org/ffmpeg.git 1.3.配置、编译FFMPEG ./configure --prefix=ho...

《SED 单行脚本快速参考》的 awk 实现

http://linuxtoy.org/archives/sed-awk.html { 撰文/bones7456} sed 和 awk 都是 Linux 下常用的流编辑器,他们各有各的特色,本文并不是要做什么对比,而是权当好玩,把《SED 单行脚本快速参考》这文章,用 awk 做了一遍~ 至于孰好孰坏,那真是很难评论了。一般来说,sed 的命令会更短小一些...

自动生成Makefile的全过程详解

一、简介 Linux下的程序开发人员,一定都遇到过Makefile,用make命令来编译自己写的程序确实是很方便。一般情况下,大家都是手工写一个简单Makefile,如果要想写出一个符合自由软件惯例的Makefile就不那么容易了. 在本文中,将介绍如何使用autoconf和automake两个工具来帮助我们自动地生成符合自由软件惯例的Makefile,这...

Kratos 读源码笔记一(配置加载)

从入口文件看配置(初始化/加载/绑定/热加载) main.go //main.go 初始化配置 c := config.New( config.WithSource( file.NewSource(flagconf), //文件配置源 //也可以自己实现远程配置中心数据源 ), ) //加载配置数据 if err := c.L...

linux编程头文件所在路径的问题

一、问题引入 1、头文件与库       当我们在PC主机linux环境下(如ubuntu),编写linux应用程序,然后利用gcc来编译。在源代码的开始位置会写入头文件,那是因为我们使用了系统提供的库函数,例如printf、open、read、write等等。我们会写入类似的内容: #include <stdio.h> #include &...