varnish / varnish-modules

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

Can't make vmod_vsthrottle on OSX Yosemite #37

Closed quintonparker closed 8 years ago

quintonparker commented 8 years ago

Hi guys

As you know libvmod_tcp doesn't compile on OSX. See https://github.com/varnish/varnish-modules/issues/7

So, I followed this suggestion https://github.com/varnish/varnish-modules/issues/7#issuecomment-205684177 and then ran into a new problem...

libvmod_vsthrottle won't compile either. but this is a previously solved problem. See https://github.com/varnish/libvmod-vsthrottle/issues/10

Perhaps the fix from the libvmod-vsthrottle repo can be ported to the varnish-modules repo? I attempted this myself but not able to access the commit history of libvmod-vsthrottle repo so I came up empty

Please help 👶

FTR I use varnish on OSX because its my dev workstation. In production we run varnish on ubuntu linux

quintonparker commented 8 years ago

This is the make error

/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in src
 cd .. && /bin/sh /Users/quinton.parker/workspace/varnish-modules/missing automake-1.15 --foreign src/Makefile
src/Makefile.am:43: warning: variable 'libvmod_tcp_la_SOURCES' is defined but no program or
src/Makefile.am:43: library has 'libvmod_tcp_la' as canonical name (possible typo)
src/Makefile.am:42: warning: variable 'libvmod_tcp_la_LDFLAGS' is defined but no program or
src/Makefile.am:42: library has 'libvmod_tcp_la' as canonical name (possible typo)
 cd .. && /bin/sh ./config.status src/Makefile depfiles
