https://issues.apache.org/bugzilla/show_bug.cgi?id=54617

            Bug ID: 54617
           Summary: util.c, line 2809: error: syntax error before or at: *
           Product: Apache httpd-2
           Version: 2.4.4
          Hardware: Sun
                OS: Solaris
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Build
          Assignee: [email protected]
          Reporter: [email protected]
    Classification: Unclassified

Created attachment 29999
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29999&action=edit
as seen on the xterm

A new function ap_get_sload exists in server/util.c which receives a pointer
to a parameter ld of type struct ap_sload_t, which is also new and defined
in include/httpd.h thus : 


/**
 * @struct ap_sload_t
 * @brief  A structure to hold server load params
 */
typedef struct ap_sload_t ap_sload_t;
struct ap_sload_t {
    /* percentage of process/threads ready/idle (0->100)*/
    int idle;
    /* percentage of process/threads busy (0->100) */
    int busy;
    /* total bytes served */
    apr_off_t bytes_served;
    /* total access count */
    unsigned long access_count;
};


My attempt to compile Apache 2.4.4 results in this syntax error : 

/usr/local/build/libtool --silent --mode=compile /opt/solarisstudio12.3/bin/cc
-D_STDC_C99=    -errfmt=error -erroff=%none -errshort=full -xstrconst -xildoff
-m64 -xmemalign=8s -xnolibmil -Xa -xcode=pic32 -xregs=no%appl -xlibmieee -mc -g
-xs -ftrap=%none -Qy -xbuiltin=%none -xdebugformat=dwarf -xunroll=1
-xtarget=ultraT2 -xcache=8/16/4:4096/64/16    -DSOLARIS2=10 -D_REENTRANT 
-I/usr/local/include -I/usr/local/ssl/include -D_TS_ERRNO
-D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE   -I.
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/os/unix
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/include
-I/usr/local/include/apr-1 -I/usr/local/include
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/modules/aaa
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/modules/cache
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/modules/core
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/modules/database
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/modules/filters
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/modules/ldap
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/modules/loggers
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/modules/lua
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/modules/proxy
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/modules/session
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/modules/ssl
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/modules/test
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/server
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/modules/arch/unix
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/modules/dav/main
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/modules/generators
-I/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/modules/mappers 
-prefer-non-pic -static -c util.c && touch util.lo
"util.c", line 2809: error: syntax error before or at: *
"util.c", line 2818: error: undefined symbol: ld
"util.c", line 2818: error: undefined struct/union member: idle
"util.c", line 2818: error: left operand of "->" must be pointer to
struct/union
"util.c", line 2819: error: undefined struct/union member: busy
"util.c", line 2819: error: left operand of "->" must be pointer to
struct/union
"util.c", line 2820: error: left operand of "->" must be pointer to
struct/union
"util.c", line 2821: error: left operand of "->" must be pointer to
struct/union
"util.c", line 2851: error: left operand of "->" must be pointer to
struct/union
"util.c", line 2852: error: left operand of "->" must be pointer to
struct/union
"util.c", line 2859: error: left operand of "->" must be pointer to
struct/union
"util.c", line 2860: error: left operand of "->" must be pointer to
struct/union
"util.c", line 2864: error: syntax error before or at: *
"util.c", line 2867: error: undefined symbol: ld
"util.c", line 2867: error: undefined struct/union member: loadavg
"util.c", line 2867: error: left operand of "->" must be pointer to
struct/union
"util.c", line 2868: error: undefined struct/union member: loadavg5
"util.c", line 2868: error: left operand of "->" must be pointer to
struct/union
"util.c", line 2869: error: undefined struct/union member: loadavg15
"util.c", line 2869: error: left operand of "->" must be pointer to
struct/union
cc: acomp failed for util.c
gmake[2]: *** [util.lo] Error 1
gmake[2]: Leaving directory
`/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/server'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory
`/usr/local/build/httpd-2.4.4_SunOS5.10_sparcv9.001/server'
gmake: *** [all-recursive] Error 1


A quick diff between 2.4.3 and 2.4.4 on util.c shows : 

