Skip to contentSkip to conversation

package/apr-util: fix build with per-package directories

PATCH New Thomas Petazzoni 2 participants 4 messages Feb 17, 2020 – Feb 18, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/apr-util: fix build with per-package directories

With per-package directories support enabled, the build of apr-util fails, for two reasons:

- The rules.mk file is generated by the 'apr' package, and then copied into the 'apr-util' source directory. This is done by the 'apr-util' build process. Unfortunately, this rules.mk file has a number of hardcoded paths: to the compiler and to the libtool script.

Due to this, the compiler from the 'apr' per-package directory gets used. But this compiler uses the 'apr' package sysroot, which does not have all the dependencies of the 'apr-util' package, causing the build to fail because <expat.h> is not found.

- Similarly, the libtool script itself has some hardcoded paths, which make it use the compiler/linker from the 'apr' per-package directory, so it does not find the expat library.

We fix both issues by doing the necessary replacement in both rules.mk and libtool.

Fixes:

http://autobuild.buildroot.net/results/2a67b5d58f79348e20a972125e4797eff5585716/

---
 package/apr-util/apr-util.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)
package/apr-util/apr-util.mk +10 -0
index b006964ccb..53b633b159 100644
@@ -15,6 +15,16 @@ APR_UTIL_CONF_OPTS = \
 	--with-apr=$(STAGING_DIR)/usr/bin/apr-1-config
 APR_UTIL_CONFIG_SCRIPTS = apu-1-config
 
+ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y)
+define APR_UTIL_FIX_RULES_MK_LIBTOOL
+	$(SED) 's,$(PER_PACKAGE_DIR)/apr/,$(PER_PACKAGE_DIR)/apr-util/,g' \
+		$(@D)/build/rules.mk
+	$(SED) 's,$(PER_PACKAGE_DIR)/apr/,$(PER_PACKAGE_DIR)/apr-util/,g' \
+		$(STAGING_DIR)/usr/build-1/libtool
+endef
+APR_UTIL_POST_CONFIGURE_HOOKS += APR_UTIL_FIX_RULES_MK_LIBTOOL
+endif
+
 # When iconv is available, then use it to provide charset conversion
 # features.
 APR_UTIL_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBICONV),libiconv)
Signature · 1 line
2.24.1
#1 lore raw

PATCH 2/2 package/apache: fix build with per-package directory support

When APR_INCLUDEDIR and APU_INCLUDEDIR point to the same directory, Apache builds properly. However, with per-package directory support, they point to different directories, and APU_INCLUDEDIR contains both the APR headers and the APU headers.

Due to this, the Apache Makefile logic to generate its exports.c file leads to duplicate definitions, because the APR headers are considered
twice: once from APR_INCLUDEDIR, once from APU_INCLUDEDIR.

We fix this by introducing a patch to the Apache build system.

In addition, apr provides a special libtool script that gets used by apr-util and apache. apr-util already had a fixup for this, but apache did not, which was causing the gcc from apr-util per-package directories be used during the apache build, causing build failures.

To fix this, we adjust this libtool script to point to the correct tools in apache's per-package directories.

There are no autobuilder failures for this, because Apache needs apr-util, and apr-util currently fails to build when BR2_PER_PACKAGE_DIRECTORIES=y.

---
 ...in-handle-separate-APR_INCLUDE_DIR-A.patch | 48 +++++++++++++++++++
 package/apache/apache.mk                      |  8 ++++
 2 files changed, 56 insertions(+)
 create mode 100644 package/apache/0003-server-Makefile.in-handle-separate-APR_INCLUDE_DIR-A.patch