config.status: creating src/Makefile
config.status: executing depfiles commands
/usr/local/Cellar/varnish/4.1.2/share/varnish/vmodtool.py -w ../docs/ -o vcc_var_if ../src/vmod_var.vcc
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -I/usr/local/Cellar/varnish/4.1.2/include/varnish -I../src/foreign -Wall -Werror -Wunused-parameter -Wmissing-prototypes   -g -O2 -MT vcc_var_if.lo -MD -MP -MF .deps/vcc_var_if.Tpo -c -o vcc_var_if.lo vcc_var_if.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/local/Cellar/varnish/4.1.2/include/varnish -I../src/foreign -Wall -Werror -Wunused-parameter -Wmissing-prototypes -g -O2 -MT vcc_var_if.lo -MD -MP -MF .deps/vcc_var_if.Tpo -c vcc_var_if.c  -fno-common -DPIC -o .libs/vcc_var_if.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/local/Cellar/varnish/4.1.2/include/varnish -I../src/foreign -Wall -Werror -Wunused-parameter -Wmissing-prototypes -g -O2 -MT vcc_var_if.lo -MD -MP -MF .deps/vcc_var_if.Tpo -c vcc_var_if.c -o vcc_var_if.o >/dev/null 2>&1
mv -f .deps/vcc_var_if.Tpo .deps/vcc_var_if.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -I/usr/local/Cellar/varnish/4.1.2/include/varnish -I../src/foreign -Wall -Werror -Wunused-parameter -Wmissing-prototypes   -g -O2 -MT vmod_var.lo -MD -MP -MF .deps/vmod_var.Tpo -c -o vmod_var.lo vmod_var.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/local/Cellar/varnish/4.1.2/include/varnish -I../src/foreign -Wall -Werror -Wunused-parameter -Wmissing-prototypes -g -O2 -MT vmod_var.lo -MD -MP -MF .deps/vmod_var.Tpo -c vmod_var.c  -fno-common -DPIC -o .libs/vmod_var.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/local/Cellar/varnish/4.1.2/include/varnish -I../src/foreign -Wall -Werror -Wunused-parameter -Wmissing-prototypes -g -O2 -MT vmod_var.lo -MD -MP -MF .deps/vmod_var.Tpo -c vmod_var.c -o vmod_var.o >/dev/null 2>&1
mv -f .deps/vmod_var.Tpo .deps/vmod_var.Plo
/bin/sh ../libtool  --tag=CC   --mode=link gcc  -g -O2  -module -export-dynamic -avoid-version -shared  -o libvmod_var.la -rpath /usr/local/Cellar/varnish/4.1.2/lib/varnish/vmods vcc_var_if.lo vmod_var.lo
libtool: link: gcc -Wl,-undefined -Wl,dynamic_lookup -o .libs/libvmod_var.so -bundle  .libs/vcc_var_if.o .libs/vmod_var.o    -g -O2
libtool: link: ( cd ".libs" && rm -f "libvmod_var.la" && ln -s "../libvmod_var.la" "libvmod_var.la" )
/usr/local/Cellar/varnish/4.1.2/share/varnish/vmodtool.py -w ../docs/ -o vcc_vsthrottle_if ../src/vmod_vsthrottle.vcc
WARNING: $Event description is not included in .rst:
[(25, '')]
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -I/usr/local/Cellar/varnish/4.1.2/include/varnish -I../src/foreign -Wall -Werror -Wunused-parameter -Wmissing-prototypes   -g -O2 -MT vcc_vsthrottle_if.lo -MD -MP -MF .deps/vcc_vsthrottle_if.Tpo -c -o vcc_vsthrottle_if.lo vcc_vsthrottle_if.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/local/Cellar/varnish/4.1.2/include/varnish -I../src/foreign -Wall -Werror -Wunused-parameter -Wmissing-prototypes -g -O2 -MT vcc_vsthrottle_if.lo -MD -MP -MF .deps/vcc_vsthrottle_if.Tpo -c vcc_vsthrottle_if.c  -fno-common -DPIC -o .libs/vcc_vsthrottle_if.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/local/Cellar/varnish/4.1.2/include/varnish -I../src/foreign -Wall -Werror -Wunused-parameter -Wmissing-prototypes -g -O2 -MT vcc_vsthrottle_if.lo -MD -MP -MF .deps/vcc_vsthrottle_if.Tpo -c vcc_vsthrottle_if.c -o vcc_vsthrottle_if.o >/dev/null 2>&1
mv -f .deps/vcc_vsthrottle_if.Tpo .deps/vcc_vsthrottle_if.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -I/usr/local/Cellar/varnish/4.1.2/include/varnish -I../src/foreign -Wall -Werror -Wunused-parameter -Wmissing-prototypes   -g -O2 -MT vmod_vsthrottle.lo -MD -MP -MF .deps/vmod_vsthrottle.Tpo -c -o vmod_vsthrottle.lo vmod_vsthrottle.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/local/Cellar/varnish/4.1.2/include/varnish -I../src/foreign -Wall -Werror -Wunused-parameter -Wmissing-prototypes -g -O2 -MT vmod_vsthrottle.lo -MD -MP -MF .deps/vmod_vsthrottle.Tpo -c vmod_vsthrottle.c  -fno-common -DPIC -o .libs/vmod_vsthrottle.o
vmod_vsthrottle.c:144:5: error: implicit declaration of function 'clock_gettime' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
        AZ(clock_gettime(CLOCK_MONOTONIC, &ts));
           ^
/usr/local/Cellar/varnish/4.1.2/include/varnish/vas.h:74:31: note: expanded from macro 'AZ'
#define AZ(foo)         do { assert((foo) == 0); } while (0)
                                     ^
/usr/local/Cellar/varnish/4.1.2/include/varnish/vas.h:58:8: note: expanded from macro 'assert'
        if (!(e)) {                                                     \
              ^
vmod_vsthrottle.c:144:19: error: use of undeclared identifier 'CLOCK_MONOTONIC'
        AZ(clock_gettime(CLOCK_MONOTONIC, &ts));
                         ^
/usr/local/Cellar/varnish/4.1.2/include/varnish/vas.h:74:31: note: expanded from macro 'AZ'
#define AZ(foo)         do { assert((foo) == 0); } while (0)
                                     ^
/usr/local/Cellar/varnish/4.1.2/include/varnish/vas.h:58:8: note: expanded from macro 'assert'
        if (!(e)) {                                                     \
              ^
2 errors generated.
make[2]: *** [vmod_vsthrottle.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
alpha01 commented 8 years ago

Honestly, I would suggest using something like Vagrant and run Varnish inside an Ubuntu VM to match your production environment. It will save you time in the long run, you will have a development environment similar to your production environment, and avoid problems like these.

dridi commented 8 years ago

Fixed in b24bb39, although I recommend to develop on Linux like @alpha01.