PDA

View Full Version : gcc problem



bjdea1
04-26-2002, 05:39 AM
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

Deckard
04-26-2002, 05:56 AM
Hi Brett,

You've got my curiosity piqued. Paste some of those errors in here :)

bjdea1
04-26-2002, 06:07 AM
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

Deckard
04-26-2002, 06:16 AM
May I see the first 30 lines of search.c, please?


Actually, just attach the whole thing and I'll try it on my compiler here. Thanks.

bjdea1
04-26-2002, 06:25 AM
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
04-26-2002, 07:01 AM
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.

Deckard
04-26-2002, 08:22 AM
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.

Nick
04-26-2002, 09:17 AM
#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.



/usr/include/libio.h:214: warning: no semicolon at end of struct or union

You might want to check libio.h:214

Lynux-Penguin
04-26-2002, 05:59 PM
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


#include <stdio.h>
int main()
{
return 0;
}

if it compiles, then try adding small portions of code until you find the problem.

Lynux-Penguin
04-26-2002, 06:03 PM
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.

bjdea1
04-26-2002, 07:27 PM
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 :-).

Lynux-Penguin
04-26-2002, 07:49 PM
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!

itld
04-27-2002, 09:08 PM
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.

bjdea1
04-29-2002, 06:51 PM
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