nigoroll / libvmod-dynamic

The Varnish dns/named director continued
BSD 2-Clause "Simplified" License
95 stars 34 forks source link

Not able to build master #39

Closed lloiacono closed 6 years ago

lloiacono commented 6 years ago

I was previously using the v 0.4 tag and it was working fine. Now switched to master and I get the following error:

Making install in src
make[1]: Entering directory '/varnish-modules/libvmod-dynamic-master/src'
CC       vmod_dynamic.lo
vmod_dynamic.c:105:33: error: array type has incomplete element type 'struct vdi_methods'
 static const struct vdi_methods vmod_dynamic_methods[1] = {{
                                 ^~~~~~~~~~~~~~~~~~~~
vmod_dynamic.c:106:2: error: field name not in record or union initializer
  .magic = VDI_METHODS_MAGIC,
  ^
vmod_dynamic.c:106:2: note: (near initialization for 'vmod_dynamic_methods')
vmod_dynamic.c:106:11: error: 'VDI_METHODS_MAGIC' undeclared here (not in a function)
  .magic = VDI_METHODS_MAGIC,
           ^~~~~~~~~~~~~~~~~
vmod_dynamic.c:107:2: error: field name not in record or union initializer
  .type =  "dynamic",
  ^
vmod_dynamic.c:107:2: note: (near initialization for 'vmod_dynamic_methods')
vmod_dynamic.c:108:2: error: field name not in record or union initializer
  .healthy = dynamic_healthy,
  ^
vmod_dynamic.c:108:2: note: (near initialization for 'vmod_dynamic_methods')
vmod_dynamic.c:109:2: error: field name not in record or union initializer
  .resolve = dynamic_resolve
  ^
vmod_dynamic.c:109:2: note: (near initialization for 'vmod_dynamic_methods')
vmod_dynamic.c: In function 'dynamic_resolve':
vmod_dynamic.c:151:5: error: too many arguments to function 'VRT_Healthy'
    !VRT_Healthy(ctx, next->be->dir, NULL));
     ^~~~~~~~~~~
In file included from /usr/include/varnish/cache/cache.h:45:0,
                 from vmod_dynamic.c:45:
/usr/include/varnish/vrt.h:419:5: note: declared here
 int VRT_Healthy(VRT_CTX, VCL_BACKEND);
     ^~~~~~~~~~~
vmod_dynamic.c:156:7: error: too many arguments to function 'VRT_Healthy'
      !VRT_Healthy(ctx, next->be->dir, NULL))
       ^~~~~~~~~~~
In file included from /usr/include/varnish/cache/cache.h:45:0,
                 from vmod_dynamic.c:45:
/usr/include/varnish/vrt.h:419:5: note: declared here
 int VRT_Healthy(VRT_CTX, VCL_BACKEND);
     ^~~~~~~~~~~
vmod_dynamic.c: In function 'dynamic_healthy':
vmod_dynamic.c:184:12: error: too many arguments to function 'VRT_Healthy'
   retval = VRT_Healthy(ctx, r->be->dir, &c);
            ^~~~~~~~~~~
In file included from /usr/include/varnish/cache/cache.h:45:0,
                 from vmod_dynamic.c:45:
/usr/include/varnish/vrt.h:419:5: note: declared here
 int VRT_Healthy(VRT_CTX, VCL_BACKEND);
     ^~~~~~~~~~~
vmod_dynamic.c: In function 'dynamic_del':
vmod_dynamic.c:248:27: error: passing argument 2 of 'VRT_delete_backend' from incompatible pointer type [-Werror=incompatible-pointer-types]
   VRT_delete_backend(ctx, &b->dir);
                           ^
In file included from /usr/include/varnish/cache/cache.h:45:0,
                 from vmod_dynamic.c:45:
/usr/include/varnish/vrt.h:411:6: note: expected 'struct director **' but argument is of type 'const struct director **'
 void VRT_delete_backend(VRT_CTX, struct director **);
      ^~~~~~~~~~~~~~~~~~
vmod_dynamic.c: In function 'dynamic_get':
vmod_dynamic.c:708:13: error: implicit declaration of function 'VRT_AddDirector' [-Werror=implicit-function-declaration]
  dom->dir = VRT_AddDirector(ctx, vmod_dynamic_methods, dom,
             ^~~~~~~~~~~~~~~
At top level:
vmod_dynamic.c:105:33: error: 'vmod_dynamic_methods' defined but not used [-Werror=unused-variable]
 static const struct vdi_methods vmod_dynamic_methods[1] = {{
                                 ^~~~~~~~~~~~~~~~~~~~

My Dockerfile is

FROM alpine:3.8

RUN apk update \
    && apk add --no-cache varnish=6.0.0-r1 \
    && apk add git curl \
    && git clone https://github.com/varnish/varnish-modules.git \
    && apk add automake && apk add varnish-dev \
    && apk add autoconf && apk add libtool \
    && apk add py-docutils && apk add make \
    && cd varnish-modules/ \
    && ./bootstrap && ./configure && make && make install

#
# install libvmod-dynamic
#
ENV LIBVMOD_DYNAMIC_VERSION=master

RUN curl -sfL https://github.com/nigoroll/libvmod-dynamic/archive/${LIBVMOD_DYNAMIC_VERSION}.tar.gz \
        -o libvmod-dynamic-${LIBVMOD_DYNAMIC_VERSION}.tar.gz  && \
    tar -xzf libvmod-dynamic-${LIBVMOD_DYNAMIC_VERSION}.tar.gz && \
    cd libvmod-dynamic-${LIBVMOD_DYNAMIC_VERSION} && \
    ./autogen.sh && \
    ./configure && \
    make install && \
    cd .. &&  rm -rf libvmod-dynamic-${LIBVMOD_DYNAMIC_VERSION}.tar.gz 
nigoroll commented 6 years ago

apk add --no-cache varnish=6.0.0-r1

6.0 is not master. If you want to build with 6.0, use the 6.0 branch. But wrt #38 please use varnish-cache master and the vmod_dynamic master branch