On Wed, Apr 26, 2017 at 11:32:21AM +0200, Andreas K. Huettel wrote

> Except that "switching back" from gcc-5 to gcc-4 doesn't really work,
> and that gcc-4 will happily use gcc-5 libraries, with unintended
> consequences.

  It can be done, but it takes a little work.  I do a contributed build
for Pale Moon using gcc 4.9.4 as per the developers' specs, and I use
5.4.0 for personal builds at home.  This is done on a 32-bit CoentOS 6.5
chroot, in order to use an older gtk2 (long story).  The native compiler
is gcc 4.7.4.  I build self-contained gcc 4.9.4 and 5.4.0 environments.
Example follows, with gcc-4.9.4 going into $HOME/gcc494/

#######################################################################
#
# Instructions adapted from https://gcc.gnu.org/wiki/InstallingGCC

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

#
# To get gmp, mpc, mpfr, and isl libs
# You *MUST* run this script from the top-level GCC source dir

cd gcc-4.9.4
contrib/download_prerequisites

export CFLAGS="-O2 -march=native -mfpmath=sse -fomit-frame-pointer -pipe 
-fno-unwind-tables -fno-asynchronous-unwind-tables"
export CXXFLAGS="${CFLAGS}"
export MAKEOPTS="-j4"

#
# You *MUST NOT* run ./configure from the toplevel GCC source dir

mkdir gcc-build && cd gcc-build

../configure --prefix=$HOME/gcc494 \
             --disable-multilib \
             --enable-libstdcxx-threads \
             --enable-libstdcxx-time \
             --enable-shared \
             --enable-__cxa_atexit \
             --disable-libunwind-exceptions \
             --disable-libada

make -j4

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

  So far, so good, but we also need to force invocations of "gcc" to use
this version.  The build script sources the following commands (and
other build-specific stuff) before starting the compile...

#######################################################################
export GCCX_ROOT=$HOME/gcc494
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/lib:$GCCX_ROOT/lib:$LD_LIBRARY_PATH
export LD_RUN_PATH=$GCCX_ROOT/lib:$GCCX_ROOT/lib:$LD_RUN_PATH
export LIBRARY_PATH=$GCCX_ROOT/lib:$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 include script to use gcc 5.4.0 differs in only the first line...

#######################################################################
export GCCX_ROOT=$HOME/gcc540
#######################################################################

  Would the various "export" commands work if inserted into make.conf?
Actually, would they even need the "export " portion of the declaration?

-- 
Walter Dnes <waltd...@waltdnes.org>
I don't run "desktop environments"; I run useful applications

Reply via email to