happyfish100 / libfastcommon

c common functions library extracted from my open source project FastDFS. this library is very simple and stable. functions including: string, logger, chain, hash, socket, ini file reader, base64 encode / decode, url encode / decode, fast timer, skiplist, object pool etc. detail info please see the c header files.
http://bbs.chinaunix.net/forum-240-1.html
GNU Lesser General Public License v3.0
900 stars 529 forks source link

Error in compile on FreeBSD #7

Closed blodan closed 8 years ago

blodan commented 8 years ago

Hi!

I'm trying to compile this on FreeBSD as I'm going to upgrade from FastDFS 4.06 to FastDFS 5.08, but I'm running into these compile errors:

cc -Wall -D_FILE_OFFSET_BITS=64 -g -O3 -c -o system_info.o system_info.c system_info.c:61:13: error: use of undeclared identifier 'HW_MEMSIZE' mib[1] = HW_MEMSIZE; ^ system_info.c:595:20: error: invalid application of 'sizeof' to an incomplete type 'struct kinfo_proc' nproc = size / sizeof(struct kinfo_proc); ^ ~~~~~~~ system_info.c:569:12: note: forward declaration of 'struct kinfo_proc' struct kinfo_proc procs; ^ system_info.c:610:16: error: invalid application of 'sizeof' to an incomplete type 'struct kinfo_proc' size = sizeof(struct kinfo_proc) * nproc; ^ ~~~~~~~ system_info.c:569:12: note: forward declaration of 'struct kinfo_proc' struct kinfo_proc procs; ^ system_info.c:644:20: error: invalid application of 'sizeof' to an incomplete type 'struct kinfo_proc' nproc = size / sizeof(struct kinfo_proc); ^ ~~~~~~~ system_info.c:569:12: note: forward declaration of 'struct kinfo_proc' struct kinfo_proc *procs; ^ system_info.c:661:28: error: subscript of pointer to incomplete type 'struct kinfo_proc' "%s", procs[i].kp_proc.p_comm);


system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
    struct kinfo_proc *procs;
           ^
system_info.c:662:29: error: subscript of pointer to incomplete type 'struct kinfo_proc'
        process->pid = procs[i].kp_proc.p_pid;
                       ~~~~~^
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
    struct kinfo_proc *procs;
           ^
system_info.c:663:30: error: subscript of pointer to incomplete type 'struct kinfo_proc'
        process->ppid = procs[i].kp_eproc.e_ppid;
                        ~~~~~^
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
    struct kinfo_proc *procs;
           ^
system_info.c:664:35: error: subscript of pointer to incomplete type 'struct kinfo_proc'
        process->starttime = procs[i].kp_proc.p_starttime;
                             ~~~~~^
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
    struct kinfo_proc *procs;
           ^
system_info.c:665:31: error: subscript of pointer to incomplete type 'struct kinfo_proc'
        process->flags = procs[i].kp_proc.p_flag;
                         ~~~~~^
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
    struct kinfo_proc *procs;
           ^
system_info.c:666:31: error: subscript of pointer to incomplete type 'struct kinfo_proc'
        process->state = procs[i].kp_proc.p_stat;
                         ~~~~~^
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
    struct kinfo_proc *procs;
           ^
system_info.c:668:35: error: subscript of pointer to incomplete type 'struct kinfo_proc'
        process->sigignore = procs[i].kp_proc.p_sigignore;
                             ~~~~~^
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
    struct kinfo_proc *procs;
           ^
system_info.c:669:34: error: subscript of pointer to incomplete type 'struct kinfo_proc'
        process->sigcatch = procs[i].kp_proc.p_sigcatch;
                            ~~~~~^
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
    struct kinfo_proc *procs;
           ^
system_info.c:670:34: error: subscript of pointer to incomplete type 'struct kinfo_proc'
        process->priority = procs[i].kp_proc.p_priority;
                            ~~~~~^
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
    struct kinfo_proc *procs;
           ^
system_info.c:691:19: error: variable has incomplete type 'struct xsw_usage'
        struct xsw_usage sw_usage;
                         ^
system_info.c:691:9: note: forward declaration of 'struct xsw_usage'
        struct xsw_usage sw_usage;
               ^
system_info.c:697:11: error: use of undeclared identifier 'VM_LOADAVG'
        mib[1] = VM_LOADAVG;
                 ^
system_info.c:727:24: error: invalid application of 'sizeof' to an incomplete type 'struct kinfo_proc'
                info->procs = size / sizeof(struct kinfo_proc);
                                     ^     ~~~~~~~~~~~~~~~~~~~
system_info.c:727:38: note: forward declaration of 'struct kinfo_proc'
                info->procs = size / sizeof(struct kinfo_proc);
                                                   ^
system_info.c:734:11: error: use of undeclared identifier 'VM_METER'
        mib[1] = VM_METER;
                 ^
system_info.c:752:11: error: use of undeclared identifier 'VM_SWAPUSAGE'
        mib[1] = VM_SWAPUSAGE;
                 ^

Am I missing some dependencies or what can I do to solve this?
happyfish100 commented 8 years ago

bug fixed. compile passed in FreeBSD 10.2 thanks for your feedback.

blodan commented 8 years ago

Seems to be working properly now, thanks for the fast fix! :)