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:// ...
随机推荐
- [Windows Server 2012] 阿里云镜像购买和使用方法
★ 欢迎来到[护卫神·V课堂],网站地址:http://v.huweishen.com ★ 护卫神·V课堂 是护卫神旗下专业提供服务器教学视频的网站,每周更新视频. ★ 本节我们将演示:阿里云镜像购买 ...
- QQ感叹号是什么鬼?原来是服务器波动,腾讯官方来辟谣了
今天晚上很多网友在用QQ发送消息的时候发现,自己发送的消息一直是感叹号❗到底是怎么回事呢?是消息都发不出去了吗?马浩周通过手机测试后发现,其实消息是可以发出去的,而官方手机QQ出来已经通知了,是服务器 ...
- MySQL_将ubuntu18.04上的数据库导出并导入windows10下
1.使用:mysqldump -uroot -p databasename>filename.sql databasename:要导出的数据库名. filename:指定导出sql文件的文件名. ...
- leetcode_654. Maximum Binary Tree
https://leetcode.com/problems/maximum-binary-tree/ 给定数组A,假设A[i]为数组最大值,创建根节点将其值赋为A[i],然后递归地用A[0,i-1]创 ...
- 了解Java密码扩展的基础
了解Java密码扩展的基础 Java密码扩展(The Java Cryptography Extension),是JDK1.4的一个重要部分,基本上,他是由一些包构成的,这些包形成了一个框 ...
- ios远程推送和python版push server相关笔记
今天研究了下ios的远程推送,网上的相关教程很多,做了一遍下来记录一下遇到的问题和注意事项(转载请注明) 1.证书及乱七八糟的配置 公钥:app id管理那儿的“Development Push SS ...
- Myeclipse中dubug调试出现参数显示的框
1.步骤: window>show view>variables 结果:
- 对拍 bat命令快速模板
对拍.bat @echo off :loop maker.exe > in.in wq.exe < in.in > out.out std.exe < in.in >st ...
- 安装配置Keepalived
一.在haproxy容器安装Keepalived 1.进入haproxy容器: docker exec -it h1 bash 2.apt-get update(因为haproxy容器为Ubuntu) ...
- python3 监控代码变化 自动重启 提高开发效率
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'Michael Liao' import os, sys, time, sub ...