首页 / 操作系统 / Linux / 在CentOS 6.4中编译安装GCC 4.8.1 + GDB 7.6.1 + Eclipse
在CentOS 6.4中编译安装GCC 4.8.1 + GDB 7.6.1 + Eclipse一、编译安装gcc 4.8.11. 安装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 /root/Downloads/tar -zxvf gcc-4.8.1.tar.gz4. 下载编译所需的依赖包cd /root/Downloads/gcc-4.8.1./contrib/download_prerequisitescd ..5. 新建目录存放编译结果mkdir gcc-build-4.8.16. 进入新目录,并执行configure命令,产生makefilecd gcc-build-4.8.1
../gcc-4.8.1/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib7. 编译gcc 4.8.1make -j48. 安装gcc 4.8.1sudo make install9. 更新libstdc++.so.6sudo cp /root/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红字部分在不同平台上有所不同,注意,如果是64位系统,则命令中的lib要替换为lib6410. 检查版本g++ --versiong++ (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 --versiongcc (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.二、编译安装gdb 7.6.11. 先卸载gdb旧版本rpm -qa | grep gdbrpm -e --nodeps gdb-7.2-60.el6_4.1.i686 2. 安装Texinfo文档系统yum install ncurses-devel 3. 下载gdb 7.6.1源码包http://ftp.gnu.org/gnu/gdb/gdb-7.6.1.tar.gz将源码包放在home目录的Download目录中4. 解压缩gdb 7.6.1源码包cd /root/Downloads/tar -zxvf gdb-7.6.1.tar.gz5. 生成makefilecd /root/Downloads/gdb-7.6.1./configuremakesudo make install6. 将编译好的gdb拷贝到/usr/bin目录中
sudo cp /root/Downloads/gdb-7.6.1/gdb/gdb /usr/bin/gdb
7. 查看安装是否成功。
gdb -v三、安装Eclipse1. 下载Eclipse IDE for C/C++ Developerscd /root/Downloadswget http://mirror.hust.edu.cn/eclipse//technology/epp/downloads/release/luna/R/eclipse-cpp-luna-R-linux-gtk-x86_64.tar.gz2. 解压安装Eclipsetar xvzf eclipse-cpp-luna-R-linux-gtk-x86_64.tar.gzmv /root/Downloads/eclipse /usr/local/Eclipse4Crm -rf eclipse-cpp-luna-R-linux-gtk-x86_64.tar.gz3. 创建桌面快捷方式在系统桌面上单击右键,在弹出菜单中选择“Create Launcher ...”,按照如下截图进行设置:其中,Command参数为/usr/local/Eclipse4C/eclipse,点击OK按钮便可在桌面创建快捷方式4. 设置Workspacemkdir -p /home/Workspace/C在桌面上双击打开Eclipse4C快捷方式,将Workspace目录指定为/home/Workspace/C,如下图所示:5. 安装ShellED插件在Eclipse的菜单栏上找到Help → Install New Software ...,打开Install窗口,配置好之后,如下图所示:勾选Shell Script之后,一路Next下去即可ShellED的下载链接为:http://sourceforge.net/projects/shelled/files/shelled/update/6. 为C/C++工程添加ShellED支持右键点击工程名称,在弹出的菜单中选择ShellED → Add Shell Script Support经过如上设置,Eclipse便可以在C/C++工程中运行Shell脚本了GCC编译器入门 http://www.linuxidc.com/Linux/2015-01/111431.htmUbuntu 12.04嵌入式交叉编译环境arm-linux-GCC搭建过程图解 http://www.linuxidc.com/Linux/2013-06/85902.htmUbuntu 12.10安装交叉编译器arm-none-linux-gnueabi-GCC http://www.linuxidc.com/Linux/2013-03/82016.htmUbuntu下Vim+GCC+GDB安装及使用 http://www.linuxidc.com/Linux/2013-01/78159.htmUbuntu下两个GCC版本切换 http://www.linuxidc.com/Linux/2012-10/72284.htmGCC 的详细介绍:请点这里
GCC 的下载地址:请点这里更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14本文永久更新链接地址