Debian: Default GCC Version ändern
Quick’n'Dirty:
#!/bin/bash
usage() {
echo
echo Sets the default version of gcc, g++, etc
echo Usage:
echo
echo ” gcc-set-default-version ”
echo
exit
}cd /usr/bin
if [ -z $1 ] ; then
usage;
fiset_default() {
if [ -e "$1-$2" ] ; then
echo $1-$2 is now the default
ln -sf $1-$2 $1
else
echo $1-$2 is not installed
fi
}for i in gcc cpp g++ gcov gccbug ; do
set_default $i $1
done
Quelle: http://risc0.wordpress.com/2007/03/04/nifty-script-for-gcc-default-version-fast-switching/
Für die Paketmanager-User gibts auch folgende elegante Methode, die automatisch einen entsprechenden Symlink erzeugt:
update-alternatives –config cpp
Klappt aber wohl nicht immer:
# dpkg -l | grep gcc
ii gcc 4:4.4.4-2 The GNU C compiler
ii gcc-2.95 1:2.95.4-27 The GNU C compiler
ii gcc-3.0-base 1:3.0.4-16 The GNU Compiler Collection (base package)
ii gcc-3.2 1:3.2.3-9 The GNU C compiler
ii gcc-3.2-base 1:3.2.3-9 The GNU Compiler Collection (base package)
ii gcc-3.3 1:3.3.6-15 The GNU C compiler
ii gcc-3.3-base 1:3.3.6-15 The GNU Compiler Collection (base package)
ii gcc-3.3-doc 1:3.3.6-13 Documentation for the GNU compilers (gcc, gobjc, g )
ii gcc-3.4 3.4.6-10 The GNU C compiler
ii gcc-3.4-base 3.4.6-10 The GNU Compiler Collection (base package)
ii gcc-4.0 4.0.3-7 The GNU C compiler
ii gcc-4.0-base 4.0.3-7 The GNU Compiler Collection (base package)
ii gcc-4.1 4.1.2-29 The GNU C compiler
ii gcc-4.1-base 4.1.2-29 The GNU Compiler Collection (base package)
ii gcc-4.2 4.2.4-6 The GNU C compiler
ii gcc-4.2-base 4.2.4-6 The GNU Compiler Collection (base package)
ii gcc-4.3 4.3.5-1 The GNU C compiler
ii gcc-4.3-base 4.3.5-1 The GNU Compiler Collection (base package)
ii gcc-4.4 4.4.4-7 The GNU C compiler
ii gcc-4.4-base 4.4.4-7 The GNU Compiler Collection (base package)
ii gcc272 2.7.2.3-19 The GNU C compiler.
ii libgcc1 1:4.4.4-7 GCC support library
ii toolchain-source 3.4-5 The GNU binutils and gcc source code
# update-alternatives –config cpp
Es gibt nur eine Alternative in Link-Gruppe cpp: /usr/bin/cpp
Nichts zu konfigurieren.
Hm, probier auch nochmal ein
# update-alternatives –config gcc
Ansonsten kann man auch per “update-alternatives –install” neue Linkgruppen anlegen. Aber dann ists mit dem Skript für den Privatgebrauch vielleicht doch übersichtlicher. :)