[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] issue #997: Static apache build broken

From: Neels Janosch Hofmeyr <neels_at_elego.de>
Date: Sat, 02 Feb 2008 18:56:29 +0100

Hi dev,

while trying to test our new treeconflicts code through WebDAV on an
Ubuntu with a preinstalled older svn and no root access, I found out
that the instructions I stumbled across about static linking of
mod_dav_svn into apache did not work.

(The instructions are found in some old svn hacker's guide at
     http://svn.collab.net/repos/svn/tags/0.6.0/HACKING
under "Compiling mod_dav_svn")

I found issue #997, which basically describes the first problem
encountered with a static apache build.

I dug around for a day and came up with the following patch, which
takes care of the following things in the following ways; in short,
this patch enables using a subversion DAV with --disable-shared.

Problem 1
=========

APACHE_LIBEXECDIR is not set when libtool is called to do its job
on mod_dav_svn & co. This results in a missing -rpath argument, and
libtool misleadingly says "only absolute paths allowed".

Solution:

I included another svn configure script option called
      --with-apache-libexecdir=DIR
which can be used to set the APACHE_LIBEXECDIR variable directly.
This option is only allowed in addition to a --with-apache option,
so it only can be used when building statically.
Furthermore, if --with-apache is used, this option has to be
supplied as well. The configure script will complain otherwise.

Reasoning:

To statically build the apache module, one uses --with-apache. But
--with-apache is given the apache *source* directory.
It basically has no way of knowing where apache will be installed.

But the static build needs to know where apache will be installed,
because the static library for the module needs to know a runpath
(given by the APACHE_LIBEXECDIR).

With a dynamic build, --with-apxs=/my/apache2/bin/apxs sets up the
variable like this:
      APACHE_LIBEXECDIR=`/my/apache2/bin/apxs -q libexecdir`
which will basically result in
      APACHE_LIBEXECDIR="/my/apache2/modules"
, being the place where the installed apache keeps its modules.

But I do not want to use --with-apxs for a static build, because

a) --with-apxs can be seen as implying a dynamic build;
assuming that an apache already exists could be understood as not
wanting to compile apache anymore. That, I guess, is why currently
the --with-apxs and --with-apache options are setup to be mutually
exclusive.

b) Also, when I already know where my apache modules will be, I do not
want to have to install apache first to pass svn's configure script an
apxs script location, so that configure can query the path from it.
I just want to supply the path directly. If I want to use apxs, I can
still install apache first, run `apxs -q libexecdir' and manually pass
the obtained value to --with-apache-libexecdir.

That's why I think forcing the developer to pass the APACHE_LIBEXECDIR
in another configure option is the best solution.

Question:
Should configure also accept an APACHE_LIBEXECDIR environment variable
set in the shell?

Problem 2
=========
The names of the static library files that make up the static
mod_dav_svn are different from those inserted in the apache build scripts.

Real names Names inserted in the scripts

mod_dav_svn.la libmod_dav_svn.la
libsvn_fs-1.la libsvn_fs.la
libsvn_subr-1.la libsvn_subr.la
libsvn_repos-1.la libsvn_repos.la
libsvn_delta-1.la libsvn_delta.la

Solution:
The patch changes the names in the apache build scripts to the names of
the actually installed files.

Reasoning:
That's the easiest way to fix it.

Question:
Should this rather be implemented
- by changing the filenames of the files that subversion installs to
      be the ones currently inserted in the apache build scripts?
- by adding symbolic links from the script names to the real names?

Problem 3
=========
To use AuthzSVNAccessFile in a svn DAV, the module mod_authz_svn.la is
also needed, which is already being put in the apache source tree
by subversion, but not being linked by apache.

Solution:
The patch adds another option to the apache configure script called
      --enable-authz-svn
to go along with the existing
      --enable-dav-svn
which adds mod_authz_svn.la to the apache linking.

When supplying the old --enable-dav-svn as usual, the new
--enable-authz-svn is enabled as well.
The developer can manually pass "--enable-dav-svn --disable-authz-svn".

The patch also adds a warning message to the apache configure, for the
case that the developer fails to pass --enable-dav-svn; Since she went
at great lengths to setup a static apache link, it seems silly to not
enable those modules that should be linked statically.

Btw: This warning message and the additional modules are inserted into
the apache source tree only when requesting a static apache build. This
patch changes the m4 script that subversion inserts into the apache
sources, not the apache source tree itself.

My biggest unknown with this patch is whether the static build is only
broken on Linux (as stated by issue #997). Having all the other problems
made me assume that no-one has made a static apache build since 2002,
but this patch still has to be verified to work on other platforms.
However, it fixes all static building problems on Ubuntu feisty i386.

Find attached both the patch itself and a Makefile I cooked up to
collect all the commands I use for statically linking my subversion with
my apache.

This is my first patch, so feel free to criticize my style and point out
any other places where I should put this information. Should I post a
comment to issue #997? Should we add an entry to the actual subversion
hacker's guide at http://subversion.tigris.org/hacking.html about static
apache linking?

For a complete static userland setup to run the subversion tests through
an apache WebDAV, I'd have some more instructions that'd be handy for
configuring the apache. This might also be interesting for automated
download, building and testing of subversion and apache, since it now
works without any root access nor interference with the standard
locations of apache and the system wide subversion libraries.

Thanks,
Neels

-- 
Neels Janosch Hofmeyr
Software Developer
neels_at_elego.de
Public Key: http://binarchy.net/neels/neels.hofmeyr.public.key.asc
elego Software Solutions GmbH           http://www.elegosoft.com
Gustav-Meyer-Allee 25, Gebäude 12       HRB 77719
13355 Berlin, Germany                   Amtsgericht Charlottenburg
Tel.: +49 30 23 45 86 96                Sitz der Gesellschaft: Berlin
Fax:  +49 30 23 45 86 95                Geschäftsführer: Olaf Wagner

Index: build/ac-macros/apache.m4
===================================================================
--- build/ac-macros/apache.m4 (revision 29166)
+++ build/ac-macros/apache.m4 (working copy)
@@ -17,9 +17,11 @@
 AC_ARG_WITH(apache,
 AS_HELP_STRING([--with-apache=DIR],
                [Build static Apache modules. DIR is the path to the top-level
- Apache source directory. IMPORTANT: Unless you are *absolutely*
- certain that you want to build the modules *statically*, you
- probably want --with-apxs, and not this option.]),
+ Apache source directory. You also need to supply
+ --with-apache-libexecdir.
+ IMPORTANT: Unless you are *absolutely* certain that you want
+ to build the modules *statically*, you probably want
+ --with-apxs, and not this option.]),
 [
         if test "$withval" = "yes"; then
                 AC_MSG_ERROR(You need to specify a directory with --with-apache)
@@ -33,7 +35,7 @@
                 INSTALL_APACHE_RULE=install-mods-static
                 BINNAME=mod_dav_svn.a
 
- AC_MSG_RESULT(yes - Apache 2.0.x)
+ AC_MSG_RESULT(yes - Apache 2.x.x)
 
                 AC_MSG_CHECKING([httpd version])
                 AC_EGREP_CPP(VERSION_OKAY,
@@ -46,7 +48,7 @@
                 [AC_MSG_ERROR([apache too old: mmn must be at least $HTTPD_WANTED_MMN])])
 
                 if test ! -r $withval/srclib/apr/include/apr.h; then
- AC_MSG_WARN(Apache 2.0.x is not configured)
+ AC_MSG_WARN(Apache 2.x.x is not configured)
                 fi
         else
                 dnl if they pointed us at the wrong place, then just bail
@@ -57,6 +59,32 @@
 ])
 
 
+AC_MSG_CHECKING(whether Apache libexecdir is supplied)
+AC_ARG_WITH(apache-libexecdir,
+AS_HELP_STRING([--with-apache-libexecdir=DIR],
+ [Supplies the library runpath for static Apache modules. DIR is the path
+ given by running apache2/bin/apxs -q libexecdir, obtained from a
+ preliminarily installed apache httpd, which needs to be in the same
+ location that the final httpd with included mod_dav_svn will be.
+ This option only makes sense with --with-apache=DIR supplied.]),
+[
+ if test "$withval" = "yes"; then
+ AC_MSG_ERROR(You need to specify a directory with --with-apache-libexecdir)
+ fi
+
+ if test "$withval" != "no"; then
+ APACHE_LIBEXECDIR=$withval
+ AC_MSG_RESULT(yes - $withval)
+ fi
+],[
+ if test ! -z "$BINNAME"; then
+ AC_MSG_ERROR(When using --with-apache=DIR
+ you need to supply a --with-apache-libexecdir=DIR2);
+ fi
+ AC_MSG_RESULT(no)
+])
+
+
 AC_MSG_CHECKING(for Apache module support via DSO through APXS)
 AC_ARG_WITH(apxs,
             [AS_HELP_STRING([[--with-apxs[=FILE]]],
Index: subversion/mod_dav_svn/static/config.m4
===================================================================
--- subversion/mod_dav_svn/static/config.m4 (revision 29166)
+++ subversion/mod_dav_svn/static/config.m4 (working copy)
@@ -18,15 +18,36 @@
 if test "$enable_dav_svn" != "no"; then
   case "$enable_$1" in
     shared*)
- AC_MSG_ERROR(mod_dav_svn can only be built dynamically via APXS)
+ AC_MSG_ERROR([mod_dav_svn is setup statically and can only be built dynamically via APXS, do not use --enable-shared, use --disable-shared])
       ;;
     *)
- MODLIST="$MODLIST dav_svn"
       ;;
   esac
 
- modpath_static="libmod_dav_svn.la libsvn_fs.la libsvn_subr.la"
- BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/libmod_dav_svn.la $modpath_current/libsvn_fs.la $modpath_current/libsvn_subr.la"
+ MODLIST="$MODLIST dav_svn"
+ modpath_static="mod_dav_svn.la libsvn_fs-1.la libsvn_subr-1.la"
+ BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/mod_dav_svn.la $modpath_current/libsvn_fs-1.la $modpath_current/libsvn_subr-1.la"
+else
+ AC_MSG_WARN([You have setup mod_dav_svn for static linking with httpd, and you almost certainly want to configure with --enable-dav-svn])
 fi
 
+dnl APACHE_MODULE(authz_svn, Authz for Subversion DAV, $dav_svn_objects, , no)
+AC_MSG_CHECKING(whether to enable mod_authz_svn)
+AC_ARG_ENABLE(authz-svn,
+ AC_HELP_STRING([--enable-authz-svn], [Authz for Subversion DAV]),
+ [ ],
+ [ enable_authz_svn=$enable_dav_svn ])
+AC_MSG_RESULT($enable_authz_svn)
+
+if test "$enable_authz_svn" != "no"; then
+ if test "$enable_dav_svn" != "yes"; then
+ AC_MSG_WARN([--enable-authz-svn, i.e. a statically linked mod_authz_svn, is only needed if you also use --enable-dav-svn])
+ fi
+
+ MODLIST="$MODLIST authz_svn"
+ modpath_static="$modpath_static mod_authz_svn.la"
+ BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/mod_authz_svn.la"
+fi
+
+
 APACHE_MODPATH_FINISH

.PHONY: all svn_reconfigure svn_compile svn_install apache_reconfigure apache_buildinstall

MY_PREFIX=/home/neels/svn-treeconflicts/local
APACHE_PREFIX=${MY_PREFIX}/apache2
APACHE_SRC=/home/neels/svn-treeconflicts/httpd-2.2.8
APACHE_LIBEXECDIR=${APACHE_PREFIX}/modules
TRUNK=/home/neels/svn-treeconflicts/trunk

all:
        make -C . svn_reconfigure
        make -C . svn_compile
        make -C . svn_install
        make -C . apache_reconfigure
        make -C . svn_install
        make -C . apache_buildinstall

svn_reconfigure:
        -make -C ${TRUNK} extraclean
        cd ${TRUNK} && ./autogen.sh
        cd ${TRUNK} && ./configure --disable-shared --enable-maintainer-mode --prefix=${MY_PREFIX} --with-serf=../serf-0.1.2 --with-apache=${APACHE_SRC} --with-apache-libexecdir=${APACHE_LIBEXECDIR}

svn_compile:
        make -C ${TRUNK}

svn_install:
        make -C ${TRUNK} install

apache_reconfigure:
        cd ${APACHE_SRC} && ./buildconf
        cd ${APACHE_SRC} && ./configure --prefix=${APACHE_PREFIX} --enable-dav --enable-dav-fs --enable-dav-lock --enable-dav-svn
        make -C ${APACHE_SRC} clean

apache_buildinstall:
        make -C ${APACHE_SRC}
        make -C ${APACHE_SRC} install

Received on 2008-02-02 18:57:54 CET

This is an archived mail posted to the Subversion Dev mailing list.