nytimes / libvmod-queryfilter

Simple querystring filter/sort module for Varnish Cache v3-v6
http://open.blogs.nytimes.com/
Other
17 stars 2 forks source link

Build error on CentOS #2

Closed gsdevme closed 6 years ago

gsdevme commented 6 years ago

Hi,

Is there any specific instructions for building on CentOS? Im using the devel files from the official Varnish package. This is with varnish-4.1.9 revision 5024f60c3a51f537279977989b645e983a946e1a)

I've tried Master and every v2 release.

yum groupinstall 'Development Tools'
./autogen.sh
./configure VARNISHSRC=/usr/include/varnish/
[root@chef-varnish libvmod-queryfilter]# ./autogen.sh
+ mkdir -p m4
+ aclocal -I m4
+ libtoolize --copy --force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `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'
libtoolize: `AC_PROG_RANLIB' is rendered obsolete by `LT_INIT'
+ autoheader
+ automake --add-missing --copy --foreign
+ autoconf
[root@chef-varnish libvmod-queryfilter]# ./configure VARNISHSRC=/usr/include/varnish/ --enable-query-arrays
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking for gcc option to accept ISO C99... -std=gnu99
checking how to run the C preprocessor... gcc -E
checking for a BSD-compatible install... /usr/bin/install -c
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by gcc -std=gnu99... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1966080
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc -std=gnu99 object... ok
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc -std=gnu99 supports -fno-rtti -fno-exceptions... no
checking for gcc -std=gnu99 option to produce PIC... -fPIC -DPIC
checking if gcc -std=gnu99 PIC flag -fPIC -DPIC works... yes
checking if gcc -std=gnu99 static flag -static works... no
checking if gcc -std=gnu99 supports -c -o file.o... yes
checking if gcc -std=gnu99 supports -c -o file.o... (cached) yes
checking whether the gcc -std=gnu99 linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether make sets $(MAKE)... (cached) yes
checking for gawk... (cached) gawk
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking how to run the C preprocessor... gcc -E
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for ranlib... (cached) ranlib
checking for md2man-roff... no
configure: WARNING: md2man not found - not building man pages
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for python3... no
checking for python3.1... no
checking for python3.2... no
checking for python2.7... no
checking for python2.6... python2.6
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for ANSI C header files... (cached) yes
checking sys/stdlib.h usability... no
checking sys/stdlib.h presence... no
checking for sys/stdlib.h... no
checking for inline... inline
checking for size_t... yes
checking for strchr... yes
./configure: line 15045: syntax error near unexpected token `fi'
./configure: line 15045: `fi'

Is there any appetite to add travis tests? Id be happy to add if I can resolve my above issue. Furthermore packaging some RPM's could be ideal also

andrew-canaday commented 6 years ago

@gsdevme, apologies for the late reply! Thank you for taking the time to surface this issue!

I'll have a look at this and try to get back to you tomorrow. At first glance, it appears you've got everything right and I may have introduced an error into one of the m4 macros.

In the meantime, can you confirm that /usr/include/varnish in your example points to a varnish source, which has been configured and compiled? (The VARNISHSRC path has to point to the actual root directory of the varnish source, not the header directory which is the output of make install).

If this turns out to be the issue and you found the documentation ambiguous/confusing in this regard, please do not hesitate to say so and I'll try to update the language to make this distinction more apparent.

Thanks again! -Andrew

andrew-canaday commented 6 years ago

Oh, regarding Travis tests: Yes, and this is long overdue. The effort involved is minimal. I'll see what I can do about getting some time allocated to set this up and get back to you.

Thanks!

gsdevme commented 6 years ago

Hey thanks for getting back to me @andrew-canaday

I can submit a PR for adding Travis with different platforms (CentOS/Ubuntu/Debian) via KitchenCI then we can if there is some specific issue with a platform or my error it will be visible.

andrew-canaday commented 6 years ago

Having a look at this today. Will also have a peek at the pull request (thank you!), but going to address them separately.

In the meantime, toward diagnosing the issue you're experiencing, any chance you can post back with the output of ls /usr/include/varnish?

gsdevme commented 6 years ago

The contents is on the PR

Sent from my iPhone

On 1 Feb 2018, at 18:29, Andrew Canaday notifications@github.com wrote:

