Operating System - Linux
1753408 Members
7278 Online
108793 Solutions
New Discussion юеВ

gcc version in red hat Linux

 
John Guster
Trusted Contributor

gcc version in red hat Linux

should the version getting from gcc -v match one from rpm -qa|grep gcc?
6 REPLIES 6
Steven Schweda
Honored Contributor

Re: gcc version in red hat Linux

It depends.

It's possible to download a GCC source kit,
and build and install a GCC that way, and
that wouldn't appear in any "rpm" report.

Is there some actual problem which you are
trying to solve?

> [...] gcc -v [...] rpm -qa|grep gcc [...]

Call me curious, but what do they say?
John Guster
Trusted Contributor

Re: gcc version in red hat Linux

$gcc -v
Reading specs from /usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-59)
$rpm -qa|grep gcc
gcc-3.4.6-3

so which version of gcc is: 3.4.6-3 or 3.2.3?
Any idea to share?
Steven Schweda
Honored Contributor

Re: gcc version in red hat Linux

> so which version of gcc [...]?

Could be both, but I'd bet that you have (at
least) "gcc version 3.2.3 20030502 (Red Hat
Linux 3.2.3-59)" installed. GCC is seldom
confused about its own version.

which gcc
echo $PATH

Multiple versions of GCC can be installed in
different places. A bare "gcc" will get you
the first "gcc" found on your PATH. I don't
run Red Hat, so I know nothing, and among the
things I don't know is where "rpm" would have
installed the "gcc" from your gcc-3.4.6-3
kit.

find /usr -type f -name gcc

(Or anyplace else you think likely.)
John Guster
Trusted Contributor

Re: gcc version in red hat Linux

there is only gcc executable on the system. it seems info in the package database is different from that directly on the executable.
bullz
Super Advisor

Re: gcc version in red hat Linux

Yes, ofcourse.

# gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46)

# rpm -qa | grep gcc
gcc-4.1.2-46.el5_4.2

OS is RHEL 5.4
John Guster
Trusted Contributor

Re: gcc version in red hat Linux

It has to be reinstalled to clear the inconsistnecy. Thanks all for your thoughts.