Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

How To Install GCC on CentOS 7


 March 28, 2018  Tutorials

Spread the love

In this tutorial, we will take a look at how to install GCC on CentOS 7.


GCC or GNU Compiler Collection is released by the Free Software
Foundation and as the name suggests, it is a very useful collection of
programming compilers such as C, C++, Objective-C, Objective-C++,
Fortran, Java, Go and Ada. GCC is an official compiler of the GNU

https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 1/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

operating system but also it is a standard compiler on many Unix operating systems
such as Linux. Installing GCC on CentOS 7, is really an easy task and it shouldn’t take
more than 10 minutes.

1. Update the server


First of all log in to your CentOS 7 VPS via SSH as user root
ssh root@IP_Address -p Port_number

and make sure that all installed packages on the server are up to date

yum -y update

2. Install GCC from repository


GCC can be easily installed from the official CentOS repositories. Run the following
command to install GCC on your server

yum -y install gcc

Once the installation is completed, you can the version of GCC installed on your server
gcc --version

gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)


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.

As might be seen from the output, the GCC version distributed by CentOS 7 is 4.8.5
which is not the latest version of GCC.
You may also want to install gcc-c++. It will automatically include the C++ library and
compile files with extensions that indicate they are C source as C++, instead of as C.

yum -y install gcc-c++

3. Install GCC from source


If you need a newer version of GCC than the one distributed by the official CentOS 7
repositories you can install it from source.

https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 2/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

It is highly recommended to start a screen session before starting the installation. Run
the following command

screen -U -S gcc

Download the tarball of the GCC version you want to install. In our example we will use
GCC version 7.3.0

wget http://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-7.3.0/gcc-7.3.0

Unpack the tar archive and change the current working directory
tar zxf gcc-7.3.0.tar.gz
cd gcc-7.3.0

Install bzip2 and run the ‘download_prerequisites’ script to download some


prerequisites needed by GCC. You have to run this from the top level of the GCC source
tree.

yum -y install bzip2


./contrib/download_prerequisites

Once the prerequisites are downloaded execute the following command to start
configuring the GCC build environment

./configure --disable-multilib --enable-languages=c,c++

Once it is completed, run the following command to compile the source code. It may
take a few hours for the compilation to complete, so sit back and relax.

make -j 4
make install

4. Verify GCC installation on CentOS 7


After the compilation process is completed. You can check if GCC is properly installed.

gcc --version

gcc (GCC) 7.3.0


Copyright (C) 2017 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.

https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 3/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

Of course, you don’t have to install GCC on CentOS 7,  if you use one
of our outsourced server support services, in which case you can
simply ask our expert Linux admins to install GCC on your CentOS 7
server for you. They are available 24×7 and will take care of your
request immediately.
PS. If you liked this post, on how to install GCC on CentOS 7,  please
share it with your friends on the social networks using the buttons on the left or simply
leave a reply below. Thanks.

centos GCC

59 THOUGHTS ON “HOW TO INSTALL GCC ON CENTOS 7”

ANDREI
July 11, 2018 at 4:18 pm

Hi,
I’m new to linux and i’m trying to understand it better, can you please detail
this line: “ssh root@IP_Address -p Port_number

What is IP_address, where do i find it, and what is Port_number and where do
i find it, if you could provide an answer it would be awesome.
Thanks in advance!
REPLY

ADMIN
July 13, 2018 at 4:36 am

This command is used to establish an SSH connection to a remote server. If


you are doing this installation on your local computer, you can skip this part.
The IP address is a unique numerical number assigned to every device
connected to the Internet. The Port_number in this command refers to the
port number of the SSH service which is running on your server. Usually, the
default SSH port is set to 22.
https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 4/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

If you are not sure about the IP address and the SSH port number of your
server you should contact your hosting provider and ask them for this
information.
REPLY

UANELA PEDRO LUIS BEDE COMO


January 2, 2023 at 9:37 am

you can find the ip address on your vps, dedicated server, cpanel or other
server control panel. and port usually is 22
REPLY

IGNACIO
July 20, 2018 at 8:12 pm

On centos 7 I have installed ccg 7.3.0:


