on gcc installation

activated the repo /repositories/devel:/gcc/openSUSE_Factory
and now zypper has installed gcc-4.5 and gcc-4.6 .
running gcc-v shows the gcc-4.5 version is used at compilation.
how to switch between gcc-4.5 and gcc-4.6 in this situation?
tried to un-install the gcc-4.5 but then zypper removed parts
of the xorg server for some reason, so gcc-4.5 must be installed.
want to have multiple (custom) gcc versions and switch between them
but keep the gcc-4.5 from OpenSuSE and its automatic updates.
Is there a howto to do that on OpenSuSE Linux without breaking
the zypper updates and the system installation ?
Is it just a own gcc compilation with custom configure args and prefixes?

Use the full path to gcc and export flags etc;

export CC=/usr/bin/gcc-4.6
export CXX=/usr/bin/g++-4.6
/usr/bin/gcc-4.6 -o something something.c

Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.3 (x86_64) Kernel
up 9:01, 2 users, load average: 0.27, 0.13, 0.08
GPU GeForce 8600 GTS Silent - Driver Version: 256.53

If you want to change the default gcc system wide it should be possible with

update-alternatives --config gcc

Otherwise follow the advise from malcolmlewis if you want to use it
different per compilation.

openSUSE 11.2 64 bit | Intel Core2 Quad Q8300@2.50GHz | Gnome 2.28 | GeForce
9600 GT | 4GB Ram
openSUSE 11.3 64 bit | Intel Core2 Duo T9300@2.50GHz | Gnome 2.30 | Quadro
FX 3600M | 4GB Ram

Tested it and it works as expected. Do not want to change gcc system wide
to avoid conflicts with zypper updates and other troubles, only per compilation.
Noticed the gcc46.spec file in gcc46-xxx.src.rpm can be used as example how
to install own gcc versions without getting conflicts with zypper and suse install
and it has no gcc-plugin support enabled, which is a new feature of gcc-4.5+.
Also could be nice if Bison-2.4.3 is in gcc repo because of the new features.
Thanks for the extra work done to have these new gcc features available now.



update-alternatives doesn’t seem to be doing it for me

update-alternatives --config gcc
No alternatives for gcc.

I’ve installed GCC 4.6 and I want GCC 4.6 to be the default system wide ? Do I set the symlink manually myself?

You need to define an entry for gcc to be able to use
update-alternatives, this is off top of my head, so double check it by
reading the man page before you use it

update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.5 1  \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.5
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 2  \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.6

PC: oS 11.4 (dual boot 12.1) 64 bit | Intel Core i7-2600@3.40GHz | KDE
4.6.0 | GeForce GT 420 | 16GB Ram
Eee PC 1201n: oS 11.4 64 bit | Intel Atom 330@1.60GHz | KDE 4.7.3 |
nVidia ION | 3GB Ram