varnish / varnish-nagios

Nagios plugin for Varnish
Other
21 stars 9 forks source link

varnish-nagios doesn't build with libvarnishapi-dev 4.1.0 #7

Closed kowalskey closed 8 years ago

kowalskey commented 8 years ago

Hello! Looks like varnish-nagios doesn't compile with libvarnishapi-dev for Varnish 4.1

Here's log from my shell: https://gist.github.com/kowalskey/bd9b57be85725a8bf4e3

I tried to build varnish-nagios under Ubuntu 14.04.3 LTS, with latest libvarnishapi-dev available (4.1.0-1~trusty)

First error seems to be:

In file included from check_varnish.c:44:0:
check_varnish.c: In function ‘check_stats_cb’:
check_varnish.c:199:25: error: ‘const struct VSC_desc’ has no member named ‘fmt’
michbsd commented 8 years ago

I am seeing this too

denisbr commented 8 years ago

I committed a suggested fix in the https://github.com/varnish/varnish-nagios/tree/4.1-support branch. Would you @michbsd or @kowalskey mind checking it out and giving me feedback whether it works for you?

denisbr commented 8 years ago

Hi, after more testing I committed the fix to master, and you should now be able to build this with varnish 4.1 too.

kowalskey commented 8 years ago

Hello, @denisbr

Sorry for late reply. Looks like build fails for me:

make
make  all-am
make[1]: Entering directory `/root/varnish-nagios'
gcc -DHAVE_CONFIG_H -I.    -include config.h -I/usr/include/varnish   -g -O2 -MT check_varnish-check_varnish.o -MD -MP -MF .deps/check_varnish-check_varnish.Tpo -c -o check_varnish-check_varnish.o `test -f 'check_varnish.c' || echo './'`check_varnish.c
mv -f .deps/check_varnish-check_varnish.Tpo .deps/check_varnish-check_varnish.Po
/bin/bash ./libtool  --tag=CC   --mode=link gcc -include config.h -I/usr/include/varnish   -g -O2   -o check_varnish check_varnish-check_varnish.o -lvarnishapi   
libtool: link: gcc -include config.h -I/usr/include/varnish -g -O2 -o check_varnish check_varnish-check_varnish.o  -lvarnishapi
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libvarnishapi.so: undefined reference to `pow'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libvarnishapi.so: undefined reference to `round'
collect2: error: ld returned 1 exit status
make[1]: *** [check_varnish] Error 1
make[1]: Leaving directory `/root/varnish-nagios'
make: *** [all] Error 2

Here's full build log: https://gist.github.com/kowalskey/9573984cdef24a435133

Changing

 gcc -include config.h -I/usr/include/varnish   -g -O2   -o check_varnish check_varnish-check_varnish.o -lvarnishapi 

to

 gcc -include config.h -I/usr/include/varnish   -g -O2   -o check_varnish check_varnish-check_varnish.o -lvarnishapi -lm

(note -lm at the end) fixes gcc command and produces valid check_varnish executable

I also managed to fix it by adding

AC_SEARCH_LIBS([pow],[m],[],[AC_MSG_ERROR([unable to find libm])])

to configure.ac

so autogen.sh will generate ./configure script which will look for libm.

denisbr commented 8 years ago

@kowalskey Thanks for the report, this is a totally different issue though, so I'll create a new issue for it, and use your suggested patch to fix it.

kowalskey commented 8 years ago

@denisbr thank you! I was able to successfully build varnish-nagios from master. Compiled check also seems to work and correctly validate things like uptime or hit ratio.