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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top