#gcc –version
gcc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
however, gfortran version is 4
# gfortran –version
GNU Fortran (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)
I really need gfortran 6 o newer for some application
please help me, I had tried many things and they didn’t work.
REPLY

ADMIN
July 21, 2018 at 9:49 am

You can install GNU Fortran using yum, RPM package or build it from source.
Please check the official documentation for installation instructions.
REPLY

NILANG
December 9, 2020 at 12:59 pm
https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 5/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

Yes I did the same but same error


REPLY

SUSHI
October 30, 2018 at 11:52 pm

Hi, I’m not used to Linux much, but can you tell me why “It is highly
recommended to start a screen session before starting the installation.” on
Section 3? Thank you.
REPLY

ADMIN
October 31, 2018 at 5:21 am

This is because processes running in a screen session will continue to run


even if the window is closed or you get disconnected.
REPLY

NATHAN
December 4, 2018 at 9:48 am

I followed your steps step by step but at the end there was an error.
make install
make[1]: Entering directory `/root/gcc-7.3.0′
/bin/sh ./mkinstalldirs /usr/local /usr/local
make[2]: Entering directory `/root/gcc-7.3.0/host-x86_64-pc-linux-
gnu/fixincludes’
make[2]: *** No rule to make target `install’. Stop.
make[2]: Leaving directory `/root/gcc-7.3.0/host-x86_64-pc-linux-
gnu/fixincludes’
make[1]: *** [install-fixincludes] Error 2
make[1]: Leaving directory `/root/gcc-7.3.0′
make: *** [install] Error 2
REPLY

ADMIN
https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 6/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport
December 4, 2018 at 10:14 am
Did you run the ‘download_prerequisites’ script as described in the tutorial?
REPLY

SHAN
December 10, 2018 at 11:55 am

Hi, I am wondering if the Gcc version needs to match with some specific
kernel version? Or those two are independent? Thanks.
REPLY

ADMIN
December 11, 2018 at 1:53 am

There is a gcc minimum version required to build a specific kernel version.


REPLY

MIKET
December 22, 2018 at 12:20 pm

I followed your steps, and things seemed to go as expected, except there is a


discrepancy between the version reported by gcc –version, which is 5.5.0 (the
release I need for my client) and g++ -v, which reports 4.8.5. How do I make it
so g++ links to the same compiler installation?
REPLY

ADMIN
December 24, 2018 at 5:54 am

The latest gcc and g++ version distributed by CentOS 7 is 4.8.5. If you would
like to install a different version you would have to install it from source.
REPLY

DIMARCO
January 21, 2019 at 2:29 pm
https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 7/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

I need a newer libm.so.6 … but after compilation those are not created …. do I
have to use another make command to do that?
REPLY

ANASTASIIA
May 8, 2019 at 3:15 am

Hello! Is it possible to somehow install the version above 4.8.5 without being a
superuser?
REPLY

ADMIN
May 9, 2019 at 1:42 am

You can install any version. However, you need to have root or sudo access
to your server.
REPLY

BERG
May 23, 2019 at 10:04 am

Not true, you can build it locally without having root or sudo access just
fine.
You can use:
./configure –prefix=/home/user/your/repo
make PREFIX=/home/user/your/repo install
REPLY

RAHUL
May 13, 2019 at 8:51 am

Just an extremely minor thing. Before point 4, you might consider advising the
user to reload files from the path again. Otherwise older version of gcc
appears on invocation at that step.

https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 8/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

REPLY

JAMESS
May 17, 2019 at 11:13 am

This got me. Thanks for comment


REPLY

AKASH
August 12, 2019 at 1:25 am

What do you mean by reload files from path again? I followed the steps but I
still see the old version on using the gcc –version command. Maybe this is
the step that I am required to do.
REPLY

KARTHIKEYAN
May 28, 2019 at 6:38 am

I followed your steps step by step but on the step


make install

echo GTFILES_LANG_H=gtype-ada.h gtype-c.h gtype-cp.h gtype-fortran.h
gtype-go.h gtype-java.h gtype-jit.h gtype-lto.h gtype-objc.h gtype-objcp.h >>
tmp-header-vars; \
/bin/sh ../.././gcc/../move-if-change tmp-header-vars b-header-vars
/bin/sh: tmp-header-vars: Permission denied

/bin/sh: tmp-header-vars: Permission denied
mv: cannot stat ‘tmp-header-vars’: No such file or directory
make[2]: *** [s-header-vars] Error 1
not sure how to proceed
REPLY

ADMIN

https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 9/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

May 29, 2019 at 1:20 am


Please try to run the commands as user root.
REPLY

YAODAV
July 8, 2019 at 1:20 am

i installed the gcc and g++ according to the guide but when i do g++ –version it
give me :
yaodav@localhost ~]$ g++ –version
g++ (GCC) 7.4.0
but when i give the command as sudo i get :
yaodavdav@localhost ~]$ sudo g++ –version
g++ (GCC) 4.8.5 20150625 (Red Hat 4.8.5-36)
how to enable the new gcc also to the sudo?
the right version but when i give the command with sudo i get the old version
REPLY

NILANG
December 9, 2020 at 1:28 pm

/root/gcc-7.3.0/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/utility:106:1: fatal
error: can’t write PCH file: No space left on device
}
^
compilation terminated.
make[5]: *** [x86_64-pc-linux-gnu/bits/stdtr1c++.h.gch/O2g.gch] Error 1
make[5]: Leaving directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libstdc++-
v3/include’
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libstdc++-v3′
make[3]: *** [all] Error 2
make[3]: Leaving directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libstdc++-v3′
make[2]: *** [all-stage2-target-libstdc++-v3] Error 2
make[2]: Leaving directory `/root/gcc-7.3.0′
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/root/gcc-7.3.0′
make: *** [all] Error 2

