C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 04-26-2002, 05:39 AM   #1
Registered User
 
Join Date: Nov 2001
Posts: 25
gcc problem

Hi,
has anyone ever come accross a problem with gcc not compiling the libary functions properly on a linux server? By this I mean the includes at the top of the program giving compililation errors for some reason. I'm having my website hosted with a web hosting company at the moment and their gcc for some reason has all these compilation errors come up from the functions in the libary includes. Such as:
<stdio.h>
<stdlib.h>
etc etc.
The poor guys working around the clock trying to fix this are obviously pulling their hair out trying to find out whats the cause of the problem.
Anyone had this problem before and know what the cause is? Know how to fix it? Or have any words of wisdom to perhaps lead them in the right direction?
Thanks in advance,
Brett Deason
bjdea1 is offline   Reply With Quote
Old 04-26-2002, 05:56 AM   #2
B26354
 
Deckard's Avatar
 
Join Date: Jan 2002
Posts: 631
Hi Brett,

You've got my curiosity piqued. Paste some of those errors in here :)
__________________
Jason Deckard
Deckard is offline   Reply With Quote
Old 04-26-2002, 06:07 AM   #3
Registered User
 
Join Date: Nov 2001
Posts: 25
follow up on gcc problem

Their server/system was working fine a few days ago and suddenly it came up with the below problem when compiling??? Anyway here are the errors from one of my scripts - it appears the libary function themselves are corrupted???

bash$ gcc search.c -o search.cgi
In file included from /usr/include/stdio.h:57,
from search.c:9:
/usr/include/libio.h:214: parse error before `__off_t'
/usr/include/libio.h:214: warning: no semicolon at end of struct or union
/usr/include/libio.h:233: parse error before `_offset'
/usr/include/libio.h:233: warning: data definition has no type or storage class
/usr/include/libio.h:237: parse error before `}'
/usr/include/libio.h:262: parse error before `__io_read_fn'
/usr/include/libio.h:263: warning: data definition has no type or storage class
/usr/include/libio.h:271: parse error before `__io_write_fn'
/usr/include/libio.h:272: warning: data definition has no type or storage class
/usr/include/libio.h:280: parse error before `__off_t'
/usr/include/libio.h:367: parse error before `_IO_padn'
/usr/include/libio.h:367: parse error before `__ssize_t'
/usr/include/libio.h:367: warning: data definition has no type or storage class
/usr/include/libio.h:370: parse error before `_IO_seekoff'
/usr/include/libio.h:370: parse error before `__off64_t'
/usr/include/libio.h:370: warning: data definition has no type or storage class
/usr/include/libio.h:371: parse error before `_IO_seekpos'
/usr/include/libio.h:371: parse error before `__off64_t'
/usr/include/libio.h:371: warning: data definition has no type or storage class
In file included from search.c:9:
/usr/include/stdio.h:61: parse error before `fpos_t'
/usr/include/stdio.h:61: warning: data definition has no type or storage class
In file included from search.c:9:
/usr/include/stdio.h:477: parse error before `off_t'
/usr/include/stdio.h:477: warning: data definition has no type or storage class
/usr/include/stdio.h:500: parse error before `fpos_t'
/usr/include/stdio.h:502: parse error before `*'
In file included from /usr/include/stdlib.h:339,
from search.c:10:
/usr/include/sys/types.h:33: parse error before `u_char'
/usr/include/sys/types.h:33: warning: data definition has no type or storage class
/usr/include/sys/types.h:34: parse error before `u_short'
/usr/include/sys/types.h:34: warning: data definition has no type or storage class
/usr/include/sys/types.h:35: parse error before `u_int'
/usr/include/sys/types.h:35: warning: data definition has no type or storage class
/usr/include/sys/types.h:36: parse error before `u_long'
/usr/include/sys/types.h:36: warning: data definition has no type or storage class
/usr/include/sys/types.h:37: parse error before `quad_t'
/usr/include/sys/types.h:37: warning: data definition has no type or storage class
/usr/include/sys/types.h:38: parse error before `u_quad_t'
/usr/include/sys/types.h:38: warning: data definition has no type or storage class
/usr/include/sys/types.h:39: parse error before `fsid_t'
/usr/include/sys/types.h:39: warning: data definition has no type or storage class
/usr/include/sys/types.h:42: parse error before `loff_t'
/usr/include/sys/types.h:42: warning: data definition has no type or storage class
/usr/include/sys/types.h:46: parse error before `ino_t'
/usr/include/sys/types.h:46: warning: data definition has no type or storage class
/usr/include/sys/types.h:58: parse error before `dev_t'
/usr/include/sys/types.h:58: warning: data definition has no type or storage class
/usr/include/sys/types.h:63: parse error before `gid_t'
/usr/include/sys/types.h:63: warning: data definition has no type or storage class
/usr/include/sys/types.h:68: parse error before `mode_t'
/usr/include/sys/types.h:68: warning: data definition has no type or storage class
/usr/include/sys/types.h:73: parse error before `nlink_t'
/usr/include/sys/types.h:73: warning: data definition has no type or storage class
/usr/include/sys/types.h:78: parse error before `uid_t'
/usr/include/sys/types.h:78: warning: data definition has no type or storage class
/usr/include/sys/types.h:96: parse error before `pid_t'
/usr/include/sys/types.h:96: warning: data definition has no type or storage class
/usr/include/sys/types.h:101: parse error before `id_t'
/usr/include/sys/types.h:101: warning: data definition has no type or storage class
/usr/include/sys/types.h:105: parse error before `ssize_t'
/usr/include/sys/types.h:105: warning: data definition has no type or storage class
/usr/include/sys/types.h:110: parse error before `daddr_t'
/usr/include/sys/types.h:110: warning: data definition has no type or storage class
/usr/include/sys/types.h:111: parse error before `caddr_t'
/usr/include/sys/types.h:111: warning: data definition has no type or storage class
/usr/include/sys/types.h:115: parse error before `key_t'
/usr/include/sys/types.h:115: warning: data definition has no type or storage class
In file included from /usr/include/sys/types.h:122,
from /usr/include/stdlib.h:339,
from search.c:10:
/usr/include/time.h:71: parse error before `time_t'
/usr/include/time.h:71: warning: data definition has no type or storage class
In file included from /usr/include/sys/types.h:194,
from /usr/include/stdlib.h:339,
from search.c:10:
/usr/include/sys/select.h:48: parse error before `fd_mask'
/usr/include/sys/select.h:48: warning: data definition has no type or storage class
/usr/include/sys/select.h:51: parse error before `fd_set'
/usr/include/sys/select.h:51: warning: data definition has no type or storage class
/usr/include/sys/select.h:74: parse error before `__fd_set'
/usr/include/sys/select.h:77: parse error before `__fd_set'
In file included from /usr/include/stdlib.h:339,
from search.c:10:
/usr/include/sys/types.h:203: parse error before `blkcnt_t'
/usr/include/sys/types.h:203: warning: data definition has no type or storage class
/usr/include/sys/types.h:204: parse error before `fsblkcnt_t'
/usr/include/sys/types.h:204: warning: data definition has no type or storage class
/usr/include/sys/types.h:205: parse error before `fsfilcnt_t'
/usr/include/sys/types.h:205: warning: data definition has no type or storage class
In file included from search.c:12:
/usr/include/ctype.h:76: parse error before `*'
/usr/include/ctype.h:76: warning: data definition has no type or storage class
/usr/include/ctype.h:77: parse error before `*'
/usr/include/ctype.h:77: warning: data definition has no type or storage class


