* [Buildroot] [PATCH] support/scripts: fix RPATH fixups
@ 2024-09-11 19:09 Yann E. MORIN
2024-09-16 9:37 ` Yann E. MORIN
2024-09-20 14:53 ` Peter Korsgaard
0 siblings, 2 replies; 7+ messages in thread
From: Yann E. MORIN @ 2024-09-11 19:09 UTC (permalink / raw)
To: buildroot; +Cc: Yann E. MORIN
Commit a87abcf6da65 (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>
---
support/scripts/fix-rpath | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/support/scripts/fix-rpath b/support/scripts/fix-rpath
index 1e58646cea..d3421504a5 100755
--- a/support/scripts/fix-rpath
+++ b/support/scripts/fix-rpath
@@ -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
--
2.46.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Buildroot] [PATCH] support/scripts: fix RPATH fixups
2024-09-11 19:09 [Buildroot] [PATCH] support/scripts: fix RPATH fixups Yann E. MORIN
@ 2024-09-16 9:37 ` Yann E. MORIN
2024-09-16 12:51 ` Adam Duskett
2024-09-20 14:53 ` Peter Korsgaard
1 sibling, 1 reply; 7+ messages in thread
From: Yann E. MORIN @ 2024-09-16 9:37 UTC (permalink / raw)
To: buildroot
All,
On 2024-09-11 21:09 +0200, Yann E. MORIN spake thusly:
> Commit a87abcf6da65 (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>
José provided their review on the GitLab issue:
https://gitlab.com/buildroot.org/buildroot/-/issues/39#note_2100795051
Tested-by: José Luis Salvador Rufo <salvador.joseluis@gmail.com>
Reviewed-by: José Luis Salvador Rufo <salvador.joseluis@gmail.com>
Regards,
Yann E. MORIN.
> ---
> support/scripts/fix-rpath | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/support/scripts/fix-rpath b/support/scripts/fix-rpath
> index 1e58646cea..d3421504a5 100755
> --- a/support/scripts/fix-rpath
> +++ b/support/scripts/fix-rpath
> @@ -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
> --
> 2.46.0
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Buildroot] [PATCH] support/scripts: fix RPATH fixups
2024-09-16 9:37 ` Yann E. MORIN
@ 2024-09-16 12:51 ` Adam Duskett
0 siblings, 0 replies; 7+ messages in thread
From: Adam Duskett @ 2024-09-16 12:51 UTC (permalink / raw)
To: Yann E. MORIN; +Cc: buildroot
Tested-by: Adam Duskett <adam.duskett@amarulasolutions.com>
Reviewed-by: Adam Duskett <adam.duskett@amarulasolutions.com>
On Mon, Sep 16, 2024 at 11:37 AM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>
> All,
>
> On 2024-09-11 21:09 +0200, Yann E. MORIN spake thusly:
> > Commit a87abcf6da65 (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>
>
> José provided their review on the GitLab issue:
> https://gitlab.com/buildroot.org/buildroot/-/issues/39#note_2100795051
>
> Tested-by: José Luis Salvador Rufo <salvador.joseluis@gmail.com>
> Reviewed-by: José Luis Salvador Rufo <salvador.joseluis@gmail.com>
>
> Regards,
> Yann E. MORIN.
>
> > ---
> > support/scripts/fix-rpath | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/support/scripts/fix-rpath b/support/scripts/fix-rpath
> > index 1e58646cea..d3421504a5 100755
> > --- a/support/scripts/fix-rpath
> > +++ b/support/scripts/fix-rpath
> > @@ -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
> > --
> > 2.46.0
> >
> > _______________________________________________
> > buildroot mailing list
> > buildroot@buildroot.org
> > https://lists.buildroot.org/mailman/listinfo/buildroot
>
> --
> .-----------------.--------------------.------------------.--------------------.
> | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
> | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
> '------------------------------^-------^------------------^--------------------'
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Buildroot] [PATCH] support/scripts: fix RPATH fixups
2024-09-11 19:09 [Buildroot] [PATCH] support/scripts: fix RPATH fixups Yann E. MORIN
2024-09-16 9:37 ` Yann E. MORIN
@ 2024-09-20 14:53 ` Peter Korsgaard
2024-09-27 9:39 ` Anssi Hannula via buildroot
1 sibling, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2024-09-20 14:53 UTC (permalink / raw)
To: Yann E. MORIN; +Cc: buildroot
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> Commit a87abcf6da65 (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>
Committed, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Buildroot] [PATCH] support/scripts: fix RPATH fixups
2024-09-20 14:53 ` Peter Korsgaard
@ 2024-09-27 9:39 ` Anssi Hannula via buildroot
2024-09-27 10:58 ` Peter Korsgaard
0 siblings, 1 reply; 7+ messages in thread
From: Anssi Hannula via buildroot @ 2024-09-27 9:39 UTC (permalink / raw)
To: Peter Korsgaard; +Cc: Yann E. MORIN, buildroot
On 20.9.2024 17.53, Peter Korsgaard wrote:
>>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> > Commit a87abcf6da65 (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>
>
> Committed, thanks.
>
The triggering commit was backported to 2024.08.x and 2024.02.x too so
they are affected, can we get this one there as well?
Thanks.
--
Anssi Hannula / Bitwise Oy
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Buildroot] [PATCH] support/scripts: fix RPATH fixups
2024-09-27 9:39 ` Anssi Hannula via buildroot
@ 2024-09-27 10:58 ` Peter Korsgaard
2024-10-12 13:55 ` Peter Korsgaard
0 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2024-09-27 10:58 UTC (permalink / raw)
To: Anssi Hannula; +Cc: Yann E. MORIN, buildroot
>>>>> "Anssi" == Anssi Hannula <anssi.hannula@bitwise.fi> writes:
Hi,
>> > 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>
>>
>> Committed, thanks.
>>
> The triggering commit was backported to 2024.08.x and 2024.02.x too so
> they are affected, can we get this one there as well?
Yes, I will handle it next time I sync the stable trees.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Buildroot] [PATCH] support/scripts: fix RPATH fixups
2024-09-27 10:58 ` Peter Korsgaard
@ 2024-10-12 13:55 ` Peter Korsgaard
0 siblings, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2024-10-12 13:55 UTC (permalink / raw)
To: Anssi Hannula; +Cc: Yann E. MORIN, buildroot
>>>>> "Peter" == Peter Korsgaard <peter@korsgaard.com> writes:
>>>>> "Anssi" == Anssi Hannula <anssi.hannula@bitwise.fi> writes:
> Hi,
>>> > 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>
>>>
>>> Committed, thanks.
>>>
>> The triggering commit was backported to 2024.08.x and 2024.02.x too so
>> they are affected, can we get this one there as well?
> Yes, I will handle it next time I sync the stable trees.
Committed to 2024.02.x and 2024.08.x, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-10-12 13:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-11 19:09 [Buildroot] [PATCH] support/scripts: fix RPATH fixups Yann E. MORIN
2024-09-16 9:37 ` Yann E. MORIN
2024-09-16 12:51 ` Adam Duskett
2024-09-20 14:53 ` Peter Korsgaard
2024-09-27 9:39 ` Anssi Hannula via buildroot
2024-09-27 10:58 ` Peter Korsgaard
2024-10-12 13:55 ` Peter Korsgaard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.