[Buildroot] [PATCH next 1/2] package/apr-util: fix build with per-package folders

Thomas Petazzoni thomas.petazzoni at bootlin.com
Thu Nov 15 15:21:06 UTC 2018

With per-package folder support enable, 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

   Due to this, the compiler from the 'apr' per-package folder 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
   folder, so it does not find the expat library.

We fix both issues by doing the necessary replacement in both rules.mk
and libtool. For rules.mk, since it's in the source directoryt, we can
do the replacement in-place. For libtool, since it's hard-linked
between the 'apr' copy and the 'apr-util' copy, we need to make a
temporary copy to break the hard link and do the replacement.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
 package/apr-util/apr-util.mk | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/package/apr-util/apr-util.mk b/package/apr-util/apr-util.mk
index b006964ccb..e685f76838 100644
--- a/package/apr-util/apr-util.mk
+++ b/package/apr-util/apr-util.mk
@@ -15,6 +15,15 @@ APR_UTIL_CONF_OPTS = \
+	$(SED) 's,$(PER_PACKAGE_DIR)/apr/,$(PER_PACKAGE_DIR)/apr-util/,g' $(@D)/build/rules.mk
+	cp $(STAGING_DIR)/usr/build-1/libtool $(STAGING_DIR)/usr/build-1/libtool.fixed
+	$(SED) 's,$(PER_PACKAGE_DIR)/apr/,$(PER_PACKAGE_DIR)/apr-util/,g' \
+		$(STAGING_DIR)/usr/build-1/libtool.fixed
+	mv $(STAGING_DIR)/usr/build-1/libtool.fixed $(STAGING_DIR)/usr/build-1/libtool
 # When iconv is available, then use it to provide charset conversion
 # features.

More information about the buildroot mailing list