I've not used alternatives
before, and I may be doing it wrong: I'm certainly not getting the results I expect. I need to use two versions of GCC, and wanted to set them up using alternatives
. Here's what I did:
$ sudo alternatives --install /usr/bin/gcc gcc /opt/gcc4.6.3/bin/gcc 20000
$ sudo alternatives --config gcc
There is 1 program that provides 'gcc'.
Selection Command
-----------------------------------------------
*+ 1 /opt/gcc4.6.3/bin/gcc
Enter to keep the current selection[+], or type selection number: 1
$ which gcc
/usr/lib64/ccache/gcc
What is going on? Why is gcc still the one installed elsewhere? Why isn't this one (which for some reason gets selected, regardless of my choice) isn't even listed as an alternative?
I'm using Fedora 17, if it matters.
/usr/bin/gcc
is a symlink that points to/etc/alternatives/gcc
, which in turn points to the proper compiler. I've also ranupdatedb
just in case - all for naught, and the GCC is still found in/usr/lib64/ccache
:(gcc <some-funky-flags>
.man gcc
takes forever to render in Emacs :) needless to say I'm not a pro with it / am unlikely to find it, w/o knowing what exactly I'm looking for. But thanks for heads up. Interestingly, I discovered thatalternatives
at first, silently failed to create the symlink because the name was taken by the actual gcc binary! After handling that and re-running the whole procedure again it seems to work (I still need to try to launch an example, but I think I've "solved" it somehow already).