[apparmor] [Bug 737074] Re: apache2 apparmor module missing link against libapparmor

Steve Beattie steve at nxnw.org
Fri Mar 18 02:42:40 UTC 2011


On Thu, Mar 17, 2011 at 01:13:01PM -0700, Steve Beattie wrote:
> On Thu, Mar 17, 2011 at 07:37:02PM -0000, Steve Beattie wrote:
> > Attached is a patch that fixes the issue.
> > 
> > ** Patch added: "mod_apparmor-build_fix.patch"
> >    https://bugs.launchpad.net/apparmor/+bug/737074/+attachment/1915637/+files/mod_apparmor-build_fix.patch
> 
> And for list review, the patch is below. This is both for trunk and 2.6.

Actually, the patch is subtly incorrect. Below is a corrected
patch. The quotes were causing LIBAPPARMOR_FLAGS to get passed to
apxs2 as a single argument. Additionally, the double -Wl causes the -L
argument to be passed down to the linker directly, without
interpretation by apxs2 or, more importantly, libtool, which was adding
the library search path as an rpath to the module. Passing it directly
to the linker prevents libtool from doing that.

=== modified file 'changehat/mod_apparmor/Makefile'
--- changehat/mod_apparmor/Makefile	2011-02-08 16:18:36 +0000
+++ changehat/mod_apparmor/Makefile	2011-03-18 01:27:35 +0000
@@ -41,12 +41,15 @@
 	      fi ) 
 APXS_INSTALL_DIR=$(shell ${APXS} -q LIBEXECDIR)
 DESTDIR=
-LIBAPPARMOR_FLAGS="-I../../libraries/libapparmor/src -L../../libraries/libapparmor/src/.libs -lapparmor"
+# Need to pass -Wl twice here to get past both apxs2 and libtool, as
+# libtool will add the path to the RPATH of the library if passed -L/some/path
+LIBAPPARMOR_FLAGS=-I../../libraries/libapparmor/src -Wl,-Wl,-L../../libraries/libapparmor/src/.libs
+LDLIBS=-lapparmor
 
 all: $(TARGET) ${MANPAGES} ${HTMLMANPAGES}
 
 %.so: %.c
-	${APXS} ${LIBAPPARMOR_FLAGS} -c $<
+	${APXS} ${LIBAPPARMOR_FLAGS} -c $< ${LDLIBS}
 	mv .libs/$@ .
 
 .PHONY: install


-- 
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20110317/5e00f1d1/attachment.pgp>


More information about the AppArmor mailing list