package/apache/0003-server-Makefile.in-handle-separate-APR_INCLUDE_DIR-A.patch new file +48 -0
new file mode 100644
index 0000000000..b4ad128677
@@ -0,0 +1,48 @@
+From 00281390e82db18fe0de4033be4045f9391a8ee5 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <[email protected]>
+Date: Thu, 15 Nov 2018 14:04:29 +0100
+Subject: [PATCH] server/Makefile.in: handle separate
+ APR_INCLUDE_DIR/APU_INCLUDE_DIR
+
+If APR_INCLUDEDIR and APU_INCLUDEDIR point to different directories,
+but for example APU_INCLUDEDIR contains both the apr headers and apu
+headers, the "export_files" file will contain duplicate header files,
+causing the exports.c file to contain duplicate definitions, making
+the build fail.
+
+This commit fixes that by making sure we only use the apr headers from
+APR_INCLUDEDIR and the apu headers from the APU_INCLUDEDIR.
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+Upstream: https://bz.apache.org/bugzilla/show_bug.cgi?id=62930
+---
+ server/Makefile.in | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/server/Makefile.in b/server/Makefile.in
+index 1fa334467d..2258f0bdf2 100644
+--- a/server/Makefile.in
++++ b/server/Makefile.in
+@@ -34,7 +34,6 @@ test_char.h: gen_test_char
+ util.lo: test_char.h
+ 
+ EXPORT_DIRS = $(top_srcdir)/include $(top_srcdir)/os/$(OS_DIR)
+-EXPORT_DIRS_APR = $(APR_INCLUDEDIR) $(APU_INCLUDEDIR)
+ 
+ # If export_files is a dependency here, but we remove it during this stage,
+ # when exports.c is generated, make will not detect that export_files is no
+@@ -60,9 +59,8 @@ export_files:
+ 	      ls $$dir/*.h ; \
+ 	  done; \
+ 	  echo "$(top_srcdir)/server/mpm_fdqueue.h"; \
+-	  for dir in $(EXPORT_DIRS_APR); do \
+-	      ls $$dir/ap[ru].h $$dir/ap[ru]_*.h 2>/dev/null; \
+-	  done; \
++	  ls $(APR_INCLUDE_DIR)/{apr.h,apr_*.h} 2>/dev/null; \
++	  ls $(APU_INCLUDE_DIR)/{apu.h,apu_*.h} 2>/dev/null; \
+ 	) | sed -e s,//,/,g | sort -u > $@
+ 
+ exports.c: export_files
+-- 
+2.19.1
+
package/apache/apache.mk +8 -0
index 22e7be8832..5fcb9e5371 100644
@@ -16,6 +16,14 @@ APACHE_INSTALL_STAGING = YES
 APACHE_AUTORECONF = YES
 APACHE_DEPENDENCIES = apr apr-util pcre
 
+ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y)
+define APACHE_FIXUP_APR_LIBTOOL
+	$(SED) "s@$(PER_PACKAGE_DIR)/[^/]\+/@$(PER_PACKAGE_DIR)/apache/@g" \
+		$(STAGING_DIR)/usr/build-1/libtool
+endef
+APACHE_POST_CONFIGURE_HOOKS += APACHE_FIXUP_APR_LIBTOOL
+endif
+
 APACHE_CONF_ENV= \
 	ap_cv_void_ptr_lt_long=no \
 	PCRE_CONFIG=$(STAGING_DIR)/usr/bin/pcre-config
Signature · 1 line
2.24.1
#2 lore raw

PATCH 2/2 package/apache: fix build with per-package directory support

Quoted 18 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

When APR_INCLUDEDIR and APU_INCLUDEDIR point to the same directory, Apache builds properly. However, with per-package directory support, they point to different directories, and APU_INCLUDEDIR contains both the APR headers and the APU headers.

Due to this, the Apache Makefile logic to generate its exports.c file leads to duplicate definitions, because the APR headers are considered
twice: once from APR_INCLUDEDIR, once from APU_INCLUDEDIR.

We fix this by introducing a patch to the Apache build system.

In addition, apr provides a special libtool script that gets used by apr-util and apache. apr-util already had a fixup for this, but apache did not, which was causing the gcc from apr-util per-package directories be used during the apache build, causing build failures.

Quoted 8 lines

To fix this, we adjust this libtool script to point to the correct tools in apache's per-package directories.

There are no autobuilder failures for this, because Apache needs apr-util, and apr-util currently fails to build when BR2_PER_PACKAGE_DIRECTORIES=y.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 1/2 package/apr-util: fix build with per-package directories

In reply to Thomas Petazzoni
Quoted 20 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

With per-package directories support enabled, the build of apr-util fails, for two reasons:

- The rules.mk file is generated by the 'apr' package, and then copied into the 'apr-util' source directory. This is done by the 'apr-util' build process. Unfortunately, this rules.mk file has a number of hardcoded paths: to the compiler and to the libtool script.

Due to this, the compiler from the 'apr' per-package directory gets used. But this compiler uses the 'apr' package sysroot, which does not have all the dependencies of the 'apr-util' package, causing the build to fail because <expat.h> is not found.

- Similarly, the libtool script itself has some hardcoded paths, which make it use the compiler/linker from the 'apr' per-package directory, so it does not find the expat library.

Quoted 8 lines

We fix both issues by doing the necessary replacement in both rules.mk and libtool.

Fixes:

http://autobuild.buildroot.net/results/2a67b5d58f79348e20a972125e4797eff5585716/

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard