Can't compile or install GCC


 
Thread Tools Search this Thread
Operating Systems Linux SuSE Can't compile or install GCC
# 1  
Old 11-17-2010
Can't compile or install GCC

Hi all!


I have posted in the Shell Programming Scripting Forum for a problem with the use of shc and so on...

You can read it complete here: shell-programming-scripting/148510-problems-using-shc.html


I think the problem is: that there aren't compiler installed on the SuSe 10.2 server, so I can't run successfully the shc program. In the server, there is only command-line access.

I tried to install it with YAST, but it fails because ask for installation CDs that nor have nor can insert.

I've downloaded several rpm's packages with null results...


Can you help me?



Thanks in advance...
# 2  
Old 11-17-2010
First off -

are you sure gcc is no there? What is the output of:

Code:
which gcc
echo $PATH

# 3  
Old 11-18-2010
Hi!

First of all, thanks for your reply.

And now: yes, it isn't :

Code:
/root # which gcc
which: no gcc in (/sbin:/usr/sbin:/usr/local/sbin:/opt/gnome/sbin:/root/bin:/usr/local/bin:
/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/openv/uss0001/sbin:
/usr/openv/netbackup/bin/support:/usr/openv/uss0001/sbin:/usr/openv/netbackup/bin/support:/root/bin:
/opt/VRTS/bin:/usr/openv/netbackup/bin:/usr/openv/netbackup/bin/admincmd:
/usr/openv/netbackup/bin/goodies:/usr/openv/volmgr/bin)

Code:
/root # echo $PATH
/sbin:/usr/sbin:/usr/local/sbin:/opt/gnome/sbin:/root/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:
/bin:/usr/games:/opt/gnome/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/openv/uss0001/sbin:
/usr/openv/netbackup/bin/support:/usr/openv/uss0001/sbin:/usr/openv/netbackup/bin/support:/root/bin:
/opt/VRTS/bin:/usr/openv/netbackup/bin:/usr/openv/netbackup/bin/admincmd:
/usr/openv/netbackup/bin/goodies:/usr/openv/volmgr/bin

Looking in yast -> Software -> Software Management -> Shearch -> gcc I see this:
Code:
|     |Name        |Avail. Vers.  |Inst. Vers.   |Summary                                    |Size       
|  i  |cpp         |4.1.2_20070115|4.1.2_20070115|The GCC Preprocessor                       |5.6 M
|  +  |gcc         |4.1.2_20070115|              |The GNU C Compiler and Support Files       |1.8 M
|  +  |gcc-c++     |4.1.2_20070115|              |The GNU C++ Compiler                       |6.3 M
|     |gcc-fortran |4.1.2_20070115|              |The GNU Fortran Compiler and Support Files |8.0 M
|     |gcc-info    |4.1.2_20070115|              |GNU Info-Pages for GCC                     |1.4 M
|     |gcc-java    |4.1.2_20070115|              |The GNU Java Compiler                      |5.9 M
|  +  |gcc-locale  |4.1.2_20070115|              |Locale Data for the GNU Compiler Collection|4.9 M
|  +  |gcc-obj-c++ |4.1.2_20070115|              |GNU Objective C++ Compiler                 |6.1 M
|  +  |gcc-objc    |4.1.2_20070115|              |GNU Objective C Compiler                   |6.0 M
|  i  |libgcc      |4.1.2_20070115|4.1.2_20070115|C compiler runtime library                 |98.6 K
|     |libgcj      |4.1.2_20070115|              |Java Runtime Library for gcc               |38.9 M
|     |libgcj-32bit|4.1.2_20070115|              |Java Runtime Library for gcc               |21.4 M

The '+' where there because I tried to install it.


I look over the FS '/' and it found this 2 directories:
Code:
/root # cd /

/ # find ./ -name gcc -print
./usr/lib/gcc
./usr/lib64/gcc

/ # ls -lrt ./usr/lib/gcc;ls -lrt ./usr/lib64/gcc
total 4
drwxr-xr-x 3 root root 4096 2009-07-02 12:08 i586-suse-linux
total 4
drwxr-xr-x 3 root root 4096 2008-04-22 02:37 x86_64-suse-linux

Looking inside them, this can be seen:

