install multiple GCC on centos 8

Issues related to applications and software problems
yaodav
Posts: 20
Joined: 2019/06/30 08:47:46

install multiple GCC on centos 8

Post by yaodav » 2019/06/30 09:02:59

i have gcc 8.2.1 but i need to work with the 7.4 so im trying to install the 7.4 on my machine according to this guide :
https://bytefreaks.net/gnulinux/downgra ... sion-4-8-2
(with the name replace to 7.4.0)
but when i run the make command i det the following error:
make[3]: Entering directory '/home/yaodav/gcc-7.4.0/build-x86_64-pc-linux-gnu/libcpp'
test -f config.h || (rm -f stamp-h1 && make stamp-h1)
echo "#define LOCALEDIR \"/usr/local/gcc/7.4.0/share/locale\"" > localedir.new
../.././libcpp/../move-if-change localedir.new localedir.h
echo timestamp > localedir.hs
make[3]: Leaving directory '/home/yaodav/gcc-7.4.0/build-x86_64-pc-linux-gnu/libcpp'
make[3]: Entering directory '/home/yaodav/gcc-7.4.0/host-x86_64-pc-linux-gnu/zlib'
make "AR_FLAGS=rc" "CC_FOR_BUILD=gcc" "CFLAGS=-g" "CXXFLAGS=-g" "CFLAGS_FOR_BUILD=-g -O2" "CFLAGS_FOR_TARGET=-g -O2" "INSTALL=/usr/bin/install -c" "INSTALL_DATA=/usr/bin/install -c -m 644" "INSTALL_PROGRAM=/usr/bin/install -c" "INSTALL_SCRIPT=/usr/bin/install -c" "LDFLAGS=" "LIBCFLAGS=-g -O2" "LIBCFLAGS_FOR_TARGET=-g -O2" "MAKE=make" "MAKEINFO=/home/yaodav/gcc-7.4.0/missing makeinfo --split-size=5000000 --split-size=5000000 --split-size=5000000 " "PICFLAG=" "PICFLAG_FOR_TARGET=" "SHELL=/bin/sh" "EXPECT=expect" "RUNTEST=runtest" "RUNTESTFLAGS=" "exec_prefix=/usr/local/gcc/7.4.0" "infodir=/usr/local/gcc/7.4.0/share/info" "libdir=/usr/local/gcc/7.4.0/lib" "prefix=/usr/local/gcc/7.4.0" "tooldir=/usr/local/gcc/7.4.0/x86_64-pc-linux-gnu" "AR=ar" "AS=as" "CC=gcc" "CXX=g++ -std=gnu++98" "LD=ld" "LIBCFLAGS=-g -O2" "NM=nm" "PICFLAG=" "RANLIB=ranlib" "DESTDIR=" DO=all multi-do # make
make[4]: Entering directory '/home/yaodav/gcc-7.4.0/host-x86_64-pc-linux-gnu/zlib'
if [ -z "32" ]; then \
true; \
else \
rootpre=`${PWDCMD-pwd}`/; export rootpre; \
srcrootpre=`cd ../.././zlib; ${PWDCMD-pwd}`/; export srcrootpre; \
lib=`echo "${rootpre}" | sed -e 's,^.*/\([^/][^/]*\)/$,\1,'`; \
compiler="gcc"; \
for i in `${compiler} --print-multi-lib 2>/dev/null`; do \
dir=`echo $i | sed -e 's/;.*$//'`; \
if [ "${dir}" = "." ]; then \
true; \
else \
if [ -d ../${dir}/${lib} ]; then \
flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
if (cd ../${dir}/${lib}; make \
CFLAGS="-g ${flags}" \
CCASFLAGS=" ${flags}" \
FCFLAGS=" ${flags}" \
FFLAGS=" ${flags}" \
ADAFLAGS=" ${flags}" \
prefix="/usr/local/gcc/7.4.0" \
exec_prefix="/usr/local/gcc/7.4.0" \
GOCFLAGS=" ${flags}" \
CXXFLAGS="-g ${flags}" \
LIBCFLAGS="-g -O2 ${flags}" \
LIBCXXFLAGS="-g -O2 -fno-implicit-templates ${flags}" \
LDFLAGS=" ${flags}" \
MULTIFLAGS="${flags}" \
DESTDIR="" \
INSTALL="/usr/bin/install -c" \
INSTALL_DATA="/usr/bin/install -c -m 644" \
INSTALL_PROGRAM="/usr/bin/install -c" \
INSTALL_SCRIPT="/usr/bin/install -c" \
all); then \
true; \
else \
exit 1; \
fi; \
else true; \
fi; \
fi; \
done; \
fi
make[5]: Entering directory '/home/yaodav/gcc-7.4.0/host-x86_64-pc-linux-gnu/32/zlib'
make[5]: *** No rule to make target 'all'. Stop.
make[5]: Leaving directory '/home/yaodav/gcc-7.4.0/host-x86_64-pc-linux-gnu/32/zlib'
make[4]: *** [Makefile:736: multi-do] Error 1
make[4]: Leaving directory '/home/yaodav/gcc-7.4.0/host-x86_64-pc-linux-gnu/zlib'
make[3]: *** [Makefile:533: all-multi] Error 2
make[3]: Leaving directory '/home/yaodav/gcc-7.4.0/host-x86_64-pc-linux-gnu/zlib'
make[2]: *** [Makefile:15454: all-stage1-zlib] Error 2
make[2]: Leaving directory '/home/yaodav/gcc-7.4.0'
make[1]: *** [Makefile:27079: stage1-bubble] Error 2
make[1]: Leaving directory '/home/yaodav/gcc-7.4.0'
make: *** [Makefile:942: all] Error 2

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: install multiple GCC on centos 8

