Having more than one version of gcc
GCC 4.2 is out and already in Debian/unstable. While I'm keen to try out the latest and the greatest, I'd like to keep gcc-3.4 around, just in case some weird software cannot be compiled with gcc-4.x (btw, is gcc-2.95 really obsolete by now?). And I only want to have one gcc-4.x on my system - however, that's not yet possible, because various applications are depending on gcc-4.1.x.
OK, fine, I'm gonna have 3 different GCC versions on the box. Luckily Debian comes with update-alternatives and I finally came across a useful post in ubuntuforums.org describing how to actually use it:
OK, fine, I'm gonna have 3 different GCC versions on the box. Luckily Debian comes with update-alternatives and I finally came across a useful post in ubuntuforums.org describing how to actually use it:
$ old=4.1 new=4.2 $ update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${new} 60 \ --slave /usr/bin/cc cc /usr/bin/gcc-${new} \ --slave /usr/bin/cpp cpp /usr/bin/cpp-${new} \ --slave /usr/bin/gcov gcov /usr/bin/gcov-${new} \ --slave /usr/bin/g++ g++ /usr/bin/g++-${new} $ update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${old} 40 \ --slave /usr/bin/cc cc /usr/bin/gcc-${old} \ --slave /usr/bin/cpp cpp /usr/bin/cpp-${old} \ --slave /usr/bin/gcov gcov /usr/bin/gcov-${old} \ --slave /usr/bin/g++ g++ /usr/bin/g++-${old} $ update-alternatives --config gcc There are 2 alternatives which provide `gcc'. Selection Alternative ----------------------------------------------- *+ 1 /usr/bin/gcc-4.2 2 /usr/bin/gcc-4.1 Press enter to keep the default[*], or type selection number: 1 Using `/usr/bin/gcc-4.2' to provide `gcc'.Note: the '40' and '60' are priorities, which are explained in the manpage.