LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   What versions of g++ and gcc come standard with RHEL 5.3 (https://www.linuxquestions.org/questions/linux-general-1/what-versions-of-g-and-gcc-come-standard-with-rhel-5-3-a-864548/)

Mark8812 02-23-2011 10:06 AM

What versions of g++ and gcc come standard with RHEL 5.3
 
This is a little long, but I want to provide as much detail as possible, so please bear with me.

I ran into an issue that was written up here on LQ and/or on other sites, the one dealing with an error similar to the following one:
error trying to exec 'cc1plus': execvp: No such file or directory
The solution seems is to make g++ and gcc versions consistent. I've since remedied that, but am slightly confused with my findings and concerned with my solution.

When I first looked in /usr/bin for all references to g++ and gcc, I saw that there were two version of gcc and one version of g++:

$cd /usr/bin
$ls -al | grep -e 'g++\|gcc'


lrwxrwxrwx 1 root root 3 Jan 21 16:28 cc -> gcc
-rwxr-xr-x 3 root root 94784 Aug 23 2006 g++34
-rwxr-xr-x 1 root root 202320 ??? ?? ???? gcc
-rwxr-xr-x 2 root root 92916 Aug 23 2006 gcc34
-rwxr-xr-x 3 root root 94784 Aug 23 2006 i386-redhat-linux-g++34
-rwxr-xr-x 1 root root 202320 Sep 18 2008 i386-redhat-linux-gcc
-rwxr-xr-x 2 root root 92916 Aug 23 2006 i386-redhat-linux-gcc34


(Note the "??? ?? ????" as date for gcc. I've since made some changes, but this was essentially the set of gcc and g++ files that existed before I started.)

I'm told that the system I'm using is an "out of the box" installation, i.e. no modifications. As installed, gcc is the newer version and does not correspond to g++34:

$gcc --version

gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Confusion and concern:


When I use makefiles from software I've adopted, I run into the cc1plus problem eluded to above. The cc1plus error occurred because the makefiles expected there to be a command named "g++," so I created a symbolic link, pointing /usr/bin/g++ -> /usr/bin/g++34. And in doing so, g++ was not consistent with gcc. I've since fixed that, i.e. copied the gcc34 version to gcc and my software builds fine.

My question are:

1. Will copying the gcc34 version to gcc cause issues in the future, possibly related to upgrades and/or istallations of other packages that rely on "gcc"? Currently the files are as follows:
lrwxrwxrwx 1 root root 3 Jan 21 16:28 cc -> gcc
lrwxrwxrwx 1 root root 5 Feb 17 15:37 g++ -> g++34
-rwxr-xr-x 3 root root 94784 Aug 23 2006 g++34
-rwxr-xr-x 1 root root 92916 Feb 22 11:47 gcc
-rwxr-xr-x 2 root root 92916 Aug 23 2006 gcc34
-rwxr-xr-x 3 root root 94784 Aug 23 2006 i386-redhat-linux-g++34
-rwxr-xr-x 1 root root 202320 Sep 18 2008 i386-redhat-linux-gcc
-rwxr-xr-x 2 root root 92916 Aug 23 2006 i386-redhat-linux-gcc34
2. Were the g++ and gcc files in /usr/bin the "out of the box" versions?

3. How can I answer a question like this in the future, without posting to LQ, i.e. is there a reference to find this type of information?

Thanks in advance.
Mark

knudfl 02-23-2011 03:38 PM

Default versions : gcc / gcc-c++ (g++) version 4.1.2.

# yum install gcc-c++ : Will install the g++ compiler and update the
may be corrupted /usr/bin/gcc.

/usr/bin/gcc34, /usr/bin/g++34 : Please use 'rpm -qf /usr/bin/g++34'
to know the package, that installed the file.
( compat-gcc-34 , compat-gcc-34-c++ : The old "3.4.6".)

Quote:

Will copying the gcc34 version to gcc cause issues in the future, possibly
related to upgrades and/or istallations of other packages that rely on "gcc" ?
Certainly not a good idea to use gcc34 as default compiler : You can't test,
if your files will work with the later gcc-4.1.2.
Dependency : I don't think, any packages depend on gcc-4.1.2 :
And a dependency check is not done in /usr/bin/, but in the rpm data base.
I.e. Changing some files ( or deleting files ), the rpm data base will not know
anything at all about that.

..


All times are GMT -5. The time now is 09:14 AM.