LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   C compiler not working (https://www.linuxquestions.org/questions/linux-newbie-8/c-compiler-not-working-936518/)

ed01us 03-26-2012 10:40 AM

C compiler not working
 
Tried to run minicom onred hat enterprise 5.2, but this failed because gcc was not installed. Installed gcc, but now when I do ./configure, i get the following error:

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/admin/minicom-2.6.1':
configure: error: C compiler cannot create executables
See `config.log' for more details

Can someone help me figure out what is going on here?

crabboy 03-26-2012 10:46 AM

Create a simple c program and try to compile it. See what kind of error it gives you.

hello.c
Code:

#include <stdio.h>

main()
{
  printf("Hello World\n");
}

compile with: gcc hello.c

i92guboj 03-26-2012 10:47 AM

so...

Code:

See `config.log' for more details
It might throw some light into the issue. This can happen for many reasons, from an unconfigured environment to the wrong CFLAGS.

suicidaleggroll 03-26-2012 10:50 AM

How did you install gcc?

ed01us 03-26-2012 10:54 AM

configlog
 
Here's a partial output of the config log:


This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by minicom configure 2.6.1, which was
generated by GNU Autoconf 2.68. Invocation command line was

$ ./configure

## --------- ##
## Platform. ##
## --------- ##

hostname = new-host
uname -m = i686
uname -r = 2.6.18-238.el5
uname -s = Linux
uname -v = #1 SMP Sun Dec 19 14:24:47 EST 2010

/usr/bin/uname -p = unknown
/bin/uname -X = unknown

/bin/arch = i686
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown

PATH: /usr/kerberos/sbin
PATH: /usr/kerberos/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/X11R6/bin
PATH: /home/admin/bin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2312: checking for a BSD-compatible install
configure:2380: result: /usr/bin/install -c
configure:2391: checking whether build environment is sane
configure:2441: result: yes
configure:2582: checking for a thread-safe mkdir -p
configure:2621: result: /bin/mkdir -p
configure:2634: checking for gawk
configure:2650: found /usr/bin/gawk
configure:2661: result: gawk
configure:2672: checking whether make sets $(MAKE)
configure:2694: result: yes
configure:2823: checking for gcc
configure:2839: found /usr/bin/gcc
configure:2850: result: gcc
configure:3079: checking for C compiler version
configure:3088: gcc --version >&5
2.7.2.3
configure:3099: $? = 0
configure:3088: gcc -v >&5
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.7.2.3/specs
gcc version 2.7.2.3
configure:3099: $? = 0
configure:3088: gcc -V >&5
gcc: argument to `-V' is missing
configure:3099: $? = 1
configure:3088: gcc -qversion >&5
gcc: unrecognized option `-qversion'
gcc: No input files
configure:3099: $? = 1
configure:3119: checking whether the C compiler works
configure:3141: gcc conftest.c >&5
ld: crt1.o: No such file: No such file or directory
configure:3145: $? = 1
configure:3183: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "minicom"
| #define PACKAGE_TARNAME "minicom"
| #define PACKAGE_VERSION "2.6.1"
| #define PACKAGE_STRING "minicom 2.6.1"
| #define PACKAGE_BUGREPORT "minicom-devel@lists.alioth.debian.org"
| #define PACKAGE_URL ""
| #define PACKAGE "minicom"
| #define VERSION "2.6.1"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3188: error: in `/home/admin/minicom-2.6.1':
configure:3190: error: C compiler cannot create executables

ed01us 03-26-2012 10:56 AM

gcc installed from the following link through firefox:

http://rpmfind.net/linux/rpm2html/se...rise+5.2&arch=

crabboy 03-26-2012 11:06 AM

looks like the linker can't find a required library:

ld: crt1.o: No such file: No such file or directory

That file should be in /usr/lib. Try to re-install the compiler or find another package.

I haven't used minicom in over 15 years, brings back memories.

ed01us 03-26-2012 11:12 AM

Do you know any good package that I can use?

crabboy 03-26-2012 11:18 AM

Any reason you are building from source? I see a minicom for Redhat 4 i386

suicidaleggroll 03-26-2012 11:21 AM

Quote:

Originally Posted by ed01us (Post 4636680)
gcc installed from the following link through firefox:

http://rpmfind.net/linux/rpm2html/se...rise+5.2&arch=

It's VERY rare that you need to install directly from the RPM, especially for something as core as gcc. Chances are you installed gcc, but none of the libraries that it needs, which is why it doesn't work. Use YUM for this kind of thing.

I would start by removing the RPM you installed by hand, and issue a "yum install gcc" or similar. YUM probably has minicom as well:
Code:

yum list | grep -i minicom

Any time you want a program in any of the Redhat-based distros (RHEL, CentOS, Fedora), start by doing a "yum list | grep" to find if it's in yum. If it isn't, find the source. When you go to configure/compile the source, if you encounter any missing libraries or programs, again use yum to find and install them. 99% of the time you can use "yum provides" to find your missing library/binary.

knudfl 03-26-2012 11:24 AM

Quote:

Installed gcc
The default "Redhat EL 5.x" compiler is version 4.1.2.
( gcc version 2.7.2.3 is usually totally unusable for an OS from this century.)

Required packages, for gcc to be usable :
gcc, gcc-c++, glibc-devel-2.5-24, glibc-headers-2.5-24, kernel-headers-2.6.18-92
The shown versions are the old RHEL 5.2 versions.
Can be installed from your install DVD.
If you can use yum, glibc will be updated to version 2.5-81.el5_8.1.

.

ed01us 03-26-2012 12:17 PM

Thanks! I will try that.


All times are GMT -5. The time now is 04:02 AM.