Any ideas? Thanks for your interest,
Brett Deason
bjdea1 is offline   Reply With Quote
Old 04-26-2002, 06:16 AM   #4
B26354
 
Deckard's Avatar
 
Join Date: Jan 2002
Posts: 631
May I see the first 30 lines of search.c, please?

[edit]
Actually, just attach the whole thing and I'll try it on my compiler here. Thanks.
[/edit]
__________________
Jason Deckard

Last edited by Deckard; 04-26-2002 at 06:20 AM.
Deckard is offline   Reply With Quote
Old 04-26-2002, 06:25 AM   #5
Registered User
 
Join Date: Nov 2001
Posts: 25
first 30 lines or so of search.c

Note : the same problem exists with other scripts as well which all used to compile before. Anyway here's the start of the code:

//
//Telescopemaking.com Search Directory
//Written by Brett Deason
//Language = C
//Date : 11/09/01
//-----------------------------------------------------------------------------------------


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>

#define SEARCHDATA "/home/bjdea1/search/"

//Global Variables
char html[70000]={'\x00'};
char numsites[5]={'\x00'};
char input_string[1000]={'\x00'};
char tempb[3000]={'\x00'};
char input_flag='0';
char plugin_html[30000]={'\x00'};
char search_file[60000]={'\x00'};
struct category
{
char name[50];
} categories[20][20][20];
int num_cat[20][20]={0};
struct result
{
char url[300];
char title[400];
char description[400];
double score;
char vendor;
char country[10];
struct result *next;
} temp[50];

typedef struct result RESULT

RESULT *results;

//---------------------------------------------------



The rest contains the actual coding - functions
bjdea1 is offline   Reply With Quote
Old 04-26-2002, 07:01 AM   #6
Registered User
 
Join Date: Nov 2001
Posts: 25
Reply

Um, prefer not to attach all the code - its 3000 or so lines of code which I spent months on. I want to sell the script some time in the future. I'd be giving it away by putting it on the C board here. Also I am 100% sure its not the code - I have the same problem with about 10 other scripts which all compiled previously without any problem. Is it possible the code I've written is what triggered this problem? I hope not.
bjdea1 is offline   Reply With Quote
Old 04-26-2002, 08:22 AM   #7
B26354
 
