1834404 Members
2743 Online
110067 Solutions
New Discussion

gcc compilers

 
Chern Jian Leaw
Regular Advisor

gcc compilers

Hi,

I would like to find the version of gcc compiler. I did a gcc -v and it displayed a version of gcc from the default location at /usr/bin/gcc. i.e :
gcc -v
Reading specs from /usr/bin/gcc/3.1/lib/gcc-lib/hppa2.0w-hp-hpux11.00/3.1/specs
Configured with:../gcc-3.1/configure --host=hppa2.0w-hp-hpux11.00 ...(and configuration settings continues ...)

However, I do have some other gcc compilers of different versions stored in some other locations, but I'm not sure where.

I would like to locate the gcc 2.95.1 version compiler.

Is there a way to use the "find" utility to search for a version of a tool e.g gcc?
Or do I need a script to do this? If so, could someone show me how I could write the script to locate for the different versions of gcc, or any other tools for that matter?

Could someone help me out?

Thanks.
2 REPLIES 2
Patrick Wallek
Honored Contributor

Re: gcc compilers

I'd just do a find looking for your gcc and the do a 'gcc -v' usr the full path to the files it finds.

An example:

# find /dir -name gcc -print
/dir/dir1/gcc
/dir/dir2/gcc

Then just do a:

# /dir/dir1/gcc -v

# /dir/dir2/gcc -v
Chern Jian Leaw
Regular Advisor

Re: gcc compilers

Patrick,

Thanks for the swift reply. However, the find utility also produces other results which are not in the match :

/stor/local/generic/build/vdce_ct/x/test
open /stor/local/generic/.writable/csd/md6ra/2001
find: cannot open /stor/local/generic/class
find: cannot open /stor/local/generic/skel/projects/csh/RCS
find: cannot open /stor/local/generic/skel/old
find: cannot open /stor/local/generic/ftp/bin
/stor/local/hp700_ux110/gnu/bin/gcc
/stor/local/hp700_ux110/gnu/cygnus/progressive-95q2/H-hppa1.1-hp-hpux9.05/bin/gcc
/stor/local/hp700_ux110/gnu/cygnus/progressive-95q1/H-hppa1.1-hp-hpux/bin/gcc

I tried removing lines begining with "find: cannot ...", using the following 2 methods but it did not work:
# find / -name gcc -exec grep -v "find: cannot" {} \;

OR:
#find / -name gcc -print |grep -v "find: cannot"

Could you help me out?

Thanks.