mirror of
https://git.busybox.net/buildroot.git
synced 2024-11-23 13:33:28 +08:00
support/scripts: fix RPATH fixups
Commita87abcf6da
(Makefile: run PPD and RPATH fixup in host-fialize) (sic) moved the fixups peviously done in prepare-sdk, to host-finalize. This exposed a bug in fix-rpath, when RPATH contains multiple entries, like: /PPD/host-foo/host/lib:/PPD/host-foo/host/lib/foo In that situation, we want to get rid of /PPD/host-foo and replace it with the finale HOST_DIR, so we mangle the RPATH with a sed expression. However, that sed expression only ever replaces the first match, as it is missing the 'g' option. Thus, the second (and following) parts of RPATH are still referring to the PPD, and thus patchelf does not find it relative to the final HOST_DIR, amd rops it. This eventually lead to a final RPATH set as $ORIGIN/../lib instead of the expected $ORIGIN/../lib:$ORIGIN/../lib/foo This is the case for host-systemd, which installs some of its libraries in $PREFIX/lib/systemd/ and adds an RPATH set appropriately to /PPD/host-systemd/host/lib:/PPD/host-systemd/host/lib/systemd and that gets incorrectly mangled. Fixes: https://gitlab.com/buildroot.org/buildroot/-/issues/39 Also fix a typo in the comment just above. Reported-by: José Luis Salvador Rufo @jlsalvador Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Tested-by: José Luis Salvador Rufo <salvador.joseluis@gmail.com> Reviewed-by: José Luis Salvador Rufo <salvador.joseluis@gmail.com> Tested-by: Adam Duskett <adam.duskett@amarulasolutions.com> Reviewed-by: Adam Duskett <adam.duskett@amarulasolutions.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com> (cherry picked from commit2100a76d9e
) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
parent
99cf714dd8
commit
0209d05619
@ -84,9 +84,9 @@ patch_file() {
|
||||
# work with the --make-rpath-relative ${rootdir} invocation as
|
||||
# the per-package host directory is not within ${rootdir}. So,
|
||||
# we rewrite all RPATHs pointing to per-package directories so
|
||||
# that they point to the global host directry.
|
||||
# that they point to the global host directory.
|
||||
# shellcheck disable=SC2001 # ${var//search/replace} hard when search or replace have / in them
|
||||
changed_rpath="$(echo "${rpath}" | sed "s@${PER_PACKAGE_DIR}/[^/]\+/host@${HOST_DIR}@")"
|
||||
changed_rpath="$(echo "${rpath}" | sed "s@${PER_PACKAGE_DIR}/[^/]\+/host@${HOST_DIR}@g")"
|
||||
if test "${rpath}" != "${changed_rpath}" ; then
|
||||
"${PATCHELF}" --set-rpath "${changed_rpath}" "${file}"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user