nigoroll / libvmod-dynamic

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

Compilation error against Varnish 6.1.1 #64

Closed wimsymons closed 3 years ago

wimsymons commented 3 years ago

Hi,

I'm trying to compile the module against Varnish 6.1.1 provided by Debian 10 (Buster). As stated in the README, I should use branch 6.2 for that.

But when I try to do so, I get these compilation errors:

make  all-recursive
make[1]: Entering directory '/home/vagrant/libvmod-dynamic64'
Making all in src
make[2]: Entering directory '/home/vagrant/libvmod-dynamic64/src'
  VMODTOOL vcc_dynamic_if.c
  CC       vmod_dynamic.lo
In file included from vmod_dynamic.c:55:
dyn_resolver.h:34:31: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
 struct VPFX(dynamic_resolver) * dyn_resolver_blob(VCL_BLOB);
                               ^
dyn_resolver.h:51:56: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
 typedef int res_lookup_f(struct VPFX(dynamic_resolver) *r,
                                                        ^
dyn_resolver.h:58:56: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
 typedef int srv_lookup_f(struct VPFX(dynamic_resolver) *r,
                                                        ^
dyn_resolver.h:72:2: error: unknown type name ‘res_lookup_f’
  res_lookup_f *lookup;
  ^~~~~~~~~~~~
dyn_resolver.h:76:2: error: unknown type name ‘srv_lookup_f’
  srv_lookup_f *srv_lookup;
  ^~~~~~~~~~~~
In file included from vmod_dynamic.c:56:
vmod_dynamic.h:176:33: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘*’ token
  struct VPFX(dynamic_resolver)  *resolver_inst;
                                 ^
vmod_dynamic.c: In function ‘dynamic_update_domain’:
vmod_dynamic.c:452:21: error: ‘struct vmod_dynamic_director’ has no member named ‘ttl_from’
  } else if (dom->obj->ttl_from == cfg) {
                     ^~
vmod_dynamic.c:454:21: error: ‘struct vmod_dynamic_director’ has no member named ‘ttl_from’
  } else if (dom->obj->ttl_from == min) {
                     ^~
vmod_dynamic.c:457:21: error: ‘struct vmod_dynamic_director’ has no member named ‘ttl_from’
  } else if (dom->obj->ttl_from == max) {
                     ^~
In file included from /usr/include/varnish/cache/cache.h:50,
                 from vmod_dynamic.c:45:
vmod_dynamic.c:461:18: error: ‘struct vmod_dynamic_director’ has no member named ‘ttl_from’
   assert(dom->obj->ttl_from == dns);
                  ^~
/usr/include/varnish/vas.h:59:8: note: in definition of macro ‘assert’
  if (!(e)) {       \
        ^
vmod_dynamic.c: In function ‘dynamic_lookup_thread’:
vmod_dynamic.c:498:26: error: ‘struct vmod_dynamic_director’ has no member named ‘resolver_inst’; did you mean ‘resolver’?
   ret = res->lookup(obj->resolver_inst, dom->addr,
                          ^~~~~~~~~~~~~
                          resolver
vmod_dynamic.c:498:9: error: called object is not a function or function pointer
   ret = res->lookup(obj->resolver_inst, dom->addr,
         ^~~
vmod_dynamic.c: In function ‘vmod_director__init’:
vmod_dynamic.c:932:5: error: ‘struct vmod_dynamic_director’ has no member named ‘ttl_from’
  obj->ttl_from = dynamic_ttl_parse(ttl_from_s);
     ^~
vmod_dynamic.c:936:8: error: ‘struct vmod_dynamic_director’ has no member named ‘resolver_inst’; did you mean ‘resolver’?
   obj->resolver_inst = dyn_resolver_blob(resolver);
        ^~~~~~~~~~~~~
        resolver
vmod_dynamic.c:936:24: error: implicit declaration of function ‘dyn_resolver_blob’; did you mean ‘vmod_resolver_use’? [-Werror=implicit-function-declaration]
   obj->resolver_inst = dyn_resolver_blob(resolver);
                        ^~~~~~~~~~~~~~~~~
                        vmod_resolver_use
vmod_dynamic.c:937:12: error: ‘struct vmod_dynamic_director’ has no member named ‘resolver_inst’; did you mean ‘resolver’?
   if (obj->resolver_inst == NULL)
            ^~~~~~~~~~~~~
            resolver
vmod_dynamic.c:941:10: error: ‘struct vmod_dynamic_director’ has no member named ‘ttl_from’
   if (obj->ttl_from != cfg)
          ^~
In file included from vmod_dynamic.c:55:
vmod_dynamic.c: At top level:
dyn_resolver.h:32:13: error: storage size of ‘dynamic_resolver’ isn’t known
 struct VPFX(dynamic_resolver);
             ^~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:704: vmod_dynamic.lo] Error 1
make[2]: Leaving directory '/home/vagrant/libvmod-dynamic64/src'
make[1]: *** [Makefile:497: all-recursive] Error 1
make[1]: Leaving directory '/home/vagrant/libvmod-dynamic64'
make: *** [Makefile:408: all] Error 2

Steps to reproduce on Debian Buster:

sudo apt-get install libgetdns-dev libvarnishapi-dev automake libtool python3-docutils
git clone https://github.com/nigoroll/libvmod-dynamic.git libvmod-dynamic64
cd libvmod-dynamic64/
git checkout 6.2
./autogen.sh
./configure
make

Package versions:

vagrant@debian-10:~/libvmod-dynamic64$ dpkg -l libvarnishapi-dev libgetdns-dev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                    Version         Architecture Description
+++-=======================-===============-============-=================================
ii  libgetdns-dev           1.5.1-1         amd64        modern asynchronous DNS API (development)
ii  libvarnishapi-dev:amd64 6.1.1-1+deb10u1 amd64        development files for Varnish

Is the 6.2 branch no longer compatible with Varnish 6.1.1?

Kind regards

Wim

nigoroll commented 3 years ago

Hi @wimsymons, I have now backported branch 6.2 to a new 6.1, which I hope will work for you. I have no idea how I ever thought the 6.2 branch could work with 6.1, this must have slipped through. This work was made possible by my sponsor - please consider supporting maintenance of this project.

wimsymons commented 3 years ago

Thanks! Works perfectly fine now. 👍