Thread: gcc problem

  1. #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

  2. #2
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    Hi Brett,

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

  3. #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

  4. #4
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    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]
    Last edited by Deckard; 04-26-2002 at 06:20 AM.
    Jason Deckard

  5. #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

  6. #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.

  7. #7
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    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

  8. #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.

    /usr/include/libio.h:214: warning: no semicolon at end of struct or union
    You might want to check libio.h:214

  9. #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

  10. #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

  11. #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 :-).

  12. #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

  13. #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.

  14. #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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quick Compilation Question
    By chacham15 in forum C Programming
    Replies: 10
    Last Post: 10-12-2008, 08:15 PM
  2. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  3. Replies: 4
    Last Post: 09-02-2007, 08:47 PM
  4. searching problem
    By DaMenge in forum C Programming
    Replies: 9
    Last Post: 09-12-2005, 01:04 AM
  5. Bin packing problem....
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 0
    Last Post: 08-01-2005, 05:20 AM