在Fedora24/25中轻松安装gcc 4.9
在Fedora24/25中轻松安装gcc 4.9
http://blog.csdn.net/u010158659/article/details/53608285
分类:
版权声明:本文为博主原创文章,未经博主允许不得转载。
新版的Fedora(24/25)中预装了gcc-6.1 。在开发实践中,该版本的gcc与很多其它软件,如Cuda和Matlab等并不适配。通常需要将gcc版本转换至4.9. 在Fedora dnf源中并没有4.9版本的gcc,只有3.4版本的compat-gcc-34。但从源码安装又费时费力。本文介绍一种快速安装gcc 4.9的方案,同时还可以保留系统自带的gcc 6.1 。
在这里我们使用CentOS 7 SCL源。CentOS SCL中提供了devtoolset-3-gcc-c++,版本正好为4.9.2 。
首先需要下载CentOS 7 SCL源CentOS-SCL-el7.tar.gz,这里提供百度云和Google Drive的地址。
下载后解压,将其中的repo文件和key文件复制到/etc/目录下:
- sudo cp ./etc/* /etc -rf
安装devtoolset-3-gcc-c++
- sudo dnf install devtoolset-3-gcc-c++
安装完毕后,若要在当前控制台使用gcc 4.9,使用命令
- scl enable devtoolset-3 bash
在新的控制台下,gcc版本仍然为6.1 。更多关于scl的用法,可以参考 scl -help。若系统没有安装scl,使用 sudo dnf install scl即可。
_________________________________________________________________________________________________________________________________________________
每一个不曾起舞的日子,都是对生命的辜负。
But it is the same with man as with the tree. The more he seeks to rise into the height and light, the more vigorously do his roots struggle earthward, downward, into the dark, the deep - into evil.
其实人跟树是一样的,越是向往高处的阳光,它的根就越要伸向黑暗的地底。----尼采
每一个不曾起舞的日子,都是对生命的辜负。
But it is the same with man as with the tree. The more he seeks to rise into the height and light, the more vigorously do his roots struggle earthward, downward, into the dark, the deep - into evil.
其实人跟树是一样的,越是向往高处的阳光,它的根就越要伸向黑暗的地底。----尼采