[Buildroot] [PATCH] Revert "check-host-rpath: no longer allow $(HOST_DIR)/usr"

Yann E. MORIN yann.morin.1998 at free.fr
Tue Sep 5 17:55:45 UTC 2017

We no longer have any host package that installs files in
$(HOST_DIR)/usr, so we indeed no longer have any package that is
supposed to have an RPATH to $(HOST_DIR)/usr/lib.

However, there exists out-of-tree packages that hard-code that path in
there build-system, and they are now broken.

This reverts commit 1d11d6314cd5ab793b5f2db784d11614f2d2d604.

Reported-by: Adam Duskett <aduskett at gmail.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998 at free.fr>
Cc: Adam Duskett <aduskett at gmail.com>
Cc: Arnout Vandecappelle <arnout at mind.be>

Note: I'm not sure we really want to revert it; this is just to
kickstart the discussion.
 support/scripts/check-host-rpath | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/support/scripts/check-host-rpath b/support/scripts/check-host-rpath
index 74a25ba99c..2846d5eb51 100755
--- a/support/scripts/check-host-rpath
+++ b/support/scripts/check-host-rpath
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash
 # This script scans $(HOST_DIR)/{bin,sbin} for all ELF files, and checks
-# they have an RPATH to $(HOST_DIR)/lib if they need libraries from
+# they have an RPATH to $(HOST_DIR)/{,usr/}lib if they need libraries from
 # there.
 # Override the user's locale so we are sure we can parse the output of
@@ -59,6 +59,8 @@ check_elf_has_rpath() {
             # Remove duplicate and trailing '/' for proper match
             dir="$( sed -r -e 's:/+:/:g; s:/$::;' <<<"${dir}" )"
             [ "${dir}" = "${hostdir}/lib" -o "${dir}" = "\$ORIGIN/../lib" ] && return 0
+            # For the time being, the rpath is allowed with both usr/lib and lib
+            [ "${dir}" = "${hostdir}/usr/lib" -o "${dir}" = "\$ORIGIN/../../usr/lib" ] && return 0
     done < <( readelf -d "${file}"                                              \
               |sed -r -e '/.* \(R(UN)?PATH\) +Library r(un)?path: \[(.+)\]$/!d' \

More information about the buildroot mailing list