https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 10/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

REPLY

ADMIN
December 10, 2020 at 1:42 am

The error is being thrown because your server lacks disk space. Please check
your server disk space.
REPLY

CHAO-TSUNG HSIAO
January 6, 2021 at 10:01 am

I followed the instruction to install gcc-8.2.0 on CentOS 7, but it cannot


complete for
make -j 4
It ended up with error messages after
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating src/Makefile
config.status: creating tests/Makefile
config.status: creating tune/Makefile
config.status: creating src/mparam.h
config.status: executing depfiles commands
config.status: executing libtool commands
make[2]: Leaving directory `/aspendata/install/gcc-8.2.0′
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/aspendata/install/gcc-8.2.0′
make: *** [all] Error 2
REPLY

ADMIN
January 11, 2021 at 1:22 am

Can you please provide us with the whole error message?


REPLY

https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 11/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

TOD
January 13, 2021 at 5:49 am

I followed all the steps to install of section “3. Install GCC from source”.
I hade no error. But when I do gcc –version I stiil got the native version 4.8.5
(centos 7).
Where is installed the 7.3 version?
REPLY

ADMIN
January 14, 2021 at 2:37 am

Please check /usr/local as that is the default location of the installation.


Please make sure you have downloaded the prerequisites and configured
the GCC build environment as stated on the procedure.
REPLY

T
January 21, 2021 at 3:25 pm

Is there somewhere I can predownload the download prerequisites for offline


install?
REPLY

ADMIN
January 22, 2021 at 1:32 am

Please check GCC official website, there should be an offline install available
REPLY

SANJAY
February 22, 2021 at 4:44 am

How much time does “make -j 4” command takes usually?


REPLY

https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 12/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

ADMIN
February 23, 2021 at 1:53 am

This depends on a number of factors like you disk i/o, cpu, memory, etc.
REPLY

SANJAY
February 22, 2021 at 4:46 am

also I dont have Screen installed on my machine , doesnt it work without


screen session?
about step : screen -U -S gcc
REPLY

ADMIN
February 23, 2021 at 1:53 am

It is highly recommended to start a screen session because the installation


would take a while to accomplish and losing your connection or any
interruption might break the installation and you have to start again.
REPLY

ROBERT JR
March 5, 2021 at 2:44 am

Thanks for this valuable information,


also Please can you tell, how to uninstall gcc that is being installed by the way
you specified.
Thanks in advance
REPLY

ADMIN
March 6, 2021 at 1:16 am

You can try to delete gcc with:


yum remove –skip-broken gcc
https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 13/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

REPLY

FILIPPO PAVAN
March 12, 2021 at 7:49 am

Thanks for the detailed information. I really like the kindness you show when
answering in the “comments” section.
REPLY

MJ
March 20, 2021 at 12:39 am

Thanks so much. This was a huge help!


REPLY

MURAT
March 29, 2021 at 11:37 am

Hi, I am using gcc-8.3.1 on Centos7 cluster. I am having same kind of errors


when I am trying to install some certain R packages. Here is the process that I
am following:
module load R/4.0.3
module unload gcc
module load gcc/8.3.1
R
After launching R, trying to install packages and having same errors (see for
Rcpp package):
g++-8.3.1 -I”/share/builds/spack/opt/spack/linux-centos7-sandybridge/gcc-
8.3.0/r-4.0.3-zkmqmoo7jq7xgup5bt6azwkcph6jxqcm/rlib/R/include” -
DNDEBUG -I../inst/include/ -I/usr/local/include -std=c++11 -fpic -g -O2 -c
api.cpp -o api.o
/bin/sh: g++-8.3.1: command not found
make: *** [/share/builds/spack/opt/spack/linux-centos7-sandybridge/gcc-
8.3.0/r-4.0.3-zkmqmoo7jq7xgup5bt6azwkcph6jxqcm/rlib/R/etc/Makeconf:181:
api.o] Error 127
ERROR: compilation failed for package ‘Rcpp’
https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 14/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

* removing ‘/nethome/mxk841/R/x86_64-pc-linux-gnu-library/4.0/Rcpp’
* restoring previous ‘/nethome/mxk841/R/x86_64-pc-linux-gnu-
library/4.0/Rcpp’
Warning message:
In install.packages(“Rcpp”, type = “source”) :
installation of package ‘Rcpp’ had non-zero exit status
Any tips for this kind of errors. Thanks in advance!
REPLY

TAOFEEK
July 22, 2021 at 2:01 pm

Im new to linux. I installed the gcc compiler to compile openmpi on google


cloud and it seemed to install fine since I checked using gcc –version. But
when I tried to compile openmpi using ./configure –
prefix=”/home/bogunbayo/openmpi411/” it gave the following error messages
*** C++ compiler and preprocessor
checking for g++… no
checking for c++… no
checking for gpp… no
checking for aCC… no
checking for CC… no
checking for cxx… no
checking for cc++… no
checking for cl.exe… no
checking for FCC… no
checking for KCC… no
checking for RCC… no
checking for xlC_r… no
checking for xlC… no
checking whether we are using the GNU C++ compiler… no
checking whether g++ accepts -g… no
checking dependency style of g++… none
checking how to run the C++ preprocessor… /lib/cpp
configure: error: in `/home/bogunbayo/openmpi-4.1.1′:
configure: error: C++ preprocessor “/lib/cpp” fails sanity check
See `config.log’ for more details
What did I do wrong? What do I need to do to fix this? Thank you

https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 15/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

REPLY

ADMIN
July 23, 2021 at 1:12 am

You need to install the GNU C++ compiler. For Centos “yum install gcc-c++”.
REPLY

JEONGMIN
December 16, 2021 at 2:54 am

Thank you sir..!


I spent 3 hours trying to figure out how to install it, but thanks to you, I solved
it.
REPLY

AZBVENKAT
February 11, 2022 at 5:18 am

in the make-step getting the following error? (gcc 8.5.0)


In file included from ../../.././libstdc++-v3/libsupc++/unwind-cxx.h:41,
from ../../.././libstdc++-v3/libsupc++/eh_catch.cc:26:
../../.././libstdc++-v3/libsupc++/eh_catch.cc: In function ‘void*
__cxxabiv1::__cxa_begin_catch(void*)’:
../../.././libstdc++-v3/libsupc++/unwind-cxx.h:45:34: error: unable to find string
literal operator ‘operator””_SDT_S’ with ‘const char [37]’, ‘long unsigned int’
arguments
#define PROBE2(name, arg1, arg2) STAP_PROBE2 (libstdcxx, name, arg1, arg2)
^~~~~~~~~~~
../../.././libstdc++-v3/libsupc++/eh_catch.cc:84:3: note: in expansion of macro
‘PROBE2’
PROBE2 (catch, objectp, header->exceptionType);
^~~~~~
../../.././libstdc++-v3/libsupc++/unwind-cxx.h:45:34: error: unable to find string
literal operator ‘operator””_SDT_S’ with ‘const char [51]’, ‘long unsigned int’
arguments
#define PROBE2(name, arg1, arg2) STAP_PROBE2 (libstdcxx, name, arg1, arg2)
^~~~~~~~~~~
https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 16/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

../../.././libstdc++-v3/libsupc++/eh_catch.cc:84:3: note: in expansion of macro


‘PROBE2’
PROBE2 (catch, objectp, header->exceptionType);
^~~~~~
make[5]: *** [eh_catch.lo] Error 1
make[5]: Leaving directory `/scratch/software/gcc-8.5.0/x86_64-pc-linux-
gnu/libstdc++-v3/libsupc++’
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/scratch/software/gcc-8.5.0/x86_64-pc-linux-
gnu/libstdc++-v3′
make[3]: *** [all] Error 2
make[3]: Leaving directory `/scratch/software/gcc-8.5.0/x86_64-pc-linux-
gnu/libstdc++-v3′
make[2]: *** [all-stage1-target-libstdc++-v3] Error 2
kindly provide a possible solution to fix this issue. thank you
REPLY

ADMIN
February 12, 2022 at 1:14 am

Did you run the ‘download_prerequisites’ script as described in the tutorial?


REPLY

LINDA
April 9, 2022 at 5:58 am

I followed all the steps and get the errors at “make -j 4”:
checking whether canonicalize_file_name must be declared… (cached) no
checking for stdlib.h… (cached) yes
checking for unistd.h… (cached) yes
checking for getpagesize… (cached) yes
checking for working mmap… (cached) yes
checking for working strncmp… (cached) yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating testsuite/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing default commands
https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 17/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

make[2]: Leaving directory ‘/usr/local/gcc-7.3.0’


make[1]: *** [Makefile:26035: stage1-bubble] Error 2
make[1]: Leaving directory ‘/usr/local/gcc-7.3.0’
make: *** [Makefile:942: all] Error 2
kindly provide some help? Thanks
REPLY

AVEN
May 27, 2022 at 2:32 am

Thanks for your sharing.


However, in my case, the gcc –version remains 4.8.5 after installation while
g++ has been successfully upgraded to 11.2. Is there a way to change default
gcc version?
Thanks,
Aven
REPLY

ADMIN
May 28, 2022 at 1:23 am

Hi,
Please make sure that the desired version of gcc is downloaded from the link
in step 3.
REPLY

AARÓN LÓPEZ
June 2, 2022 at 7:27 am

Hi thanks for this information,


I have updated but when check the version with gcc –version I got 4.8.5
instead of 7.5
I know 7.5 is installed in /usr/local/lib/../lib64
But I am missing something.
Thank you.

https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 18/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

REPLY

RAM
August 22, 2022 at 9:55 pm

Hi Admin
I followed the steps but when I check the version I got 4.8.5 instead of newer
version.
One of the user mentioned that we need to reload the files before Step-4.
could you please provide the instructions on reloading the files ?
Thank you
REPLY

ADMIN
August 23, 2022 at 1:34 am

We are not sure what the user is saying but if you want to have the latest
version you can download the source manually just refer to step 3 on how to
install it manually.
REPLY

JOHN MULHERE
October 14, 2022 at 8:54 am

I followed these instructions and installed gcc 12.2.0 on CentOS 7.9. The make
and make install steps completed, but when I run gcc –version I still see 4.8.5.
The new gcc looks like it installed successfully to /usr/local/lib, but it’s doesn’t
look like it actually replaced the older version.
REPLY

ADMIN
October 15, 2022 at 10:00 am

Please make sure to remove the old version, then install it from scratch.

https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 19/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

REPLY

SPACE
December 18, 2022 at 3:42 am

Hi, I want to install ORACLE 19c on centos 7.


While going through installation stages oracle wants gcc 4.8.2 to be installed.
when I type “yum install gcc” as you know it install gcc 4.8.5.
How can i install older versions? Thanks.
REPLY

THOMAS
December 29, 2022 at 7:23 am

Hi,I have an error in configuring the downloaded package:


Once the prerequisites are downloaded execute the following command to
start configuring the GCC build environment
./configure –disable-multilib –enable-languages=c,c++
result: configure: error: cannot find install-sh, install.sh, or shtool in “.” “./..”
“./../..”
Any thoughts?
REPLY

ADMIN
December 30, 2022 at 2:35 am

You can try running the command “autoreconf -i” before running this
command.
REPLY

SUSHII
February 14, 2023 at 12:47 am

Hi,

https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 20/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

I have followed your guide and successfully installed gcc-9.1.0,


and running which gcc –version returns gcc (GCC) 9.1.0.
However, I now have 2 gcc in my machine and compiling c++ file outputs this
error:
./test_output2: /lib64/libstdc++.so.6: version `GLIBCXX_3.4..21′ not found
(required by ./test_output2)
I have checked that indeed GLIBCXX_3.4.21 is not found using:
strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX_3.4.21
However, I see that is GLIBCXX_3.4.21 is found using:
strings /usr/local/lib64/libstdc++.so.6 | grep GLIBCXX_3.4.21
Running where gcc returns:
/usr/local/bin/gcc
/usr/bin/gcc
Running which gcc returns:
/usr/local/bin/gcc
I found a solution that using LD_LIBRARY_PATH may resolve this, however Im
afraid its not the best practice so I wonder if there is another way to do this
like specifying the linker or rpath for gcc and g++
REPLY