Code:
/ # ls -lrt ./usr/lib/gcc/i586-suse-linux/;ls -lrt ./usr/lib64/gcc/x86_64-suse-linux/
total 4
drwxr-xr-x 2 root root 4096 2009-07-02 12:08 2.95.3
total 4
drwxr-xr-x 2 root root 4096 2010-02-18 13:19 4.1.2

/ # ls -lrt ./usr/lib/gcc/i586-suse-linux/2.95.3/;ls -lrt ./usr/lib64/gcc/x86_64-suse-linux/4.1.2/
total 144
-rw-r--r-- 1 root root 123628 2006-06-16 15:13 libgcc.a
-rw-r--r-- 1 root root   1400 2006-06-16 15:13 crtendS.o
-rw-r--r-- 1 root root   1316 2006-06-16 15:13 crtend.o
-rw-r--r-- 1 root root   2152 2006-06-16 15:13 crtbeginS.o
-rw-r--r-- 1 root root   1916 2006-06-16 15:13 crtbegin.o
total 5644
-rwxr-xr-x 1 root root 5765088 2008-04-22 02:37 cc1

So, finally there are a 'cc1' file that can be a compiler. But, it's really? If yes, what should I make?


Thanks in advance...


Best regards

---------- Post updated at 10:33 AM ---------- Previous update was at 09:21 AM ----------

If this helps:

I add the directory where the cc1 file exists to the PATH:
Code:
PATH=$PATH:/usr/lib64/gcc/x86_64-suse-linux/4.1.2/

I create this file:
Code:
/bin/magius/shc-3.8.6 # echo "#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
    char testvar[255];
    strcpy(testvar, "Hello, Magius");
    printf("%s\n", testvar);
    return 1;
}" > magius.c

I create two soft links to cc1:
Code:
/bin/magius/shc-3.8.6 # ln -s /usr/lib64/gcc/x86_64-suse-linux/4.1.2/cc1 /usr/lib64/gcc/x86_64-suse-linux/4.1.2/cc
/bin/magius/shc-3.8.6 # ls -lrt /usr/lib64/gcc/x86_64-suse-linux/4.1.2/cc
lrwxrwxrwx 1 root root 42 2010-11-18 10:27 /usr/lib64/gcc/x86_64-suse-linux/4.1.2/cc -> /usr/lib64/gcc/x86_64-suse-linux/4.1.2/cc1
/bin/magius/shc-3.8.6 # ln -s /usr/lib64/gcc/x86_64-suse-linux/4.1.2/cc1 /usr/lib64/gcc/x86_64-suse-linux/4.1.2/gcc
/bin/magius/shc-3.8.6 # ls -lrt /usr/lib64/gcc/x86_64-suse-linux/4.1.2/gcc
lrwxrwxrwx 1 root root 42 2010-11-18 10:36 /usr/lib64/gcc/x86_64-suse-linux/4.1.2/gcc -> /usr/lib64/gcc/x86_64-suse-linux/4.1.2/cc1

And I try to compile with all: gcc, cc and cc1:
Code:
/bin/magius/shc-3.8.6 # gcc -o magius magius.c
magius.c:1:19: error: stdio.h: No such file or directory
magius.c:2:20: error: string.h: No such file or directory
 main
magius.c: In function âmainâ:
magius.c:6: warning: incompatible implicit declaration of built-in function âstrcpyâ
magius.c:6: error: âHelloâ undeclared (first use in this function)
magius.c:6: error: (Each undeclared identifier is reported only once
magius.c:6: error: for each function it appears in.)
magius.c:6: error: âMagiusâ undeclared (first use in this function)
magius.c:6: error: too many arguments to function âstrcpyâ
magius.c:7: warning: incompatible implicit declaration of built-in function âprintfâ
magius.c:7: error: expected expression before â%â token

Execution times (seconds)
 TOTAL                 :   0.00             0.00             0.01               1824 kB

/bin/magius/shc-3.8.6 # cc -o magius magius.c
magius.c:1:19: error: stdio.h: No such file or directory
magius.c:2:20: error: string.h: No such file or directory
 main
magius.c: In function âmainâ:
magius.c:6: warning: incompatible implicit declaration of built-in function âstrcpyâ
magius.c:6: error: âHelloâ undeclared (first use in this function)
magius.c:6: error: (Each undeclared identifier is reported only once
magius.c:6: error: for each function it appears in.)
magius.c:6: error: âMagiusâ undeclared (first use in this function)
magius.c:6: error: too many arguments to function âstrcpyâ
magius.c:7: warning: incompatible implicit declaration of built-in function âprintfâ
magius.c:7: error: expected expression before â%â token