Deckard's Avatar
 
Join Date: Jan 2002
Posts: 631
No, I don't suspect the code; however, it seemed foolish to not check.

You mentioned that some code no longer compiles, although it used to compile just fine on the system. It seems reasonable to me that a configuration change has been made on the system you are trying to compile it on. This may be a new version of the C library or compiler, or simply a change in an environment variable used by gcc.

I think this is a problem the system admins will have to resolve on their own.
__________________
Jason Deckard
Deckard is offline   Reply With Quote
Old 04-26-2002, 09:17 AM   #8
Blank
 
Join Date: Aug 2001
Posts: 1,034
Code:
#include <stdio.h>

int main(void)
{
        printf("Hello World!\n");
        return 0;
}
If this doesn't compile I'm pretty sure the problems in
the .h files.

Quote:
/usr/include/libio.h:214: warning: no semicolon at end of struct or union
You might want to check libio.h:214
Nick is offline   Reply With Quote
Old 04-26-2002, 05:59 PM   #9
Comment your source code!
 
Lynux-Penguin's Avatar
 
Join Date: Apr 2002
Posts: 533
This is my theory but it looks like there are no libraries on that computer.
Like when I wanted to compile my cryptography programs I needed to find the .so files
and when I didnt use -lcrypt it said similar things so maybe gcc is not being pointed to the .so's or the includes are messed up.
Get a clean copy of stdio.h and compare it with /usr/include/stdio.h

try compiling something that doesnt even function just
Code:
#include <stdio.h>
int main()
{
      return 0;
}
if it compiles, then try adding small portions of code until you find the problem.
__________________
Asking the right question is sometimes more important than knowing the answer.
Please read the FAQ
C Reference Card (A MUST!)
Pointers and Memory
The Essentials
CString lib
Lynux-Penguin is offline   Reply With Quote
Old 04-26-2002, 06:03 PM   #10
Comment your source code!
 
Lynux-Penguin's Avatar
 
Join Date: Apr 2002
Posts: 533
I have another theory, even though this is totally stupid, could you do me a favor and print out 218 - 300 lines of code...
(This happened once before when the compiler got the comments and things mixed up)
oh and try this
(if this doesn't work, the interpreter is not working or found the error in the code, not the compiler)

gcc -S [filename] [source.c]
if it does work then try to link and compile the assembly by hand. But this is really too much effort, and I would recomend trying with smaller programs first.
__________________
Asking the right question is sometimes more important than knowing the answer.
Please read the FAQ
C Reference Card (A MUST!)
Pointers and Memory
The Essentials
CString lib
Lynux-Penguin is offline   Reply With Quote
Old 04-26-2002, 07:27 PM   #11
Registered User
 
Join Date: Nov 2001
Posts: 25
got that

I tried the small program you showed and it gave the same problem. I also tried gcc -S and it still gave the same problem. I'm looking at the stdio.h file now. I think I do see some problems - this will take a while. I'll write another post back here once I've looked at it properly.
To be honest I'm thinking I'll just find another host :-).
bjdea1 is offline   Reply With Quote
Old 04-26-2002, 07:49 PM   #12
Comment your source code!
 
Lynux-Penguin's Avatar
 
Join Date: Apr 2002
Posts: 533
The host you have probably doesnt have the correct .so files or in respective
gcc is the most FUBAR program in the world for that machine.

that I am sure of!
__________________
Asking the right question is sometimes more important than knowing the answer.
Please read the FAQ
C Reference Card (A MUST!)
Pointers and Memory
The Essentials
CString lib
Lynux-Penguin is offline   Reply With Quote
Old 04-27-2002, 09:08 PM   #13
In The Light
 
Join Date: Oct 2001
Posts: 598
howdy,
what version of gcc is the server using, i understand that 2.96 is a bit buggy and that the original release of 3.01 had some problems as well.

M.R.
itld is offline   Reply With Quote
Old 04-29-2002, 06:51 PM   #14
Registered User
 
Join Date: Nov 2001
Posts: 25
hi all and thnks

Just saying thanks for all your input,
The final solution has been to change hosts. Actually this has turned out for the best. I've found a much cheaper and more professionally set up host provider.
Regards,
Brett Deason
www.telescopemaking.com
www.deasoft.com
bjdea1 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick Compilation Question chacham15 C Programming 10 10-12-2008 08:15 PM
Profiler Valgrind afflictedd2 C++ Programming 4 07-18-2008 09:38 AM
How does compiler/linker such as GCC decide to start locating the appropriate library shong9 C Programming 4 09-02-2007 08:47 PM
searching problem DaMenge C Programming 9 09-12-2005 01:04 AM
Bin packing problem.... 81N4RY_DR460N C++ Programming 0 08-01-2005 05:20 AM


All times are GMT -6. The time now is 01:04 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22