AMITAV RAY
April 8, 2023 at 1:15 am

Thanks
REPLY

LEAVE A REPLY
Your email address will not be published. Required fields are marked *
Comment *

https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 21/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

Name *

Email *

I'm not a robot


reCAPTCHA
Privacy - Terms

POST COMMENT

 How to Speed Up Drupal Using Varnish on Debian 9 How to Install ownCloud 10 on CentOS 7 

Search… 

(https://www.rosehosting.com/dedicated-

servers/?
mtm_campaign=blogs&mtm_source=lhs&mtm_medium=blog&mtm_content=dedicated

https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 22/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

(https://www.linuxhostsupport.com)

RECENT POSTS

How To Install Apache Spark on AlmaLinux 9 (https://linuxhostsupport.com/blog/how-to-install-


apache-spark-on-almalinux-9/)

How To Install ERPNext on AlmaLinux (https://linuxhostsupport.com/blog/how-to-install-erpnext-


on-almalinux/)

How to Install Docker CE on AlmaLinux (https://linuxhostsupport.com/blog/how-to-install-docker-


ce-on-almalinux/)

How To Install Plausible Analytics on Ubuntu 22.04 (https://linuxhostsupport.com/blog/how-to-


install-plausible-analytics-on-ubuntu-22-04/)

5 most Used dig Commands in Linux With Examples  (https://linuxhostsupport.com/blog/5-most-


used-dig-commands-in-linux-with-examples/)

CATEGORIES

 Analytics (https://linuxhostsupport.com/blog/category/analytics/)

 Debian (https://linuxhostsupport.com/blog/category/debian/)

 Guides (https://linuxhostsupport.com/blog/category/guides/)

 Laravel (https://linuxhostsupport.com/blog/category/laravel/)

 Linux (https://linuxhostsupport.com/blog/category/linux/)

 Miscellaneous (https://linuxhostsupport.com/blog/category/miscellaneous/)

 Open-source (https://linuxhostsupport.com/blog/category/open-source/)
https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 23/24
19/4/23, 9:00 How To Install GCC on CentOS 7 | LinuxHostSupport

 Tutorials (https://linuxhostsupport.com/blog/category/tutorials/)

 Ubuntu (https://linuxhostsupport.com/blog/category/ubuntu/)

 Ubuntu 18.04 (https://linuxhostsupport.com/blog/category/ubuntu-18-04/)

Company
About Us
Contact Us
Blog

Services
Monthly Server Management
Per Incident Server Support
Outsourced Hosting Support
Other Management & Support Services

Support
Client Area

Follow us
Facebook (https://www.facebook.com/linuxhostsupport)
Twitter (https://twitter.com/lnxhostsupport)
LinkedIn (https://www.linkedin.com/company/linuxhostsupport.com)

Terms of Service Privacy Policy


Copyright 2023 © Rose Web Services LLC.

https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/ 24/24

You might also like