Execution times (seconds)
 TOTAL                 :   0.00             0.01             0.01               1824 kB

Code:
/bin/magius/shc-3.8.6 # cc1 -o magius magius.c
magius.c:1:19: error: stdio.h: No such file or directory
magius.c:2:20: error: string.h: No such file or directory
 main
magius.c: In function âmainâ:
magius.c:6: warning: incompatible implicit declaration of built-in function âstrcpyâ
magius.c:6: error: âHelloâ undeclared (first use in this function)
magius.c:6: error: (Each undeclared identifier is reported only once
magius.c:6: error: for each function it appears in.)
magius.c:6: error: âMagiusâ undeclared (first use in this function)
magius.c:6: error: too many arguments to function âstrcpyâ
magius.c:7: warning: incompatible implicit declaration of built-in function âprintfâ
magius.c:7: error: expected expression before â%â token

Execution times (seconds)
 parser                :   0.01 (100%) usr   0.00 ( 0%) sys   0.00 ( 0%) wall      70 kB ( 4%) ggc
 TOTAL                 :   0.01             0.00             0.01               1824 kB

As I expect any of them works. Its the same file at the end...



I don't know what more I can do ...


Thanks in advance...

Last edited by Magius; 11-18-2010 at 05:39 AM..
# 4  
Old 11-22-2010
Using cc1 directly is not the way to go. If anything, it will only perform the first stage of the compilation.

I tried to use gcc -v in order to see ho it is done, and there are many more flags it uses on the command line.

my compilation line was: gcc -o checkstatvfs checkstatvfs.c.

The result:

/usr/lib/gcc/x86_64-linux-gnu/4.4.3/cc1 -quiet -v checkstatvfs.c -D_FORTIFY_SOURCE=2 -quiet -dumpbase checkstatvfs.c -mtune=generic -auxbase checkstatvfs -version -fstack-protector -o /tmp/ccmVxJF6.s

as you can see, the output is an assembler file.

Then, the assembler is run:
as -V -Qy -o /tmp/ccYDwa43.o /tmp/ccmVxJF6.s

and after that, collect2 is run:
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/collect2 --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=both -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o checkstatvfs -z relro /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.4.3/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.4.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.4.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../.. -L/usr/lib/x86_64-linux-gnu /tmp/ccYDwa43.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/4.4.3/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/crtn.o

which does the linking, apparently.

You need to determine where did /usr/bin/gcc have gone away. I don't think that doing the compilation one step at the time will work for you.
# 5  
Old 11-22-2010
Hi all, and thanks dhzdh for your reply...

I think gcc never had been installed, or it has been removed some time ago. Yast offers the posibility of install it, look:
Code:
 |     |Name        |Avail. Vers.  |Inst. Vers.   |Summary                                    |Size      
 |  i  |cpp         |4.1.2_20070115|4.1.2_20070115|The GCC Preprocessor                       |     5.6 M|
 |     |gcc         |4.1.2_20070115|              |The GNU C Compiler and Support Files       |     1.8 M|
 |     |gcc-c++     |4.1.2_20070115|              |The GNU C++ Compiler                       |     6.3 M|
 |     |gcc-fortran |4.1.2_20070115|              |The GNU Fortran Compiler and Support Files |     8.0 M|
 |     |gcc-info    |4.1.2_20070115|              |GNU Info-Pages for GCC                     |     1.4 M|
 |     |gcc-java    |4.1.2_20070115|              |The GNU Java Compiler                      |     5.9 M|
 |     |gcc-locale  |4.1.2_20070115|              |Locale Data for the GNU Compiler Collection|     4.9 M|
 |     |gcc-obj-c++ |4.1.2_20070115|              |GNU Objective C++ Compiler                 |     6.1 M|
 |     |gcc-objc    |4.1.2_20070115|              |GNU Objective C Compiler                   |     6.0 M|
 |  i  |libgcc      |4.1.2_20070115|4.1.2_20070115|C compiler runtime library                 |    98.6 K|
 |     |libgcj      |4.1.2_20070115|              |Java Runtime Library for gcc               |    38.9 M|
 |     |libgcj-32bit|4.1.2_20070115|              |Java Runtime Library for gcc               |    21.4 M|

