LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   checking whether the C compiler (gcc ) works... no (https://www.linuxquestions.org/questions/linux-newbie-8/checking-whether-the-c-compiler-gcc-works-no-199614/)

Transition 06-30-2004 04:48 PM

checking whether the C compiler (gcc ) works... no
 
Hello all,

Working with a new installation of Slackware 10 and i'm trying to install the newest version of PHP5 RC3. Although, i'm getting the problem when i run the ./configure command that states...

checking whether the C compiler (gcc ) works... no

Well, i do indeed have gcc installed according to swaret..

Package gcc-3.3.4-i486-1 is already installed!
Package gcc-g++-3.3.4-i486-1 is already installed!
Package gcc-g77-3.3.4-i486-1 is already installed!
Package gcc-gnat-3.3.4-i486-2 is already installed!
Package gcc-java-3.3.4-i486-1 is already installed!
Package gcc-objc-3.3.4-i486-1 is already installed!

I'm trying to figure out how to fix this error. Please don't tell me to search, i've been searching for 5 hours. Please don't tell me to RTFM as i've read so many readme's i'm ready to puke.

Thanks

SciYro 06-30-2004 04:58 PM

maybe the includes (i got this problem a lot when i used LFS/Core linux, read the config.log for more info as to why it claimed it doesn't exist (might wanna search it as its probably a few thousand lines long)

Transition 06-30-2004 06:02 PM

Quote:

Originally posted by SciYro
maybe the includes (i got this problem a lot when i used LFS/Core linux, read the config.log for more info as to why it claimed it doesn't exist (might wanna search it as its probably a few thousand lines long)
Here's what the config.log file reads...

Code:

configure:1631: checking host system type
configure:1719: checking for gcc
configure:1832: checking whether the C compiler (gcc  ) works
configure:1848: gcc -o conftest    conftest.c  1>&5
/usr/lib/gcc-lib/i486-slackware-linux/3.3.4/../../../../i486-slackware-linux/bin
/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status
configure: failed program was:

#line 1843 "configure"
#include "confdefs.h"

main(){return(0);}


Dark_Helmet 06-30-2004 06:22 PM

go to a command line, and type this into a file named "simple.c":
Code:

#include <stdio.h>

int main()
{
  printf( "Hello World!\n" );

  return 0;
}

Then execute this command: gcc -o simple simple.c

What errors are reported? If it's a "command not found" error for gcc, then gcc is not located in the environment's PATH.

Transition 06-30-2004 06:27 PM

Quote:

Originally posted by Dark_Helmet
go to a command line, and type this into a file named "simple.c":
Code:

#include <stdio.h>

int main()
{
  printf( "Hello World!\n" );

  return 0;
}

Then execute this command: gcc -o simple simple.c

What errors are reported? If it's a "command not found" error for gcc, then gcc is not located in the environment's PATH.

root:/# simple.c:1:19: stdio.h: No such file or directory
-bash: simple.c:1:19:: command not found

Tinkster 06-30-2004 06:30 PM

It appears that swaret has fscked up the most basic
files that come with the compiler, you're obviously
missing headers (root:/# simple.c:1:19: stdio.h: No
such file or directory) and libraries (/ld: crt1.o: No
such file: No such file or directory)



Cheers,
Tink

Dark_Helmet 06-30-2004 06:38 PM

Okey dokey... now we're getting somewhere.

gcc works. The problem is, it can't find standard header files. In a nutshell, header files (like stdio.h) provide information on how to use code stored in libraries.

Now, from the command line, type: locate stdio.h

You may have to run updatedb (as root) to make sure the results locate gives you are up-to-date.

If you don't get anything back, then the installation of gcc didn't work so well. Those standard headers are needed for just about every program written.

If you do get some results back, check over the list. See if you can find one located at /usr/include. That is the most common place for those headers to be stored, and is the first place gcc will look for them.

<edit>
You type too quickly Tink ;)
</edit>

Tinkster 06-30-2004 06:53 PM

Quote:

Originally posted by Dark_Helmet

<edit>
You type too quickly Tink ;)
</edit>
I'm not fast, just terse ;)


Cheers,
Tink

Bruce Hill 06-30-2004 06:55 PM

God's last name is NOT damn!!!!! :tisk:

Transition 06-30-2004 09:32 PM

Quote:

Originally posted by Chinaman
God's last name is NOT damn!!!!! :tisk:
It would have been if he used linux.

Boow 06-30-2004 09:38 PM

do you have glibc installed which is in the l directory. why its not in d i dont know but you need it to compile c progs.

Dark_Helmet 06-30-2004 10:00 PM

If it were that glibc were missing, then the system would be completely shut down. Virtually every program on the system needs access to glibc everytime the program is run.

My money is still on the idea that something somehow either deleted the headers in /usr/include, renamed them, or did something equally sinister to prevent gcc from locating them.

Bruce Hill 06-30-2004 10:24 PM

Quote:

Originally posted by Transition
It would have been if he used linux.
Just so you realize you've been warned...

"You shall not misuse the name of the LORD your God, for the LORD
will not hold anyone guiltless who misuses his name." ~ Exodus 20:7

Transition 06-30-2004 10:35 PM

Quote:

Originally posted by Chinaman
Just so you realize you've been warned...

"You shall not misuse the name of the LORD your God, for the LORD
will not hold anyone guiltless who misuses his name." ~ Exodus 20:7

Whatever.. rm god

Bruce Hill 06-30-2004 10:37 PM

Quote:

Originally posted by Transition
Whatever.. rm god
God will say...

# mv Transition /hell

Transition 06-30-2004 10:40 PM

Quote:

Originally posted by Chinaman
God will say...

# mv Transition /hell

script will fail, god not found.

kevinalm 06-30-2004 11:02 PM

Getting back on topic...

I'm pretty sure studio.h and crt1.o are part of glibc. You don't need the glibc headers to run a linux system, only to compile c progs in a linux system. Actually, those headers are part of the kernel headers that glibc was compiled against iirc. Not to be confused with the headers for the running kernel you need in order to compile a kernel modules. Mandy and RH call that part of glibc glibc-dev or something like that. Never used slack so I don't know what they call it, went right to LFS/BLFS from rh myself.

Transition 06-30-2004 11:50 PM

Quote:

Originally posted by kevinalm
Getting back on topic...

I'm pretty sure studio.h and crt1.o are part of glibc. You don't need the glibc headers to run a linux system, only to compile c progs in a linux system. Actually, those headers are part of the kernel headers that glibc was compiled against iirc. Not to be confused with the headers for the running kernel you need in order to compile a kernel modules. Mandy and RH call that part of glibc glibc-dev or something like that. Never used slack so I don't know what they call it, went right to LFS/BLFS from rh myself.

Looks like stdio.h is already installed - but it's stuck in the following directory..

/usr/include/bits/stdio.h

How to i tell GCC that this is where the file is

kevinalm 07-01-2004 12:14 AM

stdio.h should also be in /usr/include/stdio.h . At least my system has it in both places. And I suspect they are not the same file. Just checked, they're not. /usr/include/stdio.h 22kb vs 5kb for /usr/include/bits/stdio.h. studio.h is a very basic include file. #include <stdio.h> is one of the first things you learn in c. If gcc can't find that then something is _really_ broken. My best guess is an incompletely installed developement system, most likely the glibc libraries are installed but not the glibc headers. Many distros split into runtime and "developement" packages on glibc and the kernel source. I think that's what's going on here.

FYI, Most of the gcc configuration is in /usr/lib/gcc-lib/<version>/specs but trust me, you _don't_ want to mess around in there.

XavierP 07-01-2004 03:04 AM

\\Mod Note: Please do not insult each other's beliefs - and stay on topic. Thank you.


All times are GMT -5. The time now is 05:45 AM.