diff mbox series

[2/3] external-arm-toolchain: in libc.so GNU ld script use base_libdir

Message ID 20240417113042.91880-3-vvavrychuk@gmail.com
State New
Headers show
Series external-arm-toolchain: fix build when usrmege enabled | expand

Commit Message

Vasyl Vavrychuk April 17, 2024, 11:30 a.m. UTC
`base_libdir` gets replaced with `/lib` or `/usr/lib` depending on
`usrmerge` distro feature.

Signed-off-by: Vasyl Vavrychuk <vvavrychuk@gmail.com>
---
 .../external-arm-toolchain/external-arm-toolchain.bb          | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Denys Dmytriyenko April 17, 2024, 8:12 p.m. UTC | #1
On Wed, Apr 17, 2024 at 02:30:41PM +0300, Vasyl Vavrychuk wrote:
> `base_libdir` gets replaced with `/lib` or `/usr/lib` depending on
> `usrmerge` distro feature.
> 
> Signed-off-by: Vasyl Vavrychuk <vvavrychuk@gmail.com>
> ---
>  .../external-arm-toolchain/external-arm-toolchain.bb          | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb b/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb
> index 27aadffd..ab608128 100644
> --- a/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb
> +++ b/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb
> @@ -207,9 +207,9 @@ do_install() {
>  	rm -rf ${D}${includedir}/rpcsvc/rquota.*
>  
>  	if [ -f ${D}${libdir}/libc.so ];then
> -		sed -i -e "s# /${EAT_LIBDIR}/${EAT_TARGET_SYS}# ../../${EAT_LIBDIR}#g" -e "s# /usr/${EAT_LIBDIR}/# /usr/lib/#g" -e "s# /usr/${EAT_LIBDIR}/${EAT_TARGET_SYS}# .#g" -e "s# /${EAT_LIBDIR}/ld-linux# ../../${EAT_LIBDIR}/ld-linux#g" ${D}${libdir}/libc.so
> +		sed -i -e "s# /${EAT_LIBDIR}/${EAT_TARGET_SYS}# ../../${EAT_LIBDIR}#g" -e "s# /usr/${EAT_LIBDIR}/# /usr/lib/#g" -e "s# /usr/${EAT_LIBDIR}/${EAT_TARGET_SYS}# .#g" -e "s# /${EAT_LIBDIR}/ld-linux# ../../${base_libdir}/ld-linux#g" ${D}${libdir}/libc.so

Here ^^^ it's not clear why only the last of the sed replacements gets 
updated, not all of them?


>  		sed -i -e "s# /${EAT_LIBDIR}/libc.so.6# /lib/libc.so.6#g" ${D}${libdir}/libc.so
> -		sed -i -e "s# /lib# ../../lib#g" -e "s# /usr/lib# .#g" ${D}${libdir}/libc.so
> +		sed -i -e "s# /lib# ../../${base_libdir}#g" -e "s# /usr/lib# .#g" ${D}${libdir}/libc.so
>  	fi
>  
>  	if [ -f ${D}${base_libdir}/libc.so ];then
> -- 
> 2.40.0
>
Vasyl Vavrychuk April 18, 2024, 1:54 p.m. UTC | #2
On Wed, Apr 17, 2024 at 11:12 PM Denys Dmytriyenko <denis@denix.org> wrote:
>
> On Wed, Apr 17, 2024 at 02:30:41PM +0300, Vasyl Vavrychuk wrote:
> > -             sed -i -e "s# /${EAT_LIBDIR}/${EAT_TARGET_SYS}# ../../${EAT_LIBDIR}#g" -e "s# /usr/${EAT_LIBDIR}/# /usr/lib/#g" -e "s# /usr/${EAT_LIBDIR}/${EAT_TARGET_SYS}# .#g" -e "s# /${EAT_LIBDIR}/ld-linux# ../../${EAT_LIBDIR}/ld-linux#g" ${D}${libdir}/libc.so
> > +             sed -i -e "s# /${EAT_LIBDIR}/${EAT_TARGET_SYS}# ../../${EAT_LIBDIR}#g" -e "s# /usr/${EAT_LIBDIR}/# /usr/lib/#g" -e "s# /usr/${EAT_LIBDIR}/${EAT_TARGET_SYS}# .#g" -e "s# /${EAT_LIBDIR}/ld-linux# ../../${base_libdir}/ld-linux#g" ${D}${libdir}/libc.so
>
> Here ^^^ it's not clear why only the last of the sed replacements gets
> updated, not all of them?

1. `/${EAT_LIBDIR}/${EAT_TARGET_SYS}` path is not used in libc.so in
Arm GNU Toolchain v13.2.Rel1 in targets "arm-none-linux-gnueabihf" and
"aarch64-none-linux-gnu". I am not sure in which versions for ARM or
Linaro toolchain this path was used in libc.so. Should I replace it
blindly?
2. Rest two expressions replace input string to "/usr/lib" or ".", so
they are not affected by usrmerge.
Denys Dmytriyenko April 18, 2024, 3:57 p.m. UTC | #3
On Thu, Apr 18, 2024 at 04:54:05PM +0300, Vasyl Vavrychuk wrote:
> On Wed, Apr 17, 2024 at 11:12 PM Denys Dmytriyenko <denis@denix.org> wrote:
> >
> > On Wed, Apr 17, 2024 at 02:30:41PM +0300, Vasyl Vavrychuk wrote:
> > > -             sed -i -e "s# /${EAT_LIBDIR}/${EAT_TARGET_SYS}# ../../${EAT_LIBDIR}#g" -e "s# /usr/${EAT_LIBDIR}/# /usr/lib/#g" -e "s# /usr/${EAT_LIBDIR}/${EAT_TARGET_SYS}# .#g" -e "s# /${EAT_LIBDIR}/ld-linux# ../../${EAT_LIBDIR}/ld-linux#g" ${D}${libdir}/libc.so
> > > +             sed -i -e "s# /${EAT_LIBDIR}/${EAT_TARGET_SYS}# ../../${EAT_LIBDIR}#g" -e "s# /usr/${EAT_LIBDIR}/# /usr/lib/#g" -e "s# /usr/${EAT_LIBDIR}/${EAT_TARGET_SYS}# .#g" -e "s# /${EAT_LIBDIR}/ld-linux# ../../${base_libdir}/ld-linux#g" ${D}${libdir}/libc.so
> >
> > Here ^^^ it's not clear why only the last of the sed replacements gets
> > updated, not all of them?
> 
> 1. `/${EAT_LIBDIR}/${EAT_TARGET_SYS}` path is not used in libc.so in
> Arm GNU Toolchain v13.2.Rel1 in targets "arm-none-linux-gnueabihf" and
> "aarch64-none-linux-gnu". I am not sure in which versions for ARM or
> Linaro toolchain this path was used in libc.so. Should I replace it
> blindly?

Yeah, this list has grown with different versions of the toolchain, where 
almost every new version required a slightly different adjustment in the 
past.

And the external toolchain recipe was always trying to be version agnostic 
and work with a wide range of toolchain versions.

But I guess we could simplify the list of supported versions to what is 
currently available for download - I see that 11.x and 12.x are supported 
now. 

Can you please check if libc.so is the same in those versions? If so, we 
can potentially drop all other sed mods from here. Thanks.


> 2. Rest two expressions replace input string to "/usr/lib" or ".", so
> they are not affected by usrmerge.
Jon Mason April 29, 2024, 1:54 p.m. UTC | #4
On Thu, Apr 18, 2024 at 11:57:38AM -0400, Denys Dmytriyenko wrote:
> On Thu, Apr 18, 2024 at 04:54:05PM +0300, Vasyl Vavrychuk wrote:
> > On Wed, Apr 17, 2024 at 11:12 PM Denys Dmytriyenko <denis@denix.org> wrote:
> > >
> > > On Wed, Apr 17, 2024 at 02:30:41PM +0300, Vasyl Vavrychuk wrote:
> > > > -             sed -i -e "s# /${EAT_LIBDIR}/${EAT_TARGET_SYS}# ../../${EAT_LIBDIR}#g" -e "s# /usr/${EAT_LIBDIR}/# /usr/lib/#g" -e "s# /usr/${EAT_LIBDIR}/${EAT_TARGET_SYS}# .#g" -e "s# /${EAT_LIBDIR}/ld-linux# ../../${EAT_LIBDIR}/ld-linux#g" ${D}${libdir}/libc.so
> > > > +             sed -i -e "s# /${EAT_LIBDIR}/${EAT_TARGET_SYS}# ../../${EAT_LIBDIR}#g" -e "s# /usr/${EAT_LIBDIR}/# /usr/lib/#g" -e "s# /usr/${EAT_LIBDIR}/${EAT_TARGET_SYS}# .#g" -e "s# /${EAT_LIBDIR}/ld-linux# ../../${base_libdir}/ld-linux#g" ${D}${libdir}/libc.so
> > >
> > > Here ^^^ it's not clear why only the last of the sed replacements gets
> > > updated, not all of them?
> > 
> > 1. `/${EAT_LIBDIR}/${EAT_TARGET_SYS}` path is not used in libc.so in
> > Arm GNU Toolchain v13.2.Rel1 in targets "arm-none-linux-gnueabihf" and
> > "aarch64-none-linux-gnu". I am not sure in which versions for ARM or
> > Linaro toolchain this path was used in libc.so. Should I replace it
> > blindly?
> 
> Yeah, this list has grown with different versions of the toolchain, where 
> almost every new version required a slightly different adjustment in the 
> past.
> 
> And the external toolchain recipe was always trying to be version agnostic 
> and work with a wide range of toolchain versions.
> 
> But I guess we could simplify the list of supported versions to what is 
> currently available for download - I see that 11.x and 12.x are supported 
> now. 
> 
> Can you please check if libc.so is the same in those versions? If so, we 
> can potentially drop all other sed mods from here. Thanks.

meta-arm is going to release very, very soon.  If this series should
go in, then this needs to get wrapped up ASAP.

Vasyl, can you check about libc.so (per Denys's question/comment
above, and possibly do another version if his suggestion is correct)? 

Thanks,
Jon

> 
> 
> > 2. Rest two expressions replace input string to "/usr/lib" or ".", so
> > they are not affected by usrmerge.
> 
> -- 
> Denys
>
diff mbox series

Patch

diff --git a/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb b/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb
index 27aadffd..ab608128 100644
--- a/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb
+++ b/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb
@@ -207,9 +207,9 @@  do_install() {
 	rm -rf ${D}${includedir}/rpcsvc/rquota.*
 
 	if [ -f ${D}${libdir}/libc.so ];then
-		sed -i -e "s# /${EAT_LIBDIR}/${EAT_TARGET_SYS}# ../../${EAT_LIBDIR}#g" -e "s# /usr/${EAT_LIBDIR}/# /usr/lib/#g" -e "s# /usr/${EAT_LIBDIR}/${EAT_TARGET_SYS}# .#g" -e "s# /${EAT_LIBDIR}/ld-linux# ../../${EAT_LIBDIR}/ld-linux#g" ${D}${libdir}/libc.so
+		sed -i -e "s# /${EAT_LIBDIR}/${EAT_TARGET_SYS}# ../../${EAT_LIBDIR}#g" -e "s# /usr/${EAT_LIBDIR}/# /usr/lib/#g" -e "s# /usr/${EAT_LIBDIR}/${EAT_TARGET_SYS}# .#g" -e "s# /${EAT_LIBDIR}/ld-linux# ../../${base_libdir}/ld-linux#g" ${D}${libdir}/libc.so
 		sed -i -e "s# /${EAT_LIBDIR}/libc.so.6# /lib/libc.so.6#g" ${D}${libdir}/libc.so
-		sed -i -e "s# /lib# ../../lib#g" -e "s# /usr/lib# .#g" ${D}${libdir}/libc.so
+		sed -i -e "s# /lib# ../../${base_libdir}#g" -e "s# /usr/lib# .#g" ${D}${libdir}/libc.so
 	fi
 
 	if [ -f ${D}${base_libdir}/libc.so ];then