nigoroll / libvmod-dynamic

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

Difficulty building against Varnish 5.0 on Ubuntu 16.04 #14

Closed scottybrisbane closed 7 years ago

scottybrisbane commented 7 years ago

I'm having trouble compiling the vmod against Varnish 5.0 on a Ubuntu 16.04 machine. When running ./autogen.sh I receive the following output:

+ aclocal -I m4 -I /usr/share/aclocal
+ libtoolize --copy --force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
+ autoheader
+ automake --add-missing --copy --foreign
configure.ac:11: installing 'build-aux/compile'
configure.ac:9: installing 'build-aux/missing'
src/Makefile.am:4: error: 'vmod_LTLIBRARIES' is used but 'vmoddir' is undefined
automake: warnings are treated as errors
src/Makefile.am:6: warning: variable 'libvmod_dynamic_la_SOURCES' is defined but no program or
src/Makefile.am:6: library has 'libvmod_dynamic_la' as canonical name (possible typo)
src/Makefile.am:10: warning: variable 'nodist_libvmod_dynamic_la_SOURCES' is defined but no program or
src/Makefile.am:10: library has 'libvmod_dynamic_la' as canonical name (possible typo)

Chances are I've missed something, but could someone please point me in the right direction?

dridi commented 7 years ago

Was Varnish 5 installed from packages or from sources?

danielmotaleite commented 7 years ago

while ago i have build a small script to compile this on debian/ubuntu:

#/bin/bash
set -x
export LC_ALL=C.UTF-8
cd /usr/src/ || exit
apt-get install pkg-config automake libtool python-docutils debhelper build-essential
test -f varnish-dev_5.0.0-1_amd64.deb || wget https://repo.varnish-cache.org/pkg/5.0.0/varnish-dev_5.0.0-1_amd64.deb
test -f varnish_5.0.0-1_amd64.deb     || wget https://repo.varnish-cache.org/pkg/5.0.0/varnish_5.0.0-1_amd64.deb
if [ $(dpkg -l varnish varnish-dev| grep varnish | fgrep "5.0" | wc -l ) -ne 2 ] ; then
    dpkg -i /usr/src/varnish*.deb
fi
apt-get -f install
test -d libvmod-dynamic || git clone https://github.com/nigoroll/libvmod-dynamic.git
cd libvmod-dynamic
git pull
if fgrep -q www.localhost /etc/hosts ; then
    echo hosts ok
else
    cat <<EOF >> /etc/hosts
127.0.0.1 www.localhost img.localhost
EOF
/etc/init.d/dnsmasq restart
fi

gpg --recv-key 335B21B2
sed -i 's/4\.1\.1/5.0.0/g ; s/libvarnishapi-dev/varnish-dev/g' debian/control

./autogen.sh
dpkg-buildpackage && echo done
dpkg -i /usr/src/libvmod-dynamic_0.2_amd64.deb

echo "all done"

Please update versions hope this helps

dridi commented 7 years ago

Please update versions

Do you mean, like this line in your script?

sed -i 's/4\.1\.1/5.0.0/g ; s/libvarnishapi-dev/varnish-dev/g' debian/control

I guess it could be solved by #2 but time is running thin for this.

Regarding @scottybrisbane's error, it looks like Varnish was not installed from packages, or at the very least not in the default aclocal path. This problem could be solved by not building from git, but we haven't squashed #3 yet. Solving the aclocal path would probably trigger an error with the pkg-config path though.

danielmotaleite commented 7 years ago

@Dridi That sed is to fix the "Build-depends:" i replace the old 4.x version or varnish5, to enforce that this requires varnish5, not varnish4, but this change is really optional

I also rename the debian dev package from "libvarnishapi-dev" to the varnish dev package, named varnish-dev. This is required for varnish5 due the different name

Probably we can put this to work on both varnish4 and varnish5 with this:

Source: libvmod-dynamic
Section: web
Priority: extra
Maintainer: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
Build-Depends: debhelper (>= 7),
 build-essential,
 pkg-config,
 python-docutils,
 varnish (>= 4.1.1),
 libvarnishapi-dev (>= 4.1.1) | varnish-dev  (>=5.0.0)
Standards-Version: 3.8.1
Vcs-Git: git://github.com/nigoroll/libvmod-named.git

Package: libvmod-dynamic
Architecture: any
Depends: varnish (>= 4.1.1), ${shlibs:Depends}, ${misc:Depends}, ${Varnish:ABI}
Description: Named vmod for Varnish

That is, adding the | varnish-dev (>=5.0.0) after the libvarnishapi-dev (>= 4.1.1)

Like this should work in both varnish versions... but it is probably not enforcing that libvmod-dynamic for varnish5 can not be installed in varnish4... but i only have basic understanding of the debian/control files

dridi commented 7 years ago

I might be mistaken but I think that the package rename is effective since 4.1.4, I would need to double-check that. Regarding packaging, #2 should be my best candidate, but I will keep your comment in mind,

Regarding this very issue: ETIMEDOUT