On Thu 20 Jul 2017 01:14:02 AM CDT, digbyt wrote:

Ah yes, thanks. I forgot that the kernel version string includes the
compiler used. I suppose the compiler used to build the kernel explains
why the two compilers are supplied - although not why the old one is the
default. It also makes me wonder what it is about the newer gcc which
prevents it being used for kernel build...

It sounds easy to say 'use gcc6 for my own code', but in practice it is
a bit tedious to have a special case on SUSE if you are trying to
maintain a lot of software on a lot of different platforms. If I rsync
my source tree to do a test build on SUSE, there would be a lot of
makefiles to customize.

As a work around, I created the following script to switch the default
between the two compilers:



#!/bin/sh
# Switch default compiler between 4.8 and 6
#

if [ "$#" != "1" ] ;then

arg=help
else

arg=$1
fi

case "$arg" in

orig) VER=4.8 ;;
new) VER=6 ;;
*)

echo "Usage: $0 {orig|new}"
exit 1 ;;
esac

echo "Switching to compiler version $VER"
cd /usr/bin
for LINK in gcov g++ gcc gcc-ar gcc-nm gcc-ranlib cpp c++ cc
do

TGT=$LINK
[ "$TGT" = "c++" ] && TGT=g++
[ "$TGT" = "cc" ] && TGT=gcc
echo SETTING UP $LINK to $TGT-$VER
rm -f $LINK
ln -s $TGT-$VER $LINK
done

Now I just need to remember to switch defaults back to the old compiler
when I do kernel builds...


Hi
Look at using update-alternatives, have a look at this howto;
https://en.opensuse.org/User:Tsu2/gc...e-alternatives

Just export your CC or CXX to point at relevant versions....?

--
Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
openSUSE Leap 42.2|GNOME 3.20.2|4.4.74-18.20-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below... Thanks!