在CentOS 6.4中编译安装gcc 4.8.1
2015-02-12 23:25
351 查看
在CentOS 6.4中编译安装gcc 4.8.1
分类: C/C++ Linux/Unix2013-11-28 21:02 1877人阅读 评论(0) 收藏 举报原文链接:/article/5627957.html
1. 安装gcc和g++
新安装的CentOS缺少编译环境,必须先安装旧版本的gcc, 然后再进行自举编译
yum -y install gcc
yum -y install gcc-c++
2. 下载gcc 4.8.1源码包
http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.8.1/gcc-4.8.1.tar.gz
将源码包放在home目录的Download目录中
3. 解压缩gcc 4.8.1源码包
cd /home/User_Name/Downloads/
tar -zxvf gcc-4.8.1.tar.gz
4. 下载编译所需的依赖包
cd /home/User_Name/Downloads/gcc-4.8.1
./contrib/download_prerequisites
cd ..
5. 新建目录存放编译结果
mkdir gcc-build-4.8.1
6. 进入新目录,并执行configure命令,产生makefile
cd gcc-build-4.8.1
../gcc-4.8.1/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
7. 编译gcc 4.8.1
make -j4
8. 安装gcc 4.8.1
sudo make install
9. 更新libstdc++.so.6
sudo cp /home/User_Name/Downloads/gcc-build-4.8.1/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.18 /usr/lib
sudo ln -sf /usr/lib/libstdc++.so.6.0.18 /usr/lib/libstdc++.so.6
红字部分在不同平台上有所不同
10. 检查版本
g++ --version
g++ (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
gcc --version
gcc (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
相关文章推荐
- CentOS 6.4 编译安装 gcc 4.8.1
- CentOS 6.4 编译安装 gcc 4.8.1
- 在CentOS 6.4中编译安装gcc 4.8.1
- CentOS 6.4 编译安装 gcc 4.8.1
- CentOS 6.4 编译安装 gcc 4.8.1
- CentOS6.5升级手动安装GCC4.8.2 与 CentOS 6.4 编译安装 gcc 4.8.1
- CentOS 6.4 编译安装 gcc 4.8.1
- CentOS 6.4 编译安装 gcc 4.8.1(转)
- CentOS 6.4 编译安装 gcc 4.8.1
- 【转】在CentOS 6.4中编译安装GCC 4.8.1 + GDB 7.6.1
- 在CentOS 6.4中编译安装gcc 4.8.1 + gdb 7.6.1 + Eclipse
- CentOS 6.4 编译安装 gcc 4.8.1
- CentOS 6.4 编译安装 gcc 4.8.1
- CentOS 6.4中升级编译安装GCC 4.8.1 + GDB 7.6.1 + Eclipse 以及Kdump配置
- CentOS 6.4 编译安装 gcc 4.8.1
- 在CentOS 6.4中编译安装gcc 4.8.1
- 在CentOS 6.4中编译安装GCC 4.8.1 + GDB 7.6.1
- CentOS 6.4 编译安装 gcc-4.8.0
- CentOS 6.4 编译安装 gcc-4.8.0
- CentOS 6.4 编译安装 gcc-4.8.0