Now for Ubuntu / exact gcc-4.9 is available.
Create a group of compiler alternatives where the compiler distribution takes precedence:
root$ VER=4.6 ; PRIO=60 root$ update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$VER $PRIO --slave /usr/bin/g++ g++ /usr/bin/g++-$VER root$ update-alternatives --install /usr/bin/cpp cpp-bin /usr/bin/cpp-$VER $PRIO root$ VER=4.9 ; PRIO=40 root$ update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$VER $PRIO --slave /usr/bin/g++ g++ /usr/bin/g++-$VER root$ update-alternatives --install /usr/bin/cpp cpp-bin /usr/bin/cpp-$VER $PRIO
NOTE. The g ++ version is automatically changed using the gcc version switch. cpp-bin must be run separately, since there is an alternative to "cpp".
List of available compiler alternatives:
root$ update-alternatives --list gcc root$ update-alternatives --list cpp-bin
To select the manual version 4.9 from gcc, g ++ and cpp, do:
root$ update-alternatives --config gcc root$ update-alternatives --config cpp-bin
Check the compiler version:
root$ for i in gcc g++ cpp ; do $i --version ; done
Restore distribution compiler settings (here: back to version 4.0):
root$ update-alternatives --auto gcc root$ update-alternatives --auto cpp-bin
dileks Jan 24 '15 at 14:01 2015-01-24 14:01
source share