You can only downgrade to the version already offered by CentOS 8 and GCC 6.3.1 doesn't fit the bill.
Unfortunately the only way to install this version of GCC without wreaking havoc to your system is to download the source, compile and install it into e.g. /opt/gcc6
As for compile flags check Fedora or CentOS src.rpms - you'll only need to add --prefix=/opt/gcc6
Update: here's how I compiled GCC 4-7:
Unpack it.
(under root/sudo) yum install gcc make glibc-devel gmp-devel mpfr-devel gmp-devel
export CFLAGS="-O2 -march=native -pipe"
export CXXFLAGS=$CFLAGS
cd gcc-6.3.1
mkdir BUILD
cd BUILD
../configure --enable-shared --enable-threads=posix --disable-stage1-checking
--with-system-zlib --enable-__cxa_atexit --enable-multilib --with-gnu-as
--with-gnu-ld --enable-languages="c,c++" --without-x --prefix=/opt/gcc
--disable-libunwind-exceptions --with-gmp=/usr
--with-mpc
,--with-mpfr
, and--with-gmp
flags as well as setting the environment variableLD_LIBRARY_PATH=/path/to/mpc/lib:/path/to/mpfr/lib:/path/to/gmp/lib
. There are also some other flags that might need to be used such as--with-gfortran
and--with-quadmath
. – Nasir Riley Aug 25 '20 at 12:55--with-mpc
and--with-mpfr
andLD_LIBRARY_PATH
. – Nasir Riley Aug 25 '20 at 15:25--with-*
are prerequisites 2) In Fedora/RHEL/CentOS they are installed in /usr thus LD_LIBRARY_PATH is redundant. Trust me - that's how I've been building GCC since RedHat 7.0 days. – Artem S. Tashkinov Aug 25 '20 at 15:47--with-gmp
? They are also installed in/usr/lib4
and not/usr
. – Nasir Riley Aug 25 '20 at 16:29