Having a look at this today. Will also have a peek at the pull request (thank you!), but going to address them separately.

In the meantime, toward diagnosing the issue you're experiencing, any chance you can post back with the output of ls /usr/include/varnish?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

andrew-canaday commented 6 years ago

Aha! Gotcha, thank you! So it appears you are building against the varnish includes, not the varnish source. Try the following:

#!/usr/bin/env bash

# Download and extract varnish:
wget https://github.com/varnishcache/varnish-cache/archive/varnish-4.1.9.tar.gz
tar -xzf ./varnish-4.1.9.tar.gz
pushd ./varnish-cache-varnish-4.1.9/

# Save VARNISHSRC path for use later:
export VARNISHSRC="${PWD}"

# Configure and build:
# NOTE: you can skip the "make install" if you're working on a system
#            which already has this version of varnish installed somewhere
#            where the runtime library loader will find libvmod.so.
./autogen.sh && ./configure && make && make install && popd

# Exit directory and cd into your libvmod-queryfilter directory:
cd ./libvmod-queryfilter
./autogen.sh && ./configure VARNISHSRC="${VARNISHSRC}" && make && make check
# EOF

I'll update the documentation to make this more clear. :D

gsdevme commented 6 years ago

Interesting, I will check later tonight (GMT). Thanks though, I will update the PR also

Sent from my iPhone

On 1 Feb 2018, at 18:48, Andrew Canaday notifications@github.com wrote:

Aha! Gotcha, thank you! So it appears you are building against the varnish includes, not the varnish source. Try the following:

!/usr/bin/env bash

Download and extract varnish:

wget https://github.com/varnishcache/varnish-cache/archive/varnish-4.1.9.tar.gz tar -xzf ./varnish-4.1.9.tar.gz pushd ./varnish-cache-varnish-4.1.9/

Save VARNISHSRC path for use later:

export VARNISHSRC="${PWD}"

Configure and build:

./autogen.sh && ./configure && make && make install && popd

Exit directory and cd into your libvmod-queryfilter directory:

cd ./libvmod-queryfilter ./autogen.sh && ./configure VARNISHSRC="${VARNISHSRC}" && make && make check

EOF

I'll update the documentation to make this more clear. :D

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

andrew-canaday commented 6 years ago

Closing this; will have a look at the PR after the update. Thanks!

andrew-canaday commented 6 years ago

Re-opened, because it appears the problem is persisting.

gsdevme commented 6 years ago
checking for size_t... yes
checking for strchr... yes
./configure: line 15018: syntax error near unexpected token `fi'
./configure: line 15018: `fi'
[root@2ae92a8cd72b build]# sed -n 14900,15100p ./configure
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_dummy="$PATH:$VARNISHSRC/bin/varnishtest"
for as_dir in $as_dummy
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
    ac_cv_path_VARNISHTEST="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done
IFS=$as_save_IFS

  ;;
