如何在centos 7.1上安装gcc 5.2?

如何在centos 7.1上安装gcc 5.2? 用g ++,cpp?

我编译了一次,但它需要更新的glibc,不能在系统中切换

你可以从fedora创build仓库并安装gcc 5.1.1,这比编译它要好。

cat << EOF > /etc/yum.repos.d/Fedora-Core23.repo [warning:fedora] name=fedora mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-23&arch=$basearch enabled=1 gpgcheck=0 EOF 

然后安装gcc

 yum install gcc --enablerepo=warning:fedora 

输出:

 ======================================================================================================================================================================================================== Package Arch Version Repository Size ======================================================================================================================================================================================================== Installing: gcc x86_64 5.1.1-4.fc23 warning:fedora 19 M Installing for dependencies: cpp x86_64 5.1.1-4.fc23 warning:fedora 8.5 M glibc-devel x86_64 2.22-2.fc23 warning:fedora 909 k glibc-headers x86_64 2.22-2.fc23 warning:fedora 497 k isl x86_64 0.14-4.fc23 warning:fedora 490 k kernel-headers x86_64 4.2.0-1.fc23 warning:fedora 992 k libmpc x86_64 1.0.2-4.fc23 warning:fedora 55 k mpfr x86_64 3.1.3-1.fc23 warning:fedora 213 k Updating for dependencies: binutils x86_64 2.25-13.fc23 warning:fedora 5.6 M glibc x86_64 2.22-2.fc23 warning:fedora 3.6 M glibc-common x86_64 2.22-2.fc23 warning:fedora 11 M libgcc x86_64 5.1.1-4.fc23 warning:fedora 82 k libgomp x86_64 5.1.1-4.fc23 warning:fedora 146 k Transaction Summary ======================================================================================================================================================================================================== Install 1 Package (+7 Dependent packages) Upgrade ( 5 Dependent packages) Total download size: 52 M Is this ok [y/d/N]: y 

为什么你喜欢gcc 5.2?

 # gcc --version gcc (GCC) 5.1.1 20150618 (Red Hat 5.1.1-4) Copyright (C) 2015 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. 

nano /etc/yum.repos.d/FedoraRepo.repo

 [warning:fedora] name=fedora mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-23&arch=$basearch enabled=1 gpgcheck=1 gpgkey=https://getfedora.org/static/34EC9CBA.txt 

yum update gcc g ++