Post by TrevorH » 2019/06/30 11:42:26

We ship numerous gcc versions as part of th e devtoolset packages. Does it need to be exactly 7.4.0? What we ship are the following:

Code: Select all

[root@centos7 ~]# yum list dev\*gcc
Loaded plugins: priorities
Available Packages
devtoolset-3-gcc.x86_64                                    4.9.2-6.el7                                      centos-sclo-rh
devtoolset-4-gcc.x86_64                                    5.3.1-6.1.el7                                    centos-sclo-rh
devtoolset-6-gcc.x86_64                                    6.3.1-3.1.el7                                    centos-sclo-rh
devtoolset-7-gcc.x86_64                                    7.3.1-5.15.el7                                   centos-sclo-rh
devtoolset-8-gcc.x86_64                                    8.2.1-3.el7                                      centos-sclo-rh
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

yaodav
Posts: 20
Joined: 2019/06/30 08:47:46

Re: install multiple GCC on centos 8

Post by yaodav » 2019/06/30 12:47:57

not necessary 7.4 but need to be 7

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: install multiple GCC on centos 8

Post by TrevorH » 2019/06/30 14:42:48

So yum install centos-release-scl then yum install devtoolset-7-gcc.x86_64 and use `scl enable devtoolset-7 bash` to get a command prompt set up o run it.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: install multiple GCC on centos 8

Post by jlehtone » 2019/06/30 15:00:19

I would say:

Code: Select all

yum install centos-release-scl-rh
yum install devtoolset-7-toolchain
scl enable devtoolset-7 bash
* The centos-release-scl and centos-release-scl-rh have different subsets of SCL packages
* The *-toolchain pulls in all devtoolset packages that one needs for compiling from commandline. Not sure whether the *-gcc does.
* The scl environment is for whole devtoolset-7; the devtoolset-7-gcc does not have separate config.

yaodav
Posts: 20
Joined: 2019/06/30 08:47:46

Re: install multiple GCC on centos 8

Post by yaodav » 2019/07/10 07:00:47

Thank you very much jlehtone that solved the the problem

yaodav
Posts: 20
Joined: 2019/06/30 08:47:46

Re: install multiple GCC on centos 8

Post by yaodav » 2019/08/29 08:31:38

and how to i enable the g++ 7.3?

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: install multiple GCC on centos 8

Post by jlehtone » 2019/08/29 09:24:20

I thought you did know already:

Code: Select all

$ which g++
/usr/bin/g++  # By default we see system's g++ 4.8.5

# When we start a separate bash session with different environment:
$ scl enable devtoolset-7 bash
$ which g++
/opt/rh/devtoolset-7/root/usr/bin/g++  # a different g++ is visible
# we can compile in this shell
#
$ exit
exit
# After that bash session ends we are back in bash that sees the 4.8.5
$ which g++
/usr/bin/g++

yaodav
Posts: 20
Joined: 2019/06/30 08:47:46

Re: install multiple GCC on centos 8

Post by yaodav » 2019/08/29 14:49:28

@jlehtone
that i know but when i did that the gcc was 7.4 but g++ 4.8.5
but i fix that

filmtools
Posts: 18
Joined: 2020/06/09 20:06:22

Re: install multiple GCC on centos 8

Post by filmtools » 2020/06/12 11:10:41

TrevorH wrote:
2019/06/30 11:42:26
We ship numerous gcc versions as part of th e devtoolset packages. Does it need to be exactly 7.4.0? What we ship are the following:

Code: Select all

[root@centos7 ~]# yum list dev\*gcc
Loaded plugins: priorities
Available Packages
devtoolset-3-gcc.x86_64                                    4.9.2-6.el7                                      centos-sclo-rh
devtoolset-4-gcc.x86_64                                    5.3.1-6.1.el7                                    centos-sclo-rh
devtoolset-6-gcc.x86_64                                    6.3.1-3.1.el7                                    centos-sclo-rh
devtoolset-7-gcc.x86_64                                    7.3.1-5.15.el7                                   centos-sclo-rh
devtoolset-8-gcc.x86_64                                    8.2.1-3.el7                                      centos-sclo-rh
when I run yum list dev\*gcc from root I get no matching packages to list

Post Reply