mod_proxy_html.c: error: initializer element is not constant

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Aim: To compile mod_proxy_html.c in order to run Apache 2.0 under Windows XP as a proxy server to/from the web.
Compiler: MinGW Windows Compiler using GNU gcc-3.4.5

The compiler delivers error messages only concerned with the following function and only those array members marked /* ERROR*/. (The comment is of course inserted here to identify the error element and is not present in the C file.)

static const command_rec proxy_html_cmds[] = {
AP_INIT_ITERATE("ProxyHTMLStartParse", set_skipto, NULL,
  RSRC_CONF|ACCESS_CONF,
  "Ignore anything in front of the first of these elements"),
AP_INIT_ITERATE("ProxyHTMLEvents", set_events, NULL,
  RSRC_CONF|ACCESS_CONF, "Strings to be treated as scripting events"),
AP_INIT_ITERATE2("ProxyHTMLLinks", set_links, NULL,
  RSRC_CONF|ACCESS_CONF, "Declare HTML Attributes"),
AP_INIT_RAW_ARGS("ProxyHTMLURLMap", set_urlmap, NULL,
  RSRC_CONF|ACCESS_CONF, "Map URL From To" ) ,
AP_INIT_TAKE12("ProxyHTMLDoctype", set_doctype, NULL,
  RSRC_CONF|ACCESS_CONF, "(HTML|XHTML) [Legacy]" ) ,
AP_INIT_ITERATE("ProxyHTMLFixups", set_flags, NULL,
  RSRC_CONF|ACCESS_CONF, "Options are lowercase, dospath" ) ,
AP_INIT_FLAG("ProxyHTMLMeta", ap_set_flag_slot, /* ERROR*/
  (void*)APR_OFFSETOF(proxy_html_conf, metafix),
  RSRC_CONF|ACCESS_CONF, "Fix META http-equiv elements" ) ,
AP_INIT_FLAG("ProxyHTMLInterp", ap_set_flag_slot, /* ERROR*/
  (void*)APR_OFFSETOF(proxy_html_conf, interp),
  RSRC_CONF|ACCESS_CONF,
  "Support interpolation and conditions in URLMaps" ) ,
AP_INIT_FLAG("ProxyHTMLExtended", ap_set_flag_slot, /* ERROR*/
  (void*)APR_OFFSETOF(proxy_html_conf, extfix),
  RSRC_CONF|ACCESS_CONF, "Map URLs in Javascript and CSS" ) ,
AP_INIT_FLAG("ProxyHTMLStripComments", ap_set_flag_slot, /* ERROR*/
  (void*)APR_OFFSETOF(proxy_html_conf, strip_comments),
  RSRC_CONF|ACCESS_CONF, "Strip out comments" ) ,
#ifndef GO_FASTER
AP_INIT_FLAG("ProxyHTMLLogVerbose", ap_set_flag_slot, /* ERROR*/
  (void*)APR_OFFSETOF(proxy_html_conf, verbose),
  RSRC_CONF|ACCESS_CONF, "Verbose Logging (use with LogLevel Info)" ) ,
#endif
AP_INIT_TAKE1("ProxyHTMLBufSize", ap_set_int_slot, /* ERROR*/
  (void*)APR_OFFSETOF(proxy_html_conf, bufsz),
  RSRC_CONF|ACCESS_CONF, "Buffer size" ) ,
AP_INIT_ITERATE2("ProxyHTMLCharsetAlias", set_charset_alias, NULL, /* ERROR*/
  RSRC_CONF, "ProxyHTMLCharsetAlias charset alias [more aliases]" ) ,
AP_INIT_TAKE1("ProxyHTMLCharsetDefault", set_charset_default, NULL, /* ERROR*/
  RSRC_CONF|ACCESS_CONF, "Usage: ProxyHTMLCharsetDefault charset" ) ,
AP_INIT_TAKE1("ProxyHTMLCharsetOut", ap_set_string_slot, /* ERROR*/
  (void*)APR_OFFSETOF(proxy_html_conf, charset_out),
  RSRC_CONF|ACCESS_CONF, "Usage: ProxyHTMLCharsetOut charset" ) ,
{ NULL }
} ;

The directives in the above array are declared in this form (only one is shown, the others are similar).
# define AP_INIT_FLAG(directive, func, mconfig, where, help) \
  {directive, { .flag=func }, mconfig, where, FLAG, help}


The error messages are all of the following form: (/directory/directory/file.c : line number : error: error text). For clarity only the messages relating to the first element in error is shown, with its (presumably) cascaded errors.

/mingw/httpd-2.2.11/mod_proxy_html.c:1471: error: initializer element is not constant /mingw/httpd-2.2.11/mod_proxy_html.c:1471: error: (near initialization for `proxy_html_cmds[6].func.flag') /mingw/httpd-2.2.11/mod_proxy_html.c:1471: error: initializer element is not constant /mingw/httpd-2.2.11/mod_proxy_html.c:1471: error: (near initialization for `proxy_html_cmds[6].func') /mingw/httpd-2.2.11/mod_proxy_html.c:1471: error: initializer element is not constant /mingw/httpd-2.2.11/mod_proxy_html.c:1471: error: (near initialization for `proxy_html_cmds[6]')

Typically, the values of the initializer elements are set in a separate Apache configuration file. The inference is, therefore, that the func element of the directive cannot be a constant at compile time and contravenes the C rules (but not C++?).

However, the above code structure is replicated in the main server code and, since my downloaded Apache main server binary works ok (I didn't compile it), there must be a work-around or the MinGW compiler is the problem.

I have seen references to an archived similar problem with cygwin but no clues to a solution. Has anybody met this and, if so, can you give any pointers to a solution? I would be very grateful for any help.



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux