Jump to content

having 2 gcc versions installed [solved]


Guest Bug
 Share

Recommended Posts

Hello

 

I am using Mandriva 2005 LE. And I have made some updates through cooker sources... I have updated to KDE 3.4.1 and some programs for everyday use. And now I have installed on my system: gcc (GCC) 4.0.1 (4.0.1-0.2mdk for Mandriva Linux release 2006.0). But I have realised that some aplications cannot be corretly compiled with this version of gcc but with: gcc (GCC) 3.4.3 (Mandrakelinux 10.2 3.4.3-7mdk).

Now I know that it is possible to have installed both gcc versions. And that is what I need. But I don`t know how to do it --> that I wont crash my distribution.

So I am asking you good people out there if you could tell me how to install the older version of gcc (so there wont be any significant problems with newer version). And then how to compile aplications with this older version?

 

have a nice day,

Bug

Link to comment
Share on other sites

My experience is that gcc and related packages can be installed in parallel. For example:

[rolf@localhost ~]$ rpm -qa|grep gcc
gcc-c++-3.4.3-7mdk
gcc2.96-cpp-2.96-0.83mdk
gcc-cpp-3.4.3-7mdk
gcc-3.4.3-7mdk
gcc2.96-c++-2.96-0.83mdk
gcc2.96-2.96-0.83mdk
libgcc1-3.4.3-7mdk
[rolf@localhost ~]$ urpmq -y gcc
cross-ppc-gcc
cross-ppc-gcc-cpp
cross-ppc-libgcc1
cross-ppc64-gcc
cross-ppc64-gcc-cpp
cross-ppc64-libgcc1
gcc
gcc-c++
gcc-colorgcc
gcc-cpp
gcc-doc
gcc-doc-pdf
gcc-g77
gcc-gnat
gcc-java
gcc-objc
gcc2.96
gcc2.96-c++
gcc2.96-cpp
gcc3.3
gcc3.3-c++
gcc3.3-cpp
gcc3.3-doc
gcc3.3-doc-pdf
gcc4.0
gcc4.0-c++
gcc4.0-cpp
gcc4.0-doc
gcc4.0-doc-pdf
gccxml
libgcc1

 

Also, for Official sources, there are many versions of gcc and related packages available. Install the version(s) of gcc and related packages you need (rpm -i) and use update-alternatives to configure the default gcc to be used or use build switches and/or Makefile edits to select the version to use.

 

# update-alternatives --config gcc

There are 2 programs which provide `gcc'.

 Selection    Command
-----------------------------------------------
*+    1        /usr/bin/gcc-3.4.3
     2        /usr/bin/gcc-2.96

Enter to keep the default[*], or type selection number:

 

man update-alternatives

Link to comment
Share on other sites

ellow....

Yes, why don`t but there one very strange situation.... U have downloaded gcc-c++-3.4.3-7mdk.i586.rpm from the main sources... in the console typed urpmi gcc-c++-3.4.3-7mdk.i586.rpm but the system said that that package is already installed???!! Shocked

Then I typed update-alternatives --config gcc to see what versions I can use and it has displayed to me:

There are 4 programs which provide `gcc'.

 

Selection Command

-----------------------------------------------

1 /usr/bin/gcc-4.0.1

2 /usr/bin/gcc-3.3.4

*+ 3 /usr/bin/colorgcc

4 /usr/bin/gcc-2.96

 

So where is gcc 3.4.3 If the system says that it is installed???

Over the Mandrake Control Center in the section where you remove packages, there is no package gcc-c++-3.4.3-7mdk to be removed. So I have an idea to remove the package from the shell - urpmd and then installing it again. Would that be a vise decision?

And from where do I hava gcc 3.3.4 installed?

 

Have a nice day,

Bug

Link to comment
Share on other sites

First of all, if you mix cooker and production packages, you are creating a situation that is 'unsupported'. It is unsupported because it it likely to create problems. The advice has always been to either run only cooker (not for production) or run a pure stable distribution. Many people will dual boot with both types of installation.

 

[rolf@localhost ~]$ urpmq -i gcc3.3
Name        : gcc3.3
Version     : 3.3.4
Release     : 4mdk
Group       : Development/C
Size        : 10683210                     Architecture: i586
Source RPM  : gcc3.3-3.3.4-4mdk.src.rpm      Build Host: n2.mandrakesoft.com
Packager    : Gwenole Beauchesne <gbeauchesne@mandrakesoft.com>
URL         : http://gcc.gnu.org/
Summary     : GNU Compiler Collection
Description :
A compiler aimed at integrating all the optimizations and features
necessary for a high-performance and stable development environment.
This package is required for all other GCC compilers, namely C++,
Fortran 77, Objective C and Java.

If you have multiple versions of GCC installed on your system, it is
preferred to type "gcc-$(gcc3.3-version)" (without double quotes) in
order to use the GNU C compiler version 3.3.4.

 

3.3.4 is the version of gcc3.3 that comes with 2005. It is a matter of terminology used by urpmi. Also, you will notice another method for specifying your compiler.

 

As to why urpmi says the package is already installed, I don't know. Sometimes the error will be a clue that the command is faulty. If you use urpmi to install a downloaded package, you must give the full path to the package. That is, if you cd to the directory that contains the downloaded package, named gcc-3.4.3-7mdk.i586.rpm, the command would be:

 

urpmi gcc-3.4.3-7mdk.i586.rpm

 

If the rpm is not in your current working directory, you could give the path:

 

urpmi /path/to/gcc-3.4.3-7mdk.i586.rpm

 

You should already have urpmi sources for main set up at installation, unless you removed them. If you have sources for cooker, that will cause problems. Remove them or disable them in Software Media Manager. Now, unless you have installed cooker packages whose dependencies prevent the simple use of urpmi to install a package from 2005, the following information displays what command/terminology urpmi will need to get gcc installed:

 

$ urpmq -i gcc
Name        : gcc
Version     : 3.4.3
Release     : 7mdk
Group       : Development/C
Size        : 9451626                      Architecture: i586
Source RPM  : gcc-3.4.3-7mdk.src.rpm         Build Host: n2.mandrakesoft.com
Packager    : Gwenole Beauchesne <gbeauchesne@mandrakesoft.com>
URL         : http://gcc.gnu.org/
Summary     : GNU Compiler Collection
[..]

 

This tells me gcc means gcc-3.4.3 to urpmi in 2005 and it ought to install if you simply:

 

urpmi gcc

 

as root. You will probably also need the corresponding -c++ and -cpp packages of that version for certain types of compiling to work. So, what I suggest is to either give the full path to the rpms as the argument to urpmi or use the name for the package in your sources that urpmi will understand. What you have done with your urpmi sources and installation of cooker packages might make this not work. Paste any commands used along with complete error messages, if there is a problem.

Link to comment
Share on other sites

ellow...

 

Thank you very much for all the help. :thanks:

 

I have solved the problem, I have "convinced" the system to install the version 3.4.3 and now I have 2 versions (3.4.3 & 4.0.1) whitch I change with

update-alternatives --config gcc

and everythin work like a charm :D

Yes, I agree with the statement to use separate systems if you use multiple sources (cooker & 2005), but I have made a very good compromise with using both sources... afcourse not simultanuously

 

Tnx again, you helped me allot!

 

have a nice day,

Bug

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...