$ diff ../../httpd-2.4.3_SunOS5.10_sparcv9.001/server/util.c util.c
64a65,67
> #ifdef HAVE_SYS_LOADAVG_H
> #include <sys/loadavg.h>
> #endif
65a69,70
> #include "ap_mpm.h"
> 
276,277c281,284
< 
<     if (ap_regcomp(preg, pattern, cflags)) {
---
>     int err = ap_regcomp(preg, pattern, cflags);
>     if (err) {
>         if (err == AP_REG_ESPACE)
>             ap_abort_on_oom();
428c435
<         if (vb->buf && vb->strlen == AP_VARBUF_UNKNOWN)
---
>         if (vb->strlen == AP_VARBUF_UNKNOWN)
1095a1103
>     apr_size_t new_len;
1098a1107,1117
>     if (vb->strlen == AP_VARBUF_UNKNOWN)
>         vb->strlen = strlen(vb->buf);
>     if (vb->avail - vb->strlen < 3) {
>         new_len = vb->avail * 2;
>         if (new_len > max_len)
>             new_len = max_len;
>         else if (new_len < 3)
>             new_len = 3;
>         ap_varbuf_grow(vb, new_len);
>     }
> 
1100d1118
<         apr_size_t new_len;
1942a1961,1972
> AP_DECLARE(void) ap_bin2hex(const void *src, apr_size_t srclen, char *dest)
> {
>     const unsigned char *in = src;
>     apr_size_t i;
> 
>     for (i = 0; i < srclen; i++) {
>         *dest++ = c2x_table[in[i] >> 4];
>         *dest++ = c2x_table[in[i] & 0xf];
>     }
>     *dest = '\0';
> }
> 
2585a2616,2617
>     AP_DEBUG_ASSERT(vb->strlen == AP_VARBUF_UNKNOWN || vb->avail >= 
> vb->strlen);
> 
2704a2737,2738
>         if (buf->strlen == AP_VARBUF_UNKNOWN)
>             buf->strlen = strlen(buf->buf);
2706,2707c2740
<         vec[i].iov_len = (buf->strlen == AP_VARBUF_UNKNOWN) ? buf->avail
<                                                             : buf->strlen;
---
>         vec[i].iov_len = buf->strlen;
2773a2807,2887
> }
> 
> AP_DECLARE(void) ap_get_sload(ap_sload_t *ld)
> {
>     int i, j, server_limit, thread_limit;
>     int ready = 0;
>     int busy = 0;
>     int total;
>     ap_generation_t mpm_generation;
> 
>     /* preload errored fields, we overwrite */
>     ld->idle = -1;
>     ld->busy = -1;
>     ld->bytes_served = 0;
>     ld->access_count = 0;
> 
>     ap_mpm_query(AP_MPMQ_GENERATION, &mpm_generation);
>     ap_mpm_query(AP_MPMQ_HARD_LIMIT_THREADS, &thread_limit);
>     ap_mpm_query(AP_MPMQ_HARD_LIMIT_DAEMONS, &server_limit);
> 
>     for (i = 0; i < server_limit; i++) {
>         process_score *ps;
>         ps = ap_get_scoreboard_process(i);
> 
>         for (j = 0; j < thread_limit; j++) {
>             int res;
>             worker_score *ws = NULL;
>             ws = &ap_scoreboard_image->servers[i][j];
>             res = ws->status;
> 
>             if (!ps->quiescing && ps->pid) {
>                 if (res == SERVER_READY && ps->generation == mpm_generation) {
>                     ready++;
>                 }
>                 else if (res != SERVER_DEAD &&
>                          res != SERVER_STARTING && res != SERVER_IDLE_KILL &&
>                          ps->generation == mpm_generation) {
>                     busy++;
>                 }   
>             }
> 
>             if (ap_extended_status && !ps->quiescing && ps->pid) {
>                 if (ws->access_count != 0 
>                     || (res != SERVER_READY && res != SERVER_DEAD)) {
>                     ld->access_count += ws->access_count;
>                     ld->bytes_served += ws->bytes_served;
>                 }
>             }
>         }
>     }
>     total = busy + ready;
>     if (total) {
>         ld->idle = ready * 100 / total;
>         ld->busy = busy * 100 / total;
>     }
> }
> 
> AP_DECLARE(void) ap_get_loadavg(ap_loadavg_t *ld)
> {
>     /* preload errored fields, we overwrite */
>     ld->loadavg = -1.0;
>     ld->loadavg5 = -1.0;
>     ld->loadavg15 = -1.0;
> 
> #if HAVE_GETLOADAVG
>     {
>         double la[3];
>         int num;
> 
>         num = getloadavg(la, 3);
>         if (num > 0) {
>             ld->loadavg = (float)la[0];
>         }
>         if (num > 1) {
>             ld->loadavg5 = (float)la[1];
>         }
>         if (num > 2) {
>             ld->loadavg15 = (float)la[2];
>         }
>     }
> #endif
$ 

Not sure if anyone else has hit this but at the moment I can compile and run
2.4.3 on Solaris 10 with the Oracle Studio 12.3 compilers fine.  Apache HTTP
2.4.4 however stops with syntax error seen above.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to