esac
fi
VARNISHTEST=$ac_cv_path_VARNISHTEST
if test -n "$VARNISHTEST"; then
  { $as_echo "$as_me:$LINENO: result: $VARNISHTEST" >&5
$as_echo "$VARNISHTEST" >&6; }
else
  { $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
fi

    if test "x$VARNISHTEST" != "x"; then

    { $as_echo "$as_me:$LINENO: checking Varnish Cache VMOD dir" >&5
$as_echo_n "checking Varnish Cache VMOD dir... " >&6; }

    # If not explicitly set, attempt to determine vmoddir via pkg-config
    if test "x$VMOD_DIR" = "x"; then

        _vmoddir=`PKG_CONFIG_PATH="${VARNISHSRC}:${PKG_CONFIG_PATH}" $PKG_CONFIG varnishapi --variable=vmoddir`
        if test "x$_vmoddir" != "x"; then

                { $as_echo "$as_me:$LINENO: result: $_vmoddir" >&5
$as_echo "$_vmoddir" >&6; }
                VMOD_DIR=$_vmoddir

    # Check for vmodtool.py (varnish 4.x):
    vmodtool_path=$VARNISHSRC/lib/libvcc/vmodtool.py
    as_ac_File=`$as_echo "ac_cv_file_$vmodtool_path" | $as_tr_sh`
{ $as_echo "$as_me:$LINENO: checking for $vmodtool_path" >&5
$as_echo_n "checking for $vmodtool_path... " >&6; }
if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then
  $as_echo_n "(cached) " >&6
else
  test "$cross_compiling" = yes &&
  { { $as_echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
$as_echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
   { (exit 1); exit 1; }; }
if test -r "$vmodtool_path"; then
  eval "$as_ac_File=yes"
else
  eval "$as_ac_File=no"
fi
fi
ac_res=`eval 'as_val=${'$as_ac_File'}
         $as_echo "$as_val"'`
           { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
as_val=`eval 'as_val=${'$as_ac_File'}
         $as_echo "$as_val"'`
   if test "x$as_val" = x""yes; then

        VMODTOOL=$vmodtool_path

else

        # Check for vmod.py (varnish 3.x):
        vmod_py_path=$VARNISHSRC/lib/libvmod_std/vmod.py
        as_ac_File=`$as_echo "ac_cv_file_$vmod_py_path" | $as_tr_sh`
{ $as_echo "$as_me:$LINENO: checking for $vmod_py_path" >&5
$as_echo_n "checking for $vmod_py_path... " >&6; }
if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then
  $as_echo_n "(cached) " >&6
else
  test "$cross_compiling" = yes &&
  { { $as_echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
$as_echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
   { (exit 1); exit 1; }; }
if test -r "$vmod_py_path"; then
  eval "$as_ac_File=yes"
else
  eval "$as_ac_File=no"
fi
fi
ac_res=`eval 'as_val=${'$as_ac_File'}
         $as_echo "$as_val"'`
           { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
as_val=`eval 'as_val=${'$as_ac_File'}
         $as_echo "$as_val"'`
   if test "x$as_val" = x""yes; then

            VMODTOOL=$vmod_py_path

else

fi

fi

else

                { $as_echo "$as_me:$LINENO: result: not found" >&5
$as_echo "not found" >&6; }

    { { $as_echo "$as_me:$LINENO: error: \"$VARNISHSRC missing or not built.\"" >&5
$as_echo "$as_me: error: \"$VARNISHSRC missing or not built.\"" >&2;}
   { (exit 1); exit 1; }; }

fi

fi

else

    { { $as_echo "$as_me:$LINENO: error: \"$VARNISHSRC missing or not built.\"" >&5
$as_echo "$as_me: error: \"$VARNISHSRC missing or not built.\"" >&2;}
   { (exit 1); exit 1; }; }

fi

else

            { $as_echo "$as_me:$LINENO: result: not found" >&5
$as_echo "not found" >&6; }

    { { $as_echo "$as_me:$LINENO: error: \"$VARNISHSRC missing or not built.\"" >&5
$as_echo "$as_me: error: \"$VARNISHSRC missing or not built.\"" >&2;}
   { (exit 1); exit 1; }; }

fi

fi

else

    { { $as_echo "$as_me:$LINENO: error: \"$VARNISHSRC missing or not built.\"" >&5
$as_echo "$as_me: error: \"$VARNISHSRC missing or not built.\"" >&2;}
   { (exit 1); exit 1; }; }

fi

cat >>confdefs.h <<_ACEOF
#define VARNISH_API_MAJOR $VARNISH_API_MAJOR
_ACEOF

 if test "x$VARNISH_API_MAJOR" = "x3"; then
  VARNISHSRC_3_X_TRUE=
  VARNISHSRC_3_X_FALSE='#'
else
  VARNISHSRC_3_X_TRUE='#'
  VARNISHSRC_3_X_FALSE=
fi

 if test "x$VARNISH_API_MAJOR" = "x4"; then

@andrew-canaday

gsdevme commented 6 years ago

Hey any chance the above highlights anything obvious?

andrew-canaday commented 6 years ago

@gsdevme Apologies (again) for the delay. The sluggish responses have been something of an aberration. Thank you for your patience.

I will have a look and get back to you Monday/Tuesday this week.

andrew-canaday commented 6 years ago

@gsdevme Looks like there was an empty case in the configure script (sorry for your troubles, but thank you for surfacing this!).

I pushed an update to master (specifically commit 5be34...) - give it a go and ping if you run into further issues.

I'll cut a new release this weekend.

gsdevme commented 6 years ago

Thanks, I will take a look