[Buildroot] [PATCH 2/4] support/scripts/check-host-bins: report RPATH errors after library errors

Matthew Weber matt at thewebers.ws
Wed Sep 9 12:39:23 UTC 2026


The missing-library check sets the overall error status before the RPATH
check. Use a separate flag for the RPATH diagnostic header so both errors are
reported when applicable.

Assisted-by: GitHub Copilot [VS Code]
Signed-off-by: Matthew Weber <matt at thewebers.ws>
---
Depends on v3 of the check-host-bins series:
https://patchwork.ozlabs.org/project/buildroot/list/?series=520240

The test script is available at:
https://gist.github.com/matthew-l-weber/34fae15a4319a81462961eadf0e31164

While exercising v3's missing-library check, a mixed dependency case exposed
that it sets the shared error status before the RPATH diagnostic is emitted.
The existing header guard then suppresses the RPATH header.

Test 3k creates a binary with two non-toolchain dependencies. One is placed
in the synthetic HOST_DIR/lib, while the other remains absent, and the binary
uses an invalid RPATH. It verifies that check-host-bins emits both the
missing-library diagnostic and a separate RPATH diagnostic header.

 support/scripts/check-host-bins | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/support/scripts/check-host-bins b/support/scripts/check-host-bins
index cddf6a08b2..5233f6cd1d 100755
--- a/support/scripts/check-host-bins
+++ b/support/scripts/check-host-bins
@@ -12,12 +12,13 @@ main() {
     local pkg="${1}"
     local hostdir="${2}"
     local perpackagedir="${3}"
-    local file ret
+    local file ret rpath_hdr missing_libs
 
     # Remove duplicate and trailing '/' for proper match
     hostdir="$( sed -r -e 's:/+:/:g; s:/$::;' <<<"${hostdir}" )"
 
     ret=0
+    rpath_hdr=0
     while read -r file; do
         is_elf "${file}" || continue
         elf_needs_rpath "${file}" "${hostdir}" || continue
@@ -30,7 +31,8 @@ main() {
             printf '  - %s\n' ${missing_libs}
         fi
         check_elf_has_rpath "${file}" "${hostdir}" "${perpackagedir}" && continue
-        if [ ${ret} -eq 0 ]; then
+        if [ ${rpath_hdr} -eq 0 ]; then
+            rpath_hdr=1
             ret=1
             printf "***\n"
             printf "*** ERROR: package %s installs executables without proper RPATH:\n" "${pkg}"
-- 
2.39.5



More information about the buildroot mailing list