I had found this problem quite a while ago and had submitted a spec file that
fixed the problem at least for me. It seems that when apache2 is compiled
with --disable-shared it creates a libtool that has "build_libtool_libs=no"
and that is what was causing my problems.
I had added the following to the "install" section:
%if "%{with_shared_core}" == "yes"
%{l_shtool} subst \
-e 's;^build_libtool_libs=no;build_libtool_libs=yes;' \
$RPM_BUILD_ROOT%{l_prefix}/share/apache2/build/libtool
%endif
Looking at the apache2.spec in the sources that is still in there. I am able
to compile mod_dav_svn, mod_php, mod_suphp, and mod_pubcookie as shared
modules with that configuration. It is possible that none of those modules
use apxs directly and use %{l_prefix}/share/apache2/build/libtool to build
the module instead.
I even submitted a bug report to the apache project, because this used to work
just fine in apache 1.3.x. I just got a response that said this was by design
and that was it.
Mark Keller
Lead Systems Administrator
Portland State University
On Wednesday 21 September 2005 7:12, Andreas Schmidt wrote:
> Hi openpkg-users,
>
> while trying to build the apache mod_jk connector for apache2 with
> openpkg (the tomcat-adapter in openpkg's current-directory only supports
> apache 1.3) it seems that i've found some misconfiguration in the
> build-process of openpkg's apache2-package when building with
> with_core_so=yes. The resulting apache runs fine, and is able to load
> DSO from foreign sources, but i found no way to create a DSO for mod_jk
> with the apache's apxs-tool. The created apxs seem's to disallow the
> creation of shared-objects.
>
> After some try-and-error-modifications in apache2.spec i figured out,
> that apache's configure-option --disable-shared is responsible for this.
> So i removed that option in case of "with_shared_core=yes", and was able
> to build mod_jk with the help of the new apxs. To still avoid the
> creation of shared modues by default, i now use
> --enable-mods-shared=none, when building with with_shared_core=yes.
>
> Here's the diff to the original apache2.spec:
>
> 55c55,60
> < %option with_shared_core no
> ---
>
> > %option with_shared_core yes
> >
> > # if we set with_shared_core, we can specify a list of DSO-modules in
> > # single quotes or use one of the predefined special values
> > # "none", "all" and "most"
> > %option mods_shared none
>
> 105a111,116
>
> > NOTICE2: This is a derived version of the original apache2 package
> > of openpkg. It modifies the original configuration to enable
> > DSO support for apxs. This is necessary, if you want to build
>
> DSO-modules
>
> > with this apache's apxs-instance.
>
> 209a221,224
>
> > --enable-mods-shared=%{mods_shared} \
> > %endif
> > %if "%{with_shared_core}" == "no"
> > --disable-shared \
>
> 218d232
> < --disable-shared \
>
>
> As you can see, i've added a new build option "mods_shared", that allows
> to create some of apaches modules as DSO. But the default remains "none".
>
> I'm not sure, if what i've done is contrary to openpkg's
> avoid-shared-objects strategy, but since the resulting httpd doesn't
> contain any DSO, as long as you don't change the default-value of
> "mod_shared", the resulting httpd still shouldn't use any shared
> objects, unless you add some extra DSO in the httpd.conf.
>
>
> With this apache's apxs, i was able to build the tomcat connector module
> mod_jk. For those who need this as well, i add my apache2-mod_jk.spec,
> which is based on the tomcat-apache.spec of openpkg's current-directory:
>
> -------START OF SPEC -------------
>
> ##
> ## apache2-mod_jk.spec -- OpenPKG RPM Package Specification
> ## Copyright (c) 2000-2005 OpenPKG Foundation e.V. <http://openpkg.net/>
> ## Copyright (c) 2000-2005 Ralf S. Engelschall <http://engelschall.com/>
> ##
> ## Permission to use, copy, modify, and distribute this software for
> ## any purpose with or without fee is hereby granted, provided that
> ## the above copyright notice and this permission notice appear in all
> ## copies.
> ##
> ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
> ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
> ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> ## SUCH DAMAGE.
> ##
>
> # package information
> Name: apache2-mod_jk
> Summary: Apache Jakarta Tomcat Webserver Adapter
> URL: http://jakarta.apache.org/
> Vendor: Apache Software Foundation
> Packager: OpenPKG
> Distribution: OpenPKG
> Class: EVAL
> Group: Web
> License: Apache Software License 1.1
> Version: 1.2.14
> Release: 20050921
>
> # package options
>
> # list of sources
> Source0:
> http://www.apache.org/dist/jakarta/tomcat-connectors/jk/source/jk-%{version
>}/jakarta-tomcat-connectors-%{version}.1-src.tar.gz Source1:
> apache2-mod_jk.conf
>
> # build information
> Prefix: %{l_prefix}
> BuildRoot: %{l_buildroot}
> BuildPreReq: OpenPKG, openpkg >= 20040130, perl, gcc, make
> PreReq: OpenPKG, openpkg >= 20040130
> BuildPreReq: apache2so
> PreReq: apache2so
> AutoReq: no
> AutoReqProv: no
>
> %description
> Apache Jakarta Tomcat webserver adapter mod_jk is a glue code
> between the
> Apache HTTP server and Apache Tomcat. This package contains the
> mod_jk connector for Apache 2 only.
>
> %track
> prog tomcat-adapter = {
> version = %{version}
> url =
> http://www.apache.org/dist/jakarta/tomcat-connectors/jk/source/
> regex = (jk-\d+\.\d+\.\d+)
> url =
> http://www.apache.org/dist/jakarta/tomcat-connectors/jk/source/__NEWVER__/
> regex = jakarta-tomcat-connectors-(__VER__)-src\.tar\.gz
> }
>
> %prep
> %setup -q -n jakarta-tomcat-connectors-%{version}.1-src
>
> %build
> ( cd jk/native
> export CC="%{l_cc}"
> export CFLAGS="%{l_cflags -O}"
> export CPPFLAGS="%{l_cppflags}"
> export LDFLAGS="%{l_ldflags}"
> ./configure \
> --prefix=%{l_prefix} \
> --with-apxs=%{l_prefix}/sbin/apxs
> %{l_make} %{l_mflags} LIBTOOL=$PWD/libtool
> ) || exit $?
>
> %install
> rm -rf $RPM_BUILD_ROOT
>
> # create installation tree
> %{l_shtool} mkdir -f -p -m 755 \
> $RPM_BUILD_ROOT%{l_prefix}/etc/apache2-mod_jk \
> $RPM_BUILD_ROOT%{l_prefix}/libexec/apache2-mod_jk \
> $RPM_BUILD_ROOT%{l_prefix}/var/apache2-mod_jk
>
> # install config
> %{l_shtool} install -c -m 644 %{l_value -s -a} \
> %{SOURCE apache2-mod_jk.conf} \
> $RPM_BUILD_ROOT%{l_prefix}/etc/apache2-mod_jk/
>
> # install mod_jk DSO
> %{l_shtool} install -c -m 755 \
> jk/native/apache-2.0/mod_jk.so \
> $RPM_BUILD_ROOT%{l_prefix}/libexec/apache2-mod_jk/mod_jk.so
>
> # determine installation files
> %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
> %{l_files_std} \
> '%config %{l_prefix}/etc/apache2-mod_jk/*'
>
> %files -f files
>
> %clean
> rm -rf $RPM_BUILD_ROOT
>
> ------- END OF SPEC -------------
>
> my changes to the original spec-file were:
> - change the package-name to apache2-mod_jk
> - use just the connector-package from apache, not the whole tomcat-package.
> - set the same compiler/linker-environment as in apache2.spec before the
> configure-call. without got some error-messages saying something about
> "tagged versions". i didn't understand this at all, but some
> code-sniffing and try-and-error lead to this solution.
> - remove the apache-1.3-specific build-code
> - remove the not needed dependencies
> - change the dependency from apache to apache2so, which is the name i
> gave my modified apache2-package. in case of my changes would become
> part of the openpkg-apache2-package, it would be necessary to ensure
> that the apache2 was build with "with_shared_core=yes".
>
> I was also able to build an apache2 with static linked mod_jk --
> unfortunately not as an openpkg-rpm. For this, it was necessary to:
> 1. build apache2
> 2. build mod_jk and modifiy apache2-source-tree
> 3. rebuild apache2
> Since I didn't see a way, how to do this in a package external to the
> core apache2-package, i preferred the solution with the DSO. On the
> other hand, if mod_jk would be an build-option of apache2-package this
> would allow allow a smoother integration of the mod_jk-configuration.
> but this was to complicated for my basic understanding of rpm.spec-files.
>
>
> I have to admit, that I don't understand deeply, what i did here (i'm
> still an openpkg novice, and not a specialist in unix-build-prcesses at
> all), and most of it is the result of try-and-error. But maybe it helps
> some other openpkg-guru to build a correct package for apache2 with
> mod_jk-support.
> Since i don't know how to configure and use the %track-section in the
> spec file, you should give it a close look, in case you want to use it.
>
>
> Hope that helps others, who, like me, try to use apache2/java/tomcat in
> an openpkg environment.
>
> andi
>
> ______________________________________________________________________
> The OpenPKG Project www.openpkg.org
> User Communication List [email protected]
______________________________________________________________________
The OpenPKG Project www.openpkg.org
User Communication List [email protected]