LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-04-2005, 06:16 PM   #1
Izza
LQ Newbie
 
Registered: Sep 2005
Posts: 8

Rep: Reputation: 0
problems compiling C codes in RH9


I have a program called CVIPtools. It works fine on 7.3, but 7.3 is giving me trouble booting my WINXP, so I decided to switch to RH9 instead.

The thing is, whenever I try to compile some of my C codes on RH9, it keeps giving me errors such as

undefined reference to 'errno'
undefined reference to '__ctype_b'
undefined reference to '_xstat'

I'm guessing that it's not linking properly to errno.h or ctype.h. I ran a search for errno.h and ctype.h and took note of the path. I added the complete path #include </path/whatever.h>, compiled, and got the same errors. O_o

Okay, now, I looked for solutions online, but none of them worked so far. I thought updating my glibc to 2.3.2-27.etcetera would fix this problem. It didn't. And then I came across a thread saying that compiling works fine with glibc-2.3.2-5... Problem is, this glibc only comes with the RH9 CDs that are purchased, not downloaded.

I tried looking for it on rpmfind.net and other rpm sites, but couldn't find any.

So, does anybody have a solution to my problem as to how I can compile correctly?

If not, does anyone know where I can get the glibc-2.3.2-5 as well as the glibc-common packages?

Thanks much!
 
Old 09-04-2005, 08:19 PM   #2
kz26
Member
 
Registered: Aug 2005
Location: USA
Distribution: Fedora, Ubuntu, Backtrack
Posts: 70

Rep: Reputation: 15
Why RH9? Maybe you would have more luck with your problem if you used a 2.6 kernel distro, like Fedora Core 4.
 
Old 09-04-2005, 08:33 PM   #3
Izza
LQ Newbie
 
Registered: Sep 2005
Posts: 8

Original Poster
Rep: Reputation: 0
It doesn't work on FC3 either, but I haven't tried on FC4 yet.

The thing is, I read from bugzilla that glibc packages on RH9 upwards have this problem. They say that it's not a bug because Redhat did it intentionally, and that everything's supposed to be just fine if I installed glibc-2.3.2-27...

I wanted to work with RH9 because its next to 7.3 on the ladder (I'm not counting 8.0).

Er... has nobody ever encountered this error message before?
 
Old 09-06-2005, 01:34 AM   #4
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
It's actually a Gcc link error: you're not finding the C runtime library

Actually, it sounds like a link error to me.

1. Here's a simple "hello world":
Code:
#include <stdio.h>
#include <ctype.h>
#include <errno.h>

int
main (int argc, char *argv[])
{
  printf ("error= %d, isspace ('A')= %d\n",
    errno, isspace('A') );
  return 0;
}
2. Here are the libc externs it expects to be able to resolve at runtime:
Quote:
ls -l hello
-rwxr-xr-x 1 paulsm users 8026 2005-09-05 23:49 hello

nm hello
080496f4 A __bss_start
080483b4 t call_gmon_start
080496f4 b completed.1
080495f0 d __CTOR_END__
080495ec d __CTOR_LIST__
U __ctype_b_loc@@GLIBC_2.3
<= HERE'S AN EXTERNAL REFERENCE TO OUR FRIEND "CTYPE_B"...
...
U __errno_location@@GLIBC_2.0
<= AND HERE'S "ERRNO"..
...

ldd hello
linux-gate.so.1 => (0xffffe000)
libc.so.6 => /lib/tls/libc.so.6 (0x40035000)
/lib/ld-linux.so.2 (0x40000000)
<= AND THESE ARE THE RUNTIME FILES IT EXPECTS TO RESOLVE THEM FROM
My guess is that you probably don't have a "libc" that your Gcc can find.

I'm assuming that your source program is .c ('C'), and not .cpp (C++).

But either way, try verifying that you have the right gcc libraries installed. Your surest bet, of course, is to de-install and completely re-install Gcc itself.

Your .. PSM
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Are the hex codes for colors in a jpg the same codes as used in html? abefroman Linux - Security 3 07-31-2005 03:21 PM
RH9 - ASCII codes using alt-gr ? manub Red Hat 0 03-14-2004 04:24 AM
problems compiling from source in RH9 smirnoff Linux - Newbie 13 01-21-2004 09:11 AM
Wine, Compiling Problems, and RH9 SUCKS! thcmwz Linux - Software 2 11-07-2003 11:14 AM
Have anyone experimented problems compiling programs in rh9? mkaman Red Hat 2 10-31-2003 10:41 AM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration