Question

If I install build-essential in Linux, i will get gcc version corresponding to distro version, ex for Debian 6.0.9 i will get gcc-4.4. But some installers (for example, Nvidia installer) requires specific version, for example gcc-4.3. The problem is - if I install specific gcc version manually, ex:

sudo apt-get install gcc-4.3

the installed executable name will be gcc-4.3 and /usr/bin/gcc symlink will still point to gcc version installed by build-essential (which is gcc-4.4).

The question is - is it any standard, user-friendly way to "switch" "current" gcc version (the gcc command), without manually relinking all symlinks from gcc-4.4 to gcc-4.3 which is error-prone?

Was it helpful?

Solution

Correct way is to use update-alternatives. For gcc it will be:

update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.3 60

where 60 is a priority.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top