1

How To install gcc 5.2 on centos 7.1 ? with g++,cpp ?

I compiled it once, but it need newer glibc which cannot be switched in system

1

2 Answers 2

11

you can create repo from fedora and install gcc 5.1.1, it will be better than compile it.

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

then install gcc

yum install gcc --enablerepo=warning:fedora

output:

========================================================================================================================================================================================================
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

Why do you preferred on 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.
5
  • yeah, thx a lot. got this answer by myself too
    –  sm1Ly
    Sep 7, 2015 at 10:58
  • I'm glad I could help you too
    – xakru
    Sep 7, 2015 at 11:01
  • and why gcc 5.2 cause from 4.9 to 5.2 got about 30-40% optimisation
    –  sm1Ly
    Sep 7, 2015 at 11:06
  • gcc.gnu.org/gcc-5/changes.html
    – xakru
    Sep 7, 2015 at 11:14
  • adding Fedora repo to Centos7 (server with gui) horribly broke my installation. Jul 2, 2016 at 8:23
6

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++

Not the answer you're looking for? Browse other questions tagged .