varnish / varnish-modules

Collection of Varnish Cache modules (vmods) by Varnish Software
Other
185 stars 86 forks source link

Fails to compile on Alpine Linux 3.13 #185

Closed ysmnikhil closed 3 years ago

ysmnikhil commented 3 years ago

I am starting the get the error recently with 3.13 and varnish 6.5.2

RUN git clone --branch 6.3 --depth=1 https://github.com/varnish/varnish-modules.git . \
 && ./bootstrap \
 && ./configure --prefix=/usr \
 && make -j4

Error

vmod_bodyaccess.c: In function 'bodyaccess_bcat':
vmod_bodyaccess.c:169:21: error: passing argument 1 of 'VRB_Iterate' from incompatible pointer type [-Werror=incompatible-pointer-types]
  169 |  l = VRB_Iterate(ctx->req, bodyaccess_bcat_cb, vsb);
      |                  ~~~^~~~~
      |                     |
      |                     struct req * const
In file included from vmod_bodyaccess.c:37:
/usr/include/varnish/cache/cache_varnishd.h:361:21: note: expected 'struct worker *' but argument is of type 'struct req * const'
  361 | ssize_t VRB_Iterate(struct worker *, struct vsl_log *, struct req *,
      |                     ^~~~~~~~~~~~~~~
vmod_bodyaccess.c:169:28: error: passing argument 2 of 'VRB_Iterate' from incompatible pointer type [-Werror=incompatible-pointer-types]
  169 |  l = VRB_Iterate(ctx->req, bodyaccess_bcat_cb, vsb);
      |                            ^~~~~~~~~~~~~~~~~~
      |                            |
      |                            int (*)(void *, unsigned int,  const void *, ssize_t) {aka int (*)(void *, unsigned int,  const void *, long int)}
In file included from vmod_bodyaccess.c:37:
/usr/include/varnish/cache/cache_varnishd.h:361:38: note: expected 'struct vsl_log *' but argument is of type 'int (*)(void *, unsigned int,  const void *, ssize_t)' {aka 'int (*)(void *, unsigned int,  const void *, long int)'}
  361 | ssize_t VRB_Iterate(struct worker *, struct vsl_log *, struct req *,
      |                                      ^~~~~~~~~~~~~~~~
vmod_bodyaccess.c:169:48: error: passing argument 3 of 'VRB_Iterate' from incompatible pointer type [-Werror=incompatible-pointer-types]
  169 |  l = VRB_Iterate(ctx->req, bodyaccess_bcat_cb, vsb);
      |                                                ^~~
      |                                                |
      |                                                struct vsb *
In file included from vmod_bodyaccess.c:37:
/usr/include/varnish/cache/cache_varnishd.h:361:56: note: expected 'struct req *' but argument is of type 'struct vsb *'
  361 | ssize_t VRB_Iterate(struct worker *, struct vsl_log *, struct req *,
      |                                                        ^~~~~~~~~~~~
vmod_bodyaccess.c:169:6: error: too few arguments to function 'VRB_Iterate'
  169 |  l = VRB_Iterate(ctx->req, bodyaccess_bcat_cb, vsb);
      |      ^~~~~~~~~~~
In file included from vmod_bodyaccess.c:37:
/usr/include/varnish/cache/cache_varnishd.h:361:9: note: declared here
  361 | ssize_t VRB_Iterate(struct worker *, struct vsl_log *, struct req *,
      |         ^~~~~~~~~~~
vmod_bodyaccess.c: In function 'vmod_hash_req_body':
vmod_bodyaccess.c:184:35: error: 'REQ_BODY_CACHED' undeclared (first use in this function)
  184 |  if (ctx->req->req_body_status != REQ_BODY_CACHED) {
      |                                   ^~~~~~~~~~~~~~~
vmod_bodyaccess.c:184:35: note: each undeclared identifier is reported only once for each function it appears in
vmod_bodyaccess.c:204:2: error: 'VSB_delete' is deprecated [-Werror=deprecated-declarations]
  204 |  VSB_delete(vsb);
      |  ^~~~~~~~~~
In file included from /usr/include/varnish/cache/cache_varnishd.h:36,
                 from vmod_bodyaccess.c:37:
/usr/include/varnish/vsb.h:83:8: note: declared here
   83 | void   VSB_delete(struct vsb *) v_deprecated_;
      |        ^~~~~~~~~~
vmod_bodyaccess.c: In function 'vmod_len_req_body':
vmod_bodyaccess.c:215:35: error: 'REQ_BODY_CACHED' undeclared (first use in this function)
  215 |  if (ctx->req->req_body_status != REQ_BODY_CACHED) {
      |                                   ^~~~~~~~~~~~~~~
vmod_bodyaccess.c: In function 'vmod_rematch_req_body':
vmod_bodyaccess.c:244:35: error: 'REQ_BODY_CACHED' undeclared (first use in this function)
  244 |  if (ctx->req->req_body_status != REQ_BODY_CACHED) {
      |                                   ^~~~~~~~~~~~~~~
  CC       vcc_cookie_if.lo
vmod_bodyaccess.c:277:2: error: 'VSB_delete' is deprecated [-Werror=deprecated-declarations]
  277 |  VSB_delete(vsb);
      |  ^~~~~~~~~~
In file included from /usr/include/varnish/cache/cache_varnishd.h:36,
                 from vmod_bodyaccess.c:37:
/usr/include/varnish/vsb.h:83:8: note: declared here
   83 | void   VSB_delete(struct vsb *) v_deprecated_;
      |        ^~~~~~~~~~
vmod_bodyaccess.c: In function 'vmod_log_req_body':
vmod_bodyaccess.c:307:35: error: 'REQ_BODY_CACHED' undeclared (first use in this function)
  307 |  if (ctx->req->req_body_status != REQ_BODY_CACHED) {
      |                                   ^~~~~~~~~~~~~~~
vmod_bodyaccess.c:312:23: error: passing argument 1 of 'VRB_Iterate' from incompatible pointer type [-Werror=incompatible-pointer-types]
  312 |  ret = VRB_Iterate(ctx->req, bodyaccess_log_cb, &log_ctx);
      |                    ~~~^~~~~
      |                       |
      |                       struct req * const
In file included from vmod_bodyaccess.c:37:
/usr/include/varnish/cache/cache_varnishd.h:361:21: note: expected 'struct worker *' but argument is of type 'struct req * const'
  361 | ssize_t VRB_Iterate(struct worker *, struct vsl_log *, struct req *,
      |                     ^~~~~~~~~~~~~~~
vmod_bodyaccess.c:312:30: error: passing argument 2 of 'VRB_Iterate' from incompatible pointer type [-Werror=incompatible-pointer-types]
  312 |  ret = VRB_Iterate(ctx->req, bodyaccess_log_cb, &log_ctx);
      |                              ^~~~~~~~~~~~~~~~~
      |                              |
      |                              int (*)(void *, unsigned int,  const void *, ssize_t) {aka int (*)(void *, unsigned int,  const void *, long int)}
In file included from vmod_bodyaccess.c:37:
/usr/include/varnish/cache/cache_varnishd.h:361:38: note: expected 'struct vsl_log *' but argument is of type 'int (*)(void *, unsigned int,  const void *, ssize_t)' {aka 'int (*)(void *, unsigned int,  const void *, long int)'}
  361 | ssize_t VRB_Iterate(struct worker *, struct vsl_log *, struct req *,
      |                                      ^~~~~~~~~~~~~~~~
vmod_bodyaccess.c:312:49: error: passing argument 3 of 'VRB_Iterate' from incompatible pointer type [-Werror=incompatible-pointer-types]
  312 |  ret = VRB_Iterate(ctx->req, bodyaccess_log_cb, &log_ctx);
      |                                                 ^~~~~~~~
      |                                                 |
      |                                                 struct bodyaccess_log_ctx *
In file included from vmod_bodyaccess.c:37:
/usr/include/varnish/cache/cache_varnishd.h:361:56: note: expected 'struct req *' but argument is of type 'struct bodyaccess_log_ctx *'
  361 | ssize_t VRB_Iterate(struct worker *, struct vsl_log *, struct req *,
      |                                                        ^~~~~~~~~~~~
vmod_bodyaccess.c:312:8: error: too few arguments to function 'VRB_Iterate'
  312 |  ret = VRB_Iterate(ctx->req, bodyaccess_log_cb, &log_ctx);
      |        ^~~~~~~~~~~
In file included from vmod_bodyaccess.c:37:
/usr/include/varnish/cache/cache_varnishd.h:361:9: note: declared here
  361 | ssize_t VRB_Iterate(struct worker *, struct vsl_log *, struct req *,
      |         ^~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:933: vmod_bodyaccess.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
vmod_cookie.c: In function 'vmod_set':
vmod_cookie.c:160:5: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  160 |   p = WS_Printf(ctx->ws, "%s", value);
      |     ^
vmod_cookie.c:177:15: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  177 |  cookie->name = WS_Printf(ctx->ws, "%s", name);
      |               ^
vmod_cookie.c:178:16: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  178 |  cookie->value = WS_Printf(ctx->ws, "%s", value);
      |                ^
vmod_cookie.c: In function 'vmod_get_string':
vmod_cookie.c:346:3: error: 'VSB_delete' is deprecated [-Werror=deprecated-declarations]
  346 |   VSB_delete(output);
      |   ^~~~~~~~~~
In file included from vmod_cookie.c:40:
/usr/include/varnish/vsb.h:83:8: note: declared here
   83 | void   VSB_delete(struct vsb *) v_deprecated_;
      |        ^~~~~~~~~~
vmod_cookie.c:351:2: error: 'VSB_delete' is deprecated [-Werror=deprecated-declarations]
  351 |  VSB_delete(output);
      |  ^~~~~~~~~~
In file included from vmod_cookie.c:40:
/usr/include/varnish/vsb.h:83:8: note: declared here
   83 | void   VSB_delete(struct vsb *) v_deprecated_;
      |        ^~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:933: vmod_cookie.lo] Error 1
########################################################################

STRING_LIST will be discontinued before the 2019-09-15 release

Please switch to STRANDS

########################################################################

If i try alpine:3.13 with the latest varnish-module 6.6, i got the error

configure: error: Varnish version 6.6.0 or higher is required.

Can you please suggest if there is any workaround for it

gquintard commented 3 years ago

please have a look at https://github.com/varnish/varnish-modules#installation

TL;DR: the varnish-module branch must match the varnish branch/version