gcc 5.2.0 编译安装笔记-20151110
**转载请注明出处**
by.haunying3
比如ftp://mirrors-usa.go-parts.com/gcc/releases/gcc-5.2.0/gcc-5.2.0.tar.bz2
2、创建目录并下载文件
mkdir gccwget ftp://mirrors-usa.go-parts.com/gcc/releases/gcc-5.2.0/gcc-5.2.0.tar.bz2
a、安装GMP解压tar -xjvf gmp-6.1.0.tar.bz2编译并安装cd gmp-6.1.0mkdir /usr/local/gmp-6.1.0./configure --prefix=/usr/local/gmp-6.1.0 --enable-cxxmake -j 4make checksudo make install
b、安装MPFR解压tar -xzvf mpfr-3.1.3.tar.gz编译并安装cd mpfr-3.1.3mkdir /usr/local/mpfr-3.1.3./configure --prefix=/usr/local/mpfr-3.1.3 --with-gmp=/usr/local/gmp-6.1.0注:指定默认路径--with-gmp-include=/usr/local/gmp-6.1.0/include
--with-gmp-lib=/usr/local/gmp-6.1.0/libmake -j 4make checksudo make install
c、安装MPCwget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz解压tar -xzvf mpc-1.0.3.tar.gz编译并安装cd mpc-1.0.3mkdir /usr/local/mpc-1.0.3./configure --prefix=/usr/local/mpc-1.0.3 --with-gmp=/usr/local/gmp-6.1.0 --with-mpfr=/usr/local/mpfr-3.1.3make -j 4make checksudo make installexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/gmp-6.1.0/lib: /usr/local/mpfr-3.1.3/lib:/usr/local/mpc-1.0.3/lib【重新启动失效&仅仅对当前用户有效】
或用以下方法【对全部用户永久生效】
vi /etc/ld.so.conf
将以下内容填入
/usr/local/gmp-6.1.0/lib
/usr/local/mpfr-3.1.3/lib
/usr/local/mpc-1.0.3/lib
退出运行ldconfig
which autogen存在则跳过此步】
下载[http://www.gnu.org/software/autogen/]
wget http://ftp.gnu.org/gnu/autogen/rel5.18.6/autogen-5.18.6.tar.gz解压
tar -xzvf autogen-5.18.6.tar.gz
cd autogen-5.18.6
mkdir /usr/local/autogen-5.18.6安装autogen依赖项guile【忍无可忍,强烈吐槽linux的依赖关系】wget ftp://ftp.gnu.org/gnu/guile/guile-2.0.7.tar.xzxz -dk guile-2.0.7.tar.xztar -xvf guile-2.0.7.tarcd guile-2.0.7yum search Libtoolyum install libtool-ltdl-devel.x86_64yum search libunistringyum install libunistring-devel.x86_64yum search libffiyum install libffi-devel.x86_64yum search gcyum install gc-devel.x86_64mkdir /usr/local/guile-2.0.7【由于非默认安装gmp跟configure兼容问题。此处须要安装一个默认的gmp:yum install gmp-devel.x86_64——不会对编译gcc的产生影响(手动指定)】./configure --prefix=/usr/local/guile-2.0.7make -jmake check【有几个错误。只是已经麻木,忽略】make installvi /etc/ld.so.conf增加/usr/local/guile-2.0.7/lib运行ldconfigsudo update-alternatives --install /usr/bin/guile guile /usr/local/guile-2.0.7/bin/guile 30杯具的是,不能通过--with-guile=/usr/local/guile-2.0.7/指定编译选项,仅仅能通过下面方式改动vi /etc/profile加入export PKG_CONFIG_PATH=/usr/local/guile-2.0.7/lib/pkgconfig:$PKG_CONFIG_PATH运行source /etc/profile./configure --prefix=/usr/local/autogen-5.18.6
make -j 4
make check
make install
sudo update-alternatives --install /usr/bin/autogen autogen /usr/local/autogen-5.18.6/bin/autogen 30
6、创建数据文件夹并编译
cd ..
mkdir gcc_5.2_build
cd gcc_5.2_build
mkdir /usr/local/gcc-5.2.0
../gcc-5.2.0/configure --prefix=/usr/local/gcc-5.2.0 -enable-threads=posix --enable-checking=release
--enable-languages=c,c++ --enable-__cxa_atexit --disable-multilib --build=x86_64-redhat-linux --with-gmp=/usr/local/gmp-6.1.0
--with-mpfr=/usr/local/mpfr-3.1.3 --with-mpc=/usr/local/mpc-1.0.3
make -j 4make checkmake install
假设/usr/bin下的gcc等文件是实体文件而不是链接则须要【否则用update-alternatives加入优先级较低的老版本号路径】
mv gcc gcc-4.4.7
mv g++ g++-4.4.7
mv c++ c++-4.4.7
mv cpp cpp-4.4.7
然后运行
sudo update-alternatives --install /usr/bin/gcc gcc /usr/local/gcc-5.2.0/bin/x86_64-redhat-linux-gcc 30sudo update-alternatives --install /usr/bin/g++ g++ /usr/local/gcc-5.2.0/bin/x86_64-redhat-linux-g++ 30sudo update-alternatives --install /usr/bin/c++ c++ /usr/local/gcc-5.2.0/bin/x86_64-redhat-linux-c++ 30sudo update-alternatives --install /usr/bin/cpp cpp /usr/local/gcc-5.2.0/bin/cpp 30
8、加入库文件路径【黄色为分析过程】
cd /usr/local/gcc-5.2.0find ./ -name *.so*./libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/liblto_plugin.so.0./libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/liblto_plugin.so./libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/liblto_plugin.so.0.0.0./lib64/libgomp-plugin-host_nonshm.so.1.0.0./lib64/libvtv.so.0./lib64/libssp.so.0.0.0./lib64/libgcc_s.so./lib64/libitm.so.1.0.0./lib64/libcc1.so.0./lib64/libstdc++.so.6.0.21-gdb.py./lib64/libssp.so.0./lib64/libstdc++.so.6./lib64/libvtv.so.0.0.0./lib64/libatomic.so.1.1.0./lib64/libgomp.so.1.0.0./lib64/libgomp-plugin-host_nonshm.so./lib64/libubsan.so./lib64/libcc1.so.0.0.0./lib64/libgomp-plugin-host_nonshm.so.1./lib64/liblsan.so.0./lib64/libitm.so./lib64/libquadmath.so./lib64/libgcc_s.so.1./lib64/libquadmath.so.0.0.0./lib64/libquadmath.so.0./lib64/libcilkrts.so./lib64/libasan.so./lib64/libatomic.so.1./lib64/libasan.so.2./lib64/libasan.so.2.0.0./lib64/libcilkrts.so.5.0.0./lib64/libcilkrts.so.5./lib64/libtsan.so.0.0.0./lib64/libstdc++.so.6.0.21./lib64/libgomp.so.1./lib64/libssp.so./lib64/libubsan.so.0./lib64/libatomic.so./lib64/libitm.so.1./lib64/libstdc++.so./lib64/libtsan.so.0./lib64/libtsan.so./lib64/libcc1.so./lib64/liblsan.so.0.0.0./lib64/liblsan.so./lib64/libvtv.so./lib64/libgomp.so./lib64/libubsan.so.0.0.0./lib/gcc/x86_64-unknown-linux-gnu/5.2.0/plugin/libcc1plugin.so.0.0.0./lib/gcc/x86_64-unknown-linux-gnu/5.2.0/plugin/libcc1plugin.so./lib/gcc/x86_64-unknown-linux-gnu/5.2.0/plugin/libcc1plugin.so.0打开配置文件vi
/etc/ld.so.conf将路径写入/usr/local/gcc-5.2.0/lib64/usr/local/gcc-5.2.0/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/plugin/usr/local/gcc-5.2.0/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0运行ldconfig
ldconfig: /usr/local/gcc-5.2.0/lib64/libstdc++.so.6.0.21-gdb.py 不是 ELF 文件 - 它起始的魔数错误。
mv /usr/local/gcc-5.2.0/lib64/libstdc++.so.6.0.21-gdb.py /usr/local/gcc-5.2.0/lib64/bak_libstdc++.so.6.0.21-gdb.pyldconfig验证ldd mysql【用户程序已经切换到新库】
linux-vdso.so.1 => (0x00007fffb5bff000)
libncursesw.so.5 => /lib64/libncursesw.so.5 (0x00007f2c6be7f000)libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f2c6bc61000)libmysqlclient.so.16 => /usr/lib64/mysql/libmysqlclient.so.16 (0x00007f2c6b8dd000)libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f2c6b6a6000)libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f2c6b48c000)libssl.so.10 => /usr/lib64/libssl.so.10 (0x00007f2c6b220000)libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x00007f2c6ae3d000)libz.so.1 => /lib64/libz.so.1 (0x00007f2c6ac26000)libstdc++.so.6 => /usr/local/gcc-5.2.0/lib64/libstdc++.so.6 (0x00007f2c6a899000)libm.so.6 => /lib64/libm.so.6 (0x00007f2c6a615000)libgcc_s.so.1 => /usr/local/gcc-5.2.0/lib64/libgcc_s.so.1 (0x00007f2c6a3fe000)libc.so.6 => /lib64/libc.so.6 (0x00007f2c6a06a000)libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f2c69e49000)libdl.so.2 => /lib64/libdl.so.2 (0x00007f2c69c44000)/lib64/ld-linux-x86-64.so.2 (0x00007f2c6c0b4000)libfreebl3.so => /lib64/libfreebl3.so (0x00007f2c699cb000)libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007f2c69787000)libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007f2c694a0000)libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f2c6929c000)libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007f2c69070000)libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007f2c68e64000)libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f2c68c61000)libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f2c68a47000)libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f2c68827000)ldd /bin/ls 【对系统无影响】linux-vdso.so.1 => (0x00007fff0337f000)libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f2f230ef000)librt.so.1 => /lib64/librt.so.1 (0x00007f2f22ee7000)libcap.so.2 => /lib64/libcap.so.2 (0x00007f2f22ce2000)libacl.so.1 => /lib64/libacl.so.1 (0x00007f2f22ada000)libc.so.6 => /lib64/libc.so.6 (0x00007f2f22746000)libdl.so.2 => /lib64/libdl.so.2 (0x00007f2f22541000)/lib64/ld-linux-x86-64.so.2 (0x00007f2f23314000)libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f2f22324000)libattr.so.1 => /lib64/libattr.so.1 (0x00007f2f2211f000)
首先找出旧版本号安装包【已经在编译后将老版本号gcc卸载】rpm -qa | grep 4.4.7db4-4.7.25-18.el6_4.x86_64libstdc++-4.4.7-11.el6.x86_64cpp-4.4.7-11.el6.x86_64libstdc++-devel-4.4.7-11.el6.x86_64libgcc-4.4.7-11.el6.x86_64libgomp-4.4.7-11.el6.x86_64找出安装包相应的动态库文件【不包括有版本号路径下的库文件】rpm -ql libstdc++-4.4.7-11.el6.x86_64 | grep lib/usr/lib64/libstdc++.so.6/usr/lib64/libstdc++.so.6.0.13rpm -ql cpp-4.4.7-11.el6.x86_64 | grep lib/lib/cpp/usr/libexec/gcc/usr/libexec/gcc/x86_64-redhat-linux/usr/libexec/gcc/x86_64-redhat-linux/4.4.4/usr/libexec/gcc/x86_64-redhat-linux/4.4.4/cc1/usr/libexec/gcc/x86_64-redhat-linux/4.4.7/usr/share/locale/be/LC_MESSAGES/cpplib.mo/usr/share/locale/ca/LC_MESSAGES/cpplib.mo/usr/share/locale/da/LC_MESSAGES/cpplib.mo/usr/share/locale/de/LC_MESSAGES/cpplib.mo/usr/share/locale/el/LC_MESSAGES/cpplib.mo/usr/share/locale/es/LC_MESSAGES/cpplib.mo/usr/share/locale/fr/LC_MESSAGES/cpplib.mo/usr/share/locale/id/LC_MESSAGES/cpplib.mo/usr/share/locale/ja/LC_MESSAGES/cpplib.mo/usr/share/locale/nl/LC_MESSAGES/cpplib.mo/usr/share/locale/sv/LC_MESSAGES/cpplib.mo/usr/share/locale/tr/LC_MESSAGES/cpplib.mo/usr/share/locale/uk/LC_MESSAGES/cpplib.mo/usr/share/locale/vi/LC_MESSAGES/cpplib.mo/usr/share/locale/zh_CN/LC_MESSAGES/cpplib.mo/usr/share/locale/zh_TW/LC_MESSAGES/cpplib.morpm -ql libstdc++-devel-4.4.7-11.el6.x86_64 | grep lib/usr/include/c++/4.4.4/cstdlib/usr/include/c++/4.4.4/tr1/cstdlib/usr/include/c++/4.4.4/tr1/stdlib.h/usr/include/c++/4.4.4/tr1_impl/cstdlib/usr/lib/gcc/usr/lib/gcc/x86_64-redhat-linux/usr/lib/gcc/x86_64-redhat-linux/4.4.4/usr/lib/gcc/x86_64-redhat-linux/4.4.4/libstdc++.a/usr/lib/gcc/x86_64-redhat-linux/4.4.4/libsupc++.a/usr/lib/gcc/x86_64-redhat-linux/4.4.7/usr/share/doc/libstdc++-devel-4.4.7/usr/share/doc/libstdc++-devel-4.4.7/ChangeLog-1998.bz2/usr/share/doc/libstdc++-devel-4.4.7/ChangeLog-1999.bz2/usr/share/doc/libstdc++-devel-4.4.7/ChangeLog-2000.bz2/usr/share/doc/libstdc++-devel-4.4.7/ChangeLog-2001.bz2/usr/share/doc/libstdc++-devel-4.4.7/ChangeLog-2002.bz2/usr/share/doc/libstdc++-devel-4.4.7/ChangeLog-2003.bz2/usr/share/doc/libstdc++-devel-4.4.7/ChangeLog-2004.bz2/usr/share/doc/libstdc++-devel-4.4.7/ChangeLog-2005.bz2/usr/share/doc/libstdc++-devel-4.4.7/ChangeLog-2006.bz2/usr/share/doc/libstdc++-devel-4.4.7/ChangeLog-2007.bz2/usr/share/doc/libstdc++-devel-4.4.7/ChangeLog.bz2/usr/share/doc/libstdc++-devel-4.4.7/ChangeLog~.bz2/usr/share/doc/libstdc++-devel-4.4.7/READMErpm -ql libgcc-4.4.7-11.el6.x86_64 | grep lib/lib64/libgcc_s-4.4.7-20120601.so.1/lib64/libgcc_s.so.1/usr/share/doc/libgcc-4.4.7/usr/share/doc/libgcc-4.4.7/COPYING.LIBrpm -ql libgomp-4.4.7-11.el6.x86_64 | grep lib/usr/lib64/libgomp.so.1/usr/lib64/libgomp.so.1.0.0/usr/share/doc/libgomp-4.4.7/usr/share/doc/libgomp-4.4.7/ChangeLog.bz2/usr/share/info/libgomp.info.gz查看上面筛选出的文件,确认是否为链接文件。以及链接到哪个文件ll /usr/lib64/libstdc++.so.6lrwxrwxrwx. 1 root root 19 11月 10 22:30 /usr/lib64/libstdc++.so.6 -> libstdc++.so.6.0.13ll /usr/lib64/libstdc++.so.6.0.13-rwxr-xr-x. 1 root root 987096 10月 15 2014 /usr/lib64/libstdc++.so.6.0.13ll /lib64/libgcc_s.so.1lrwxrwxrwx. 1 root root 28 1月 28 2015 /lib64/libgcc_s.so.1 -> libgcc_s-4.4.7-20120601.so.1ll /usr/lib64/libgomp.so.1lrwxrwxrwx. 1 root root 16 1月 28 2015 /usr/lib64/libgomp.so.1 -> libgomp.so.1.0.0ll /usr/lib64/libgomp.so.1.0.0-rwxr-xr-x. 1 root root 85264 10月 15 2014 /usr/lib64/libgomp.so.1.0.0进入新版gcc文件夹查找文件find ./ -name libstdc++.so.6./lib64/libstdc++.so.6ll ./lib64/libstdc++.so.6lrwxrwxrwx. 1 root root 19 11月 7 03:29 ./lib64/libstdc++.so.6 -> libstdc++.so.6.0.21find ./ -name libgcc_s.so.1./lib64/libgcc_s.so.1ll ./lib64/libgcc_s.so.1-rw-r--r--. 1 root root 533684 11月 7 03:29 ./lib64/libgcc_s.so.1find ./ -name libgomp.so.1./lib64/libgomp.so.1ll ./lib64/libgomp.so.1lrwxrwxrwx. 1 root root 16 11月 7 03:30 ./lib64/libgomp.so.1 -> libgomp.so.1.0.0结论:经比較发现仅仅有 libstdc++.so.6.0.21版本较高,且libgcc_s.so.1为不同文件【libgomp.so.1.0.0版本一致,不作处理】操作:cp /usr/local/gcc-5.2.0/lib64/libstdc++.so.6.0.21 /usr/lib64/ldconfigll /usr/lib64/libstdc++.so.6lrwxrwxrwx. 1 root root 19 11月 11 01:51 /usr/lib64/libstdc++.so.6 -> libstdc++.so.6.0.21能够看到libstdc++.so.6已经更新重新启动系统验证系统兼容度【^_^reboot成功】作死更新libgcc_s.so.1[谨慎操作](事实上按实际情况c库的ABI兼容度更高)cp /usr/local/gcc-5.2.0/lib64/libgcc_s.so.1 /lib64/libgcc_s-5.2.0-20151110.so.1ldconfigll /lib64/libgcc_s.so.1lrwxrwxrwx. 1 root root 28 11月 11 02:00 /lib64/libgcc_s.so.1 -> libgcc_s-5.2.0-20151110.so.1重新启动系统验证系统兼容度【^_^reboot成功】
库文件兼容性问题【文档+理论——具体验证】
最后:非常感谢广大网友,你们的博客给了我非常多帮助,对应链接在此不一一列举
gcc 5.2.0 编译安装笔记-20151110的更多相关文章
- CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14
准备篇: CentOS 7.0系统安装配置图解教程 http://www.osyunwei.com/archives/7829.html 一.配置防火墙,开启80端口.3306端口 CentOS 7. ...
- centos 7.0 编译安装php 7.0.3
php下载页面 http://cn2.php.net/downloads.php 7.0.3多地区下载页面 http://cn2.php.net/get/php-7.0.3.tar.gz/from/a ...
- CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14方法分享
一.配置防火墙,开启80端口.3306端口 CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop fi ...
- Ubuntu 11.10下GRUB 2 1.99版编译安装笔记
Ubuntu 11.10下GRUB 2 1.99版编译安装笔记 以下的安装笔记,都是QLi自己学习grub2 时,所整理的,还是新手,有错误的话,请大家帮忙就别提出来了. 最新版grub V1.99官 ...
- Valgrind 3.11.0编译安装
Valgrind 3.11.0编译安装 Valgrind是一款用于内存调试.内存泄漏检测以及性能分析的软件开发工具. Valgrind遵守GNU通用公共许可证条款,是一款自由软件. 到3.3.0版本为 ...
- Redis 3.0 编译安装
Redis 3.0 编译安装 http://www.xuchanggang.cn/archives/991.html
- gcc 6.2.0/6.3.0/8.2.0 编译安装
参考:http://www.linuxfromscratch.org/blfs/view/stable/general/gcc.html 下载地址在这里:https://ftp.gnu.org/gnu ...
- centos 7.0 编译安装php 5.6.7
编译安装php参考资料 MySQL PHP API http://dev.mysql.com/doc/apis-php/en/index.html nginx + php +mysql 最简单安装 官 ...
- centos 7.0 编译安装mysql 5.6.22 再次总结 成功编译安装~ 越来越熟练了~
查找php.ini文件所在位置 [root@localhost /]# find -name php.ini ./usr/etc/php/etc/php.ini mysql官网的安装说明http:// ...
随机推荐
- LOL喷子专用自动骂人工具,2018更新完整版!
软件截图 软件说明: 先进入游戏 打开程序 Z开启/C关闭 下载地址:密码 yjnm
- 【转】Nutz | Nutz项目整合Spring实战
http://blog.csdn.net/evan_leung/article/details/54767143 Nutz项目整合Spring实战 前言 Github地址 背景 实现步骤 加入spri ...
- Maven error in eclipse (pom.xml) : Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4
i wanna make web project using the Maven to import automatically all libraries that i need, so i cho ...
- mathAge.call(btn) 函数call 改变函数内 this #js
mathAge.call(btn) 函数call 改变函数内 this
- 小b和矩阵
2486 小b和矩阵 2 秒 262,144 KB 5 分 1 级题 小b有一个m行n列的矩阵. 她会从(1,1)开始,顺时针螺旋访问该矩阵,每个元素恰好被访问一次. 请你按小b的访问顺序输出每个 ...
- 2.10.2 section元素
section元素 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> & ...
- 阿里云 Django部署参考
Linux下安装Python3和django并配置mysql作为django默认服务器 CentOS7.3安装Python3.6 yum except KeyboardInterrupt, e: 错误 ...
- [JOYOI] 1055 沙子合并
题目限制 时间限制 内存限制 评测方式 题目来源 1000ms 131072KiB 标准比较器 Local 题目描述 设有N堆沙子排成一排,其编号为1,2,3,-,N(N<=300).每堆沙子有 ...
- [JOYOI] 自然数拆分Lunatic版
题目背景 话说小小鱼看了P1171(自然数拆分)之后感觉异常不爽,于是异常邪恶地将题目加强. 题目描述 输入自然数n,然后将其拆分成由若干数相加的形式,参与加法运算的数可以重复. 输入格式 输入只有一 ...
- ibdata过大删除的方法
1.做数据库的逻辑备份 mysqldump -uroot -p123456 -B xx xx xx xx > /backup/all.sql 2.停止mysql进程 service mysqld ...