[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#913094: apache2 FTCBFS: multiple reasons



Source: apache2
Version: 2.4.37-1
Tags: patch
User: helmutg@debian.org
Usertags: rebootstrap

apache2 fails to cross build from source. Let me explain the individual
subproblems.

 * The build dependency on the host architecture perl conflicts with the
   essential build architecture perl. It turns out, apache2 wants to run
   perl during build, so it actually needs the build architecture perl.
   Annotating the dependency with :any fixes that.

 * ./configure fails finding .pc files, because it uses the build
   architecture pkg-config. It should be using AC_PATH_TOOL (or better
   PKG_PROG_PKG_CONFIG) rather than AC_PATH_PROG.

 * Fixing configure.ac does not influence the build as ./configure is
   not built from source. dh-autoreconf fixes that.

 * Finally, the build fails running ./server/gen_test_char. It should be
   built with the build architecture compiler, but the build system is
   incapable of doing so. The mailing list suggests just compiling and
   running that file ahead of the actual build.

After applying the attached patch, apache2 cross builds successfully.
Please consider using it.

Helmut
diff --minimal -Nru apache2-2.4.37/debian/changelog apache2-2.4.37/debian/changelog
--- apache2-2.4.37/debian/changelog	2018-11-03 14:26:31.000000000 +0100
+++ apache2-2.4.37/debian/changelog	2018-11-06 20:19:31.000000000 +0100
@@ -1,3 +1,13 @@
+apache2 (2.4.37-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Annotate perl build dependency with :any.
+    + cross.patch: Use AC_PATH_TOOL to find pkg-config.
+    + Generate server/test_char.h ahead of the build
+
+ -- Helmut Grohne <helmut@subdivi.de>  Tue, 06 Nov 2018 20:19:31 +0100
+
 apache2 (2.4.37-1) unstable; urgency=medium
 
   * New upstream version
diff --minimal -Nru apache2-2.4.37/debian/control apache2-2.4.37/debian/control
--- apache2-2.4.37/debian/control	2018-11-03 12:34:33.000000000 +0100
+++ apache2-2.4.37/debian/control	2018-11-06 20:19:31.000000000 +0100
@@ -6,6 +6,7 @@
            Arno Töll <arno@debian.org>,
            Ondřej Surý <ondrej@debian.org>
 Build-Depends: debhelper (>= 9.20160709~),
+               dh-autoreconf,
                dpkg-dev (>= 1.16.1~),
                gawk | awk,
                libapr1-dev (>= 1.6.0),
@@ -17,7 +18,7 @@
                libssl-dev (>= 1.1.1),
                libxml2-dev,
                lsb-release,
-               perl,
+               perl:any,
                zlib1g-dev,
                libcurl4-openssl-dev | libcurl4-dev,
                libjansson-dev
diff --minimal -Nru apache2-2.4.37/debian/patches/cross.patch apache2-2.4.37/debian/patches/cross.patch
--- apache2-2.4.37/debian/patches/cross.patch	1970-01-01 01:00:00.000000000 +0100
+++ apache2-2.4.37/debian/patches/cross.patch	2018-11-06 20:19:31.000000000 +0100
@@ -0,0 +1,11 @@
+--- apache2-2.4.37.orig/configure.in
++++ apache2-2.4.37/configure.in
+@@ -370,7 +370,7 @@
+ dnl ## Check for programs
+ 
+ AC_PATH_PROG(RM, rm)
+-AC_PATH_PROG(PKGCONFIG, pkg-config)
++AC_PATH_TOOL(PKGCONFIG, pkg-config)
+ AC_PATH_PROG(RSYNC, rsync)
+ AC_PROG_AWK
+ AC_PROG_LN_S
diff --minimal -Nru apache2-2.4.37/debian/patches/series apache2-2.4.37/debian/patches/series
--- apache2-2.4.37/debian/patches/series	2018-11-03 14:26:31.000000000 +0100
+++ apache2-2.4.37/debian/patches/series	2018-11-06 20:19:31.000000000 +0100
@@ -8,3 +8,4 @@
 # This patch is applied manually
 #suexec-custom.patch
 setenvifexpr.diff
+cross.patch
diff --minimal -Nru apache2-2.4.37/debian/rules apache2-2.4.37/debian/rules
--- apache2-2.4.37/debian/rules	2018-11-03 12:34:33.000000000 +0100
+++ apache2-2.4.37/debian/rules	2018-11-06 20:19:31.000000000 +0100
@@ -9,6 +9,8 @@
 export DEB_BUILD_MAINT_OPTIONS=hardening=+bindnow
 include /usr/share/dpkg/buildflags.mk
 include /usr/share/dpkg/architecture.mk
+-include /usr/share/dpkg/buildtools.mk
+CC_FOR_BUILD ?= cc
 
 LSB_RELEASE := $(shell lsb_release -i -s)
 SERVER_VERSION := $(shell dpkg-parsechangelog | perl -ne 'print $$1 if m/Version:\s*([\d\.]+)/')
@@ -100,7 +102,7 @@
 	touch $@
 
 clean build build-arch build-indep binary binary-arch binary-indep: %:
-	dh $@ --parallel --with systemd
+	dh $@ --parallel --with systemd --with=autoreconf
 
 override_dh_auto_configure: configure-stamp
 configure-stamp: prebuild-checks-stamp support/suexec-custom.c
@@ -118,6 +120,11 @@
 		--enable-mods-static="unixd logio watchdog version" \
 		CFLAGS="$(AP2_CFLAGS)" CPPFLAGS="$(AP2_CPPFLAGS)" LDFLAGS="$(AP2_LDFLAGS)" \
 		LTFLAGS="$(AP2_LTFLAGS)" SHELL=/bin/bash
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+	touch server/gen_test_char.lo
+	$(CC_FOR_BUILD) -DCROSS_COMPILE server/gen_test_char.c -o server/gen_test_char
+	./server/gen_test_char > server/test_char.h
+endif
 	touch $@
 
 debian/config-dir/apache2.conf: debian/config-dir/apache2.conf.in

Reply to: