LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Problem with Gcc installation on Centos (http://www.linuxquestions.org/questions/linux-general-1/problem-with-gcc-installation-on-centos-798588/)

Nemoden 03-29-2010 05:13 AM

Problem with Gcc installation on Centos
 
I've installed GCC compiler:

Code:

yum install gcc
Added all directories to the $PATH
Code:

find / -name gcc
/usr/bin/gcc
/usr/local/bin/gcc
/usr/local/bin/gcc/gcc
/usr/local/bin/gcc/gcc/testsuite/ada/acats/tests/gcc
/usr/lib/gcc
/usr/libexec/gcc
[root@sql httpd-2.2.15]# PATH=/usr/bin:/usr/local/bin:/usr/local/bin/gcc:/usr/local/bin/gcc/gcc/testsuite/ada/acats/tests:/usr/lib:/usr/libexec:$PATH
[root@sql httpd-2.2.15]# which gcc
/usr/bin/which: no gcc in (/usr/bin:/usr/local/bin:/usr/local/bin/gcc:/usr/local/bin/gcc/gcc/testsuite/ada/acats/tests:/usr/lib:/usr/libexec:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

and anyway ./configure does not work for the reason of
Quote:

configure: error: no acceptable C compiler found in $PATH
Any ideas?

Code:

which gcc
/usr/bin/which: no gcc in (/usr/bin:/usr/local/bin:/usr/local/bin/gcc:/usr/local/bin/gcc/gcc/testsuite/ada/acats/tests:/usr/lib:/usr/libexec:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)


blacky_5251 03-29-2010 05:16 AM

Is the file /usr/bin/gcc executable? Sounds like something when awry in the install phase. Here's my file details:-
Code:

2.6.18-164.15.1.el5.centos.plus[root@www httpd]# sum /usr/bin/gcc
56896  198
2.6.18-164.15.1.el5.centos.plus[root@www httpd]# ls -l /usr/bin/gcc
-rwxr-xr-x 2 root root 202368 Jan 14 14:46 /usr/bin/gcc
2.6.18-164.15.1.el5.centos.plus[root@www httpd]# /usr/bin/gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
2.6.18-164.15.1.el5.centos.plus[root@www httpd]#


knudfl 03-29-2010 06:57 AM

Welcome to LQ. .. .. :) ..
Quote:

/usr/local/bin/gcc
/usr/local/bin/gcc/gcc
/usr/local/bin/gcc/gcc/testsuite/ada/acats/tests/gcc
There should be no GCC whatsoever in /usr/local/bin/ !

# yum install gcc
.. provides a GCC not very usable.
You will need : # yum install glibc-devel glibc-headers
Also recommended : # yum install gcc-c++
.....
Quote:

Added all directories to the $PATH
Not quite clear, why you would do such a thing.
Software installed with yum ( = packages ) :
No setup or PATH setting is required.
( For 99 percent of the packages.)
.....

Nemoden 03-30-2010 03:48 AM

Quote:

Welcome to LQ. .. .. ..
knudfl, Thanks. I found this forum a long time ago, but registered just now. Due to my work I need to work on Ubuntu (as desktop), FreeBSD and CentOS (as server) a lot and it is really hard for Windows 7 user :)
Installation of gcc wasn't a problem on Ubuntu at all on my desktop. I don't know why I've faced with it on CentOS. Anyway it's my mistake - I attempted to install it from sources (not from yum repos).

My problem is solved. Although, I'd narrate what I've done to fix it (maybe somebody has the same issue):

Code:

Package glibc-devel-2.5-42.i386 already installed and latest version                                                                                                                                             
Package glibc-headers-2.5-42.i386 already installed and latest version

Installed gcc-c++

Code:

Not quite clear, why you would do such a thing.
Software installed with yum ( = packages ) :
No setup or PATH setting is required.
( For 99 percent of the packages.)

I thought it might solve the problem :)

Code:

[root@sql httpd-2.2.15]# /usr/bin/gcc
-bash: /usr/bin/gcc: is a directory

I found appropriate Gcc compiler named gcc44 /usr/bin.
Made a symbolyc link:
Code:

ln -s -T /usr/bin/gcc44 /usr/bin/gcc
Code:

[root@sql httpd-2.2.15]# ls -l /usr/bin | grep gcc
lrwxrwxrwx 1 root root          3 Mar 30 08:08 cc -> gcc
lrwxrwxrwx 1 root root        14 Mar 30 08:23 gcc -> /usr/bin/gcc44
-rwxr-xr-x 2 root root    218448 Sep  4  2009 gcc44
-rwxr-xr-x 1 root root    196692 Sep  3  2009 gcc;4bafd274
-rwxr-xr-x 1 root root    196692 Sep  3  2009 gcc;4bafd6a6
-rwxr-xr-x 2 root root    196692 Sep  3  2009 gcc;4bb116e9
-rwxr-xr-x 2 root root    218448 Sep  4  2009 i386-redhat-linux6E-gcc44
-rwxr-xr-x 2 root root    196692 Sep  3  2009 i386-redhat-linux-gcc

All this mess is from my previous attempts to install gcc.
For example I have no idea what is
gcc;4bafd274
etc, but at least now everything works just fine and I've installed apache2.

knudfl 03-30-2010 07:05 PM

Please don't use root for "user commands".
Root is for administrative tasks only !
Code:

    1        ls -l /usr/bin | grep gcc
    2        lrwxrwxrwx 1 root root          3 Aug  7  2009 cc -> gcc
    3        -rwxr-xr-x 2 root root      196644 Jan 21  2009 gcc
    4        -rwxr-xr-x 2 root root      89728 Mar 23  2007 gcc34
    5        -rwxr-xr-x 2 root root      208480 Jan 21  2009 gcc43
    6        -rwxr-xr-x 1 root root        2018 Mar 24  2007 gccmakedep
    7        -rwxr-xr-x 2 root root      208480 Jan 21  2009 i386-redhat-linux6E-gcc43
    8        -rwxr-xr-x 2 root root      196644 Jan 21  2009 i386-redhat-linux-gcc
    9        -rwxr-xr-x 2 root root      89728 Mar 23  2007 i386-redhat-linux-gcc34

The default gcc ( line 3 (and 8 )) is gcc-4.1.2,
the one you get with # yum install gcc .

So it's a mystery, why it is / was missing on your OS.
.....
These three, you also show :
gcc;4bafd274
gcc;4bafd6a6
gcc;4bb116e9
... I don't know, what it is. May be inspect the files.
Please try this command file /usr/bin/<file-to-be-tested>.
.....
.....

I have gcc43 instead of your gcc44.
Code:

rpm -qa --last | grep gcc
compat-gcc-34-c++-3.4.6-4                    Sat 16 Jan 2010 02:51:26 PM EST
gcc-gfortran-4.1.2-44.el5                    Wed 11 Nov 2009 08:00:31 PM EST
gcc43-c++-4.3.2-7.el5                        Mon 09 Nov 2009 09:42:30 PM EST
gcc43-4.3.2-7.el5                            Mon 09 Nov 2009 09:37:07 PM EST
compat-gcc-34-g77-3.4.6-4                    Fri 23 Oct 2009 03:26:06 AM EDT
compat-gcc-34-3.4.6-4                        Fri 23 Oct 2009 03:26:05 AM EDT
gcc-c++-4.1.2-44.el5                          Fri 07 Aug 2009 07:16:54 PM EDT
gcc-4.1.2-44.el5                              Fri 07 Aug 2009 07:13:30 PM EDT



All times are GMT -5. The time now is 04:42 PM.