[CentOS] SCL devtoolset-3 or 4 without eclipse?

Walter Dnes waltdnes at waltdnes.org
Fri Nov 18 19:32:00 UTC 2016


On Fri, Nov 18, 2016 at 09:47:29AM -0800, Robert Arkiletian wrote
> Is there a way to install devtoolset packages without the bloat of eclipse?
> 
> I just want the new compiler and toolchain, not a big IDE.
> 
> BTW devtoolset-3 dependencies are broken in yum with C6

  You can do it manually as per the instructions at
https://gcc.gnu.org/wiki/InstallingGCC

Step 1) Download and extract the tarball for the gcc version you need.
I'll use gcc-5.4.0 in this example.  Substitute whichever version you
actually need.

#############################################################
wget http://ftpmirror.gnu.org/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2
tar xjf gcc-5.4.0.tar.bz2
#############################################################

Step 2) The tarball does not contain gmp, mpc, mpfr, and isl libs.  To
get them, and have them compiled in when you build gcc, you *MUST* run
the "download_prerequisites" script from the top-level GCC source dir.
It downloads and extracts the appropriate versions corresponding to the
version of gcc that you've downloaded.

#############################################################
cd gcc-5.4.0
contrib/download_prerequisites
#############################################################

Step 3) Build and install gcc.  The flags and enabled languages you need
may differ from mine, so check the "configure" parameters for your use
case.  I've enabled backwards compatability, and set it to install in
$HOME/gcc540 so that the entire build+install process can be done as a
regular user.  Note that you *MUST NOT* run ./configure from the GCC
source dir.

#############################################################
mkdir gcc-5.4.0/gcc-build && cd gcc-5.4.0/gcc-build

../configure --prefix=$HOME/gcc540 \
             --disable-multilib \
             --enable-libstdcxx-threads \
             --enable-libstdcxx-time \
             --enable-shared \
             --enable-__cxa_atexit \
             --disable-libunwind-exceptions \
             --disable-libada \
             --with-default-libstdcxx-abi=gcc4-compatible
#
# Depends on how many cores your cpu has.
make -j4

make install
#############################################################

Step 4) Your /usr/bin/gcc remains the default gcc compiler.  When you
want to use the gcc from $HOME/gcc540 you must *SOURCE* the following
commands.  Put them in a *PLAIN TEXT* file.  Do *NOT* set it executable
or begin it with "#!/bin/bash".  Think of it as an "include file for
bash".  If the file is named "setgcc", then execute it like so at the
start of your build script...

#############################################################
. setgcc
#############################################################

  The commands in the file, to run gcc from $HOME/gcc540 would be

#############################################################
export GCCX_ROOT=$HOME/gcc540
export PATH=$GCCX_ROOT/bin:$PATH
export MANPATH=$GCCX_ROOT/share/man:MANPATH
export INFOPATH=$GCCX_ROOT/share/info:$INFOPATH
export LD_LIBRARY_PATH=$GCCX_ROOT/lib64:$GCCX_ROOT/lib:$LD_LIBRARY_PATH
export LD_RUN_PATH=$GCCX_ROOT/lib64:$GCCX_ROOT/lib:$LD_RUN_PATH
export LIBRARY_PATH=$GCCX_ROOT/lib64:$GCCX_ROOT/lib:$LIBRARY_PATH
export INCLUDE_PATH=$GCCX_ROOT/include:$INCLUDE_PATH
export CPLUS_INCLUDE_PATH=$GCCX_ROOT/include:$CPLUS_INCLUDE_PATH
export C_INCLUDE_PATH=$GCCX_ROOT/include:$C_INCLUDE_PATH
#############################################################

  The above assumes a 64-bit install.  If you're running a 32-bit
install, change all occurences of "lib64" to "lib".

-- 
Walter Dnes <waltdnes at waltdnes.org>



More information about the CentOS mailing list