How can install it without the installation CDs/DVDs? I can't download any working package from any web site, the dependencies are killing me.


Thanks in advance again...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

I can't compile (gcc) in Solaris 11.3 non global zone

I can't compile anything, the final make error says "Command failed for target `install-recursive'", but I am not able to identify the root cause of that error, I tried with cc, gcc 4.5, also gcc 5.2, using make, using gmake 3.82, ld 5.11, gld 2.31... and I am totally stuck yet... please help, to... (4 Replies)
Discussion started by: sugar222
4 Replies

2. Red Hat

How to compile httpd using gcc in RHEL?

Hi All, I am trying to compile httpd2.2.19 in RHEL5.5 using gcc version 4.1.2. This is first time I am trying to compile httpd in RHEL. I ran configure with below option ./configure --prefix=/usr/local/apache --enable-rewrite --enable-ssl=shared... (0 Replies)
Discussion started by: kalpeer
0 Replies

3. UNIX for Dummies Questions & Answers

Compiling gcc to compile make to compile yaboot

I have just installed OpenBSD on a 333MHz PPC iMac G3. It has a 6GB HDD that has been partitioned as 1GB MacOS 8.5.1, 3GB MacOS X 10.3.9, 2GB OpenBSD 4.8. I now need to install a bootloader so that my computer can recognize the OpenBSD partition at startup. I have been trying to install... (0 Replies)
Discussion started by: t04st3r
0 Replies

4. Solaris

GCC install

well, i know wich GCC can be download by Manager package, easy! but I want install gcc "whith myself hands" I have gcc .tar and i cant install by console. after comand $make: erro ok! i dont have compiler, but i want install gcc! sorry my english... (6 Replies)
Discussion started by: Hyagosallet
6 Replies

5. AIX

Compile gcc on AIX 5.2

I'm trying to compile gcc 3.4.6 on AIX 5.2 but I get this error: bison -t --name-prefix=java_ -o java/parse.c java/parse.y M4sugar requires GNU M4. Install it before installing M4sugar or set the M4 environment variable to its path name.make: *** Broken pipe gcc -c -g -O2 -DIN_GCC -W... (7 Replies)
Discussion started by: untamed
7 Replies

6. Programming

New to C/gcc compiler - compile error.

I am new to comiling c/c++ programs with gcc compilier unix - AIX version 5.3 gcc compiler version - 4.0.0 My makefile. # makefile 1.0 08/20/98 #CC = cc CC = gcc ESQL = esql CFLAGS = -Wall DBSLIB= DBSLIB=-L${INFORMIXDIR}/lib/esql -L${INFORMIXDIR}/lib `esql -libs` ALL = hds_near... (9 Replies)
Discussion started by: anish
9 Replies

7. Programming

How to compile a c program by using gcc

Hi all, Yeasterday I try to compile c program by using cygwin. I just find an errors the fist one is concerinig about the end of the line. To summit my Assignment which is the day after tommorow I have to compile my c program by using just gcc. If any one know what do I have to... (5 Replies)
Discussion started by: Bell
5 Replies

8. AIX

RS/6000 gcc compile large file error

hi, everybody£º i have a question, pls help me¡£ OS : RS/6000 AIX 4.3.3 cPU : Powerpc,POWER3 compiler : gcc 3.2.3 source file £º 8M OS kernel : 32 bit (selecting at installing operating system, the hardware support 64 bit) when i compiling the large source file (8 M), i... (3 Replies)
Discussion started by: q30
3 Replies

9. Programming

Error in compile C by gcc

Hi all, I compile my c program and get following result hrnpfc01.c:1387: stray '\' in program hrnpfc01.c:1387: parse error before `,' hrnpfc01.c:1388: stray '\' in program hrnpfc01.c:1388: parse error before `,' hrnpfc01.c:1396: stray '\' in program hrnpfc01.c:1396: parse error before... (4 Replies)
Discussion started by: zico
4 Replies

10. Programming

How to compile using gcc...

I need to know how to make a binary with gcc. I know how to create an obj file, but I'm not quite sure what to do about the linking part. I've gotten this far "gcc -c somefile.c somefile.o" then I'm left with an object file, but I don't see any linking command line options. Does anyone know how... (4 Replies)
Discussion started by: lilprogrammer
4 Replies
Login or Register to Ask a Question