Skip to contentSkip to conversation

external-arm-toolchain: fix build when usrmege enabled

PATCH In review Vasyl Vavrychuk 5 participants 12 messages Apr 17, 2024 – Aug 30, 2024

lore
Share & tools
lore
#0 lore raw

cover external-arm-toolchain: fix build when usrmege enabled

Vasyl Vavrychuk (3):
external-arm-toolchain: wrap base_libdir vs libdir manipulations under
usrmerge check
external-arm-toolchain: in libc.so GNU ld script use base_libdir
external-arm-toolchain: remove ${base_libdir}/libpthread*.so from

    FILES:${PN}
 .../external-arm-toolchain.bb                 | 67 ++++++++++---------
 1 file changed, 34 insertions(+), 33 deletions(-)
Signature · 1 line
2.40.0
#1 lore raw

PATCH 1/3 external-arm-toolchain: wrap base_libdir vs libdir manipulations under usrmerge check

With usrmerge disto feature base_libdir and libdir are the same, so it does not make sense to:

* removing "duplicates" between them
* move files from base_libdir to libdir

This fixes build error

| mv: '.../tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/external-arm-toolchain/12.2.Rel1/image/usr/lib/libasan.a' and '.../tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/external-arm-toolchain/12.2.Rel1/image/usr/lib/libasan.a' are the same file

in case of usrmerge feature enabled.

---
 .../external-arm-toolchain.bb                 | 62 ++++++++++---------
 1 file changed, 32 insertions(+), 30 deletions(-)
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +32 -30
index fab17611..27aadffd 100644
@@ -135,37 +135,39 @@ do_install() {
 	ln -sf ../../lib/libm.so.6 ${D}${libdir}/libm.so
 	ln -sf ../../lib/libc_malloc_debug.so.0 ${D}${libdir}/libc_malloc_debug.so
 
-	# remove potential .so duplicates from base_libdir
-	# for all symlinks created above in libdir
-	rm -f ${D}${base_libdir}/librt.so
-	rm -f ${D}${base_libdir}/libcrypt.so
-	rm -f ${D}${base_libdir}/libresolv.so
-	rm -f ${D}${base_libdir}/libnss_hesiod.so
-	rm -f ${D}${base_libdir}/libutil.so
-	rm -f ${D}${base_libdir}/libBrokenLocale.so
-	rm -f ${D}${base_libdir}/libpthread.so
-	rm -f ${D}${base_libdir}/libthread_db.so
-	rm -f ${D}${base_libdir}/libanl.so
-	rm -f ${D}${base_libdir}/libdl.so
-	rm -f ${D}${base_libdir}/libnss_db.so
-	rm -f ${D}${base_libdir}/libnss_dns.so
-	rm -f ${D}${base_libdir}/libnss_files.so
-	rm -f ${D}${base_libdir}/libnss_compat.so
-	rm -f ${D}${base_libdir}/libm.so
-
-	# Move these completely to ${libdir} and delete duplicates in ${base_libdir}
-	for lib in asan hwasan atomic gfortran gomp itm lsan sanitizer stdc++ tsan ubsan; do
-		if [ -e ${D}${base_libdir}/lib${lib}.spec ] ; then
-			mv ${D}${base_libdir}/lib${lib}.spec ${D}${libdir}
-		fi
-		if [ -e ${D}${base_libdir}/lib${lib}.a ] ; then
-			mv ${D}${base_libdir}/lib${lib}.a ${D}${libdir}
-		fi
-		rm -f ${D}${base_libdir}/lib${lib}*
-	done
+	if ${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'false', 'true', d)}; then
+		# remove potential .so duplicates from base_libdir
+		# for all symlinks created above in libdir
+		rm -f ${D}${base_libdir}/librt.so
+		rm -f ${D}${base_libdir}/libcrypt.so
+		rm -f ${D}${base_libdir}/libresolv.so
+		rm -f ${D}${base_libdir}/libnss_hesiod.so
+		rm -f ${D}${base_libdir}/libutil.so
+		rm -f ${D}${base_libdir}/libBrokenLocale.so
+		rm -f ${D}${base_libdir}/libpthread.so
+		rm -f ${D}${base_libdir}/libthread_db.so
+		rm -f ${D}${base_libdir}/libanl.so
+		rm -f ${D}${base_libdir}/libdl.so
+		rm -f ${D}${base_libdir}/libnss_db.so
+		rm -f ${D}${base_libdir}/libnss_dns.so
+		rm -f ${D}${base_libdir}/libnss_files.so
+		rm -f ${D}${base_libdir}/libnss_compat.so
+		rm -f ${D}${base_libdir}/libm.so
+
+		# Move these completely to ${libdir} and delete duplicates in ${base_libdir}
+		for lib in asan hwasan atomic gfortran gomp itm lsan sanitizer stdc++ tsan ubsan; do
+			if [ -e ${D}${base_libdir}/lib${lib}.spec ] ; then
+				mv ${D}${base_libdir}/lib${lib}.spec ${D}${libdir}
+			fi
+			if [ -e ${D}${base_libdir}/lib${lib}.a ] ; then
+				mv ${D}${base_libdir}/lib${lib}.a ${D}${libdir}
+			fi
+			rm -f ${D}${base_libdir}/lib${lib}*
+		done
 
-	# Clean up duplicate libs that are both in base_libdir and libdir
-	rm -f ${D}${libdir}/libgcc*
+		# Clean up duplicate libs that are both in base_libdir and libdir
+		rm -f ${D}${libdir}/libgcc*
+	fi
 
 	# Besides ld-${EAT_VER_LIBC}.so, other libs can have duplicates like lib*-${EAT_VER_LIBC}.so
 	# Only remove them if both are regular files and are identical
Signature · 1 line
2.40.0
Acked-by on v1 1/3
#2 lore raw

Re: [meta-arm] [PATCH 1/3] external-arm-toolchain: wrap base_libdir vs libdir manipulations under usrmerge check

Quoted 6 lines · Vasyl Vavrychuk

With usrmerge disto feature base_libdir and libdir are the same, so it does not make sense to:

* removing "duplicates" between them
* move files from base_libdir to libdir

Quoted 7 lines

This fixes build error

| mv: '.../tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/external-arm-toolchain/12.2.Rel1/image/usr/lib/libasan.a' and '.../tmp/work/cortexa15t2hf-neon-poky-linux-gnueabi/external-arm-toolchain/12.2.Rel1/image/usr/lib/libasan.a' are the same file

in case of usrmerge feature enabled.

Quoted 80 lines
---
 .../external-arm-toolchain.bb                 | 62 ++++++++++---------
 1 file changed, 32 insertions(+), 30 deletions(-)
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +32 -30
index fab17611..27aadffd 100644
@@ -135,37 +135,39 @@ do_install() {
 	ln -sf ../../lib/libm.so.6 ${D}${libdir}/libm.so
 	ln -sf ../../lib/libc_malloc_debug.so.0 ${D}${libdir}/libc_malloc_debug.so
 
-	# remove potential .so duplicates from base_libdir
-	# for all symlinks created above in libdir
-	rm -f ${D}${base_libdir}/librt.so
-	rm -f ${D}${base_libdir}/libcrypt.so
-	rm -f ${D}${base_libdir}/libresolv.so
-	rm -f ${D}${base_libdir}/libnss_hesiod.so
-	rm -f ${D}${base_libdir}/libutil.so
-	rm -f ${D}${base_libdir}/libBrokenLocale.so
-	rm -f ${D}${base_libdir}/libpthread.so
-	rm -f ${D}${base_libdir}/libthread_db.so
-	rm -f ${D}${base_libdir}/libanl.so
-	rm -f ${D}${base_libdir}/libdl.so
-	rm -f ${D}${base_libdir}/libnss_db.so
-	rm -f ${D}${base_libdir}/libnss_dns.so
-	rm -f ${D}${base_libdir}/libnss_files.so
-	rm -f ${D}${base_libdir}/libnss_compat.so
-	rm -f ${D}${base_libdir}/libm.so
-
-	# Move these completely to ${libdir} and delete duplicates in ${base_libdir}
-	for lib in asan hwasan atomic gfortran gomp itm lsan sanitizer stdc++ tsan ubsan; do
-		if [ -e ${D}${base_libdir}/lib${lib}.spec ] ; then
-			mv ${D}${base_libdir}/lib${lib}.spec ${D}${libdir}
-		fi
-		if [ -e ${D}${base_libdir}/lib${lib}.a ] ; then
-			mv ${D}${base_libdir}/lib${lib}.a ${D}${libdir}
-		fi
-		rm -f ${D}${base_libdir}/lib${lib}*
-	done
+	if ${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'false', 'true', d)}; then
+		# remove potential .so duplicates from base_libdir
+		# for all symlinks created above in libdir
+		rm -f ${D}${base_libdir}/librt.so
+		rm -f ${D}${base_libdir}/libcrypt.so
+		rm -f ${D}${base_libdir}/libresolv.so
+		rm -f ${D}${base_libdir}/libnss_hesiod.so
+		rm -f ${D}${base_libdir}/libutil.so
+		rm -f ${D}${base_libdir}/libBrokenLocale.so
+		rm -f ${D}${base_libdir}/libpthread.so
+		rm -f ${D}${base_libdir}/libthread_db.so
+		rm -f ${D}${base_libdir}/libanl.so
+		rm -f ${D}${base_libdir}/libdl.so
+		rm -f ${D}${base_libdir}/libnss_db.so
+		rm -f ${D}${base_libdir}/libnss_dns.so
+		rm -f ${D}${base_libdir}/libnss_files.so
+		rm -f ${D}${base_libdir}/libnss_compat.so
+		rm -f ${D}${base_libdir}/libm.so
+
+		# Move these completely to ${libdir} and delete duplicates in ${base_libdir}
+		for lib in asan hwasan atomic gfortran gomp itm lsan sanitizer stdc++ tsan ubsan; do
+			if [ -e ${D}${base_libdir}/lib${lib}.spec ] ; then
+				mv ${D}${base_libdir}/lib${lib}.spec ${D}${libdir}
+			fi
+			if [ -e ${D}${base_libdir}/lib${lib}.a ] ; then
+				mv ${D}${base_libdir}/lib${lib}.a ${D}${libdir}
+			fi
+			rm -f ${D}${base_libdir}/lib${lib}*
+		done
 
-	# Clean up duplicate libs that are both in base_libdir and libdir
-	rm -f ${D}${libdir}/libgcc*
+		# Clean up duplicate libs that are both in base_libdir and libdir
+		rm -f ${D}${libdir}/libgcc*
+	fi
 
 	# Besides ld-${EAT_VER_LIBC}.so, other libs can have duplicates like lib*-${EAT_VER_LIBC}.so
 	# Only remove them if both are regular files and are identical
Signature · 1 line
2.40.0
#3 lore raw

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

In reply to Vasyl Vavrychuk

base_libdir gets replaced with /lib or /usr/lib depending on usrmerge distro feature.

---
 .../external-arm-toolchain/external-arm-toolchain.bb          | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +2 -2
index 27aadffd..ab608128 100644
@@ -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
Signature · 1 line
2.40.0
#4 lore raw

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

Quoted 13 lines · Vasyl Vavrychuk

base_libdir gets replaced with /lib or /usr/lib depending on usrmerge distro feature.

---
 .../external-arm-toolchain/external-arm-toolchain.bb          | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +0 -0
index 27aadffd..ab608128 100644

meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb do_install() { · line 210

Quoted 5 lines
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +1 -1
@@ -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?

Quoted 9 lines
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +1 -1
 		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
Signature · 1 line
2.40.0
#5 lore raw

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

Quoted 7 lines · Denys Dmytriyenko

meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb do_install() { · line 210

Quoted 2 lines · Vasyl Vavrychuk
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +1 -1
-             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.

#6 lore raw

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

Quoted 6 lines · Vasyl Vavrychuk
Quoted 5 lines · Denys Dmytriyenko
Quoted 2 lines · Vasyl Vavrychuk
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +1 -1
-             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
Quoted 8 lines
Quoted 2 lines

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.

Quoted 2 lines

2. Rest two expressions replace input string to "/usr/lib" or ".", so they are not affected by usrmerge.

Signature · 1 line
Denys
#7 lore raw

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

Quoted 23 lines · Denys Dmytriyenko
Quoted 6 lines · Vasyl Vavrychuk
Quoted 5 lines · Denys Dmytriyenko
Quoted 2 lines · Vasyl Vavrychuk
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +1 -1
-             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
Quoted 8 lines
Quoted 2 lines

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.

Quoted 6 lines

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

Quoted 8 lines
Quoted 4 lines

2. Rest two expressions replace input string to "/usr/lib" or ".", so they are not affected by usrmerge.

Signature · 1 line
Denys
#8 lore raw

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

Hello,

Le 29/04/2024 à 15:54, Jon Mason a écrit :

Quoted 28 lines · Denys Dmytriyenko
Quoted 27 lines · Vasyl Vavrychuk
Quoted 6 lines · Denys Dmytriyenko
Quoted 5 lines · Vasyl Vavrychuk
Quoted 2 lines
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +1 -1
-             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
Quoted 8 lines
Quoted 2 lines

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.

Quoted 8 lines
Quoted 2 lines

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)?

There is a new TI SDK release based on Yocto-Scarthgap [1][2] and the external-arm-toolchain doesn't work due usrmerge nowaday required by systemd.

I applied this series but there is still an issue with the meson-qemuwrapper:

qemu-aarch64: Could not open '/lib/ld-linux-aarch64.so.1': No such file or
directory

Indeed ld-linux-aarch64.so.1 is under /usr/lib:

lmsensors-config/1.0/recipe-sysroot/usr/lib/ld-linux-aarch64.so.1

                                     ^^^^^^^^

[1] https://www.ti.com/tool/download/PROCESSOR-SDK-LINUX-SK-TDA4VM/10.00.00.08
[2]
https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-sk-tda4vm/10_00_00/exports/edgeai-docs/devices/TDA4VM/linux/release_notes_10_00.html#new-in-this-release

Best regards,
Romain

Quoted 14 lines

Thanks,
Jon

Quoted 8 lines
Quoted 4 lines

2. Rest two expressions replace input string to "/usr/lib" or ".", so they are not affected by usrmerge.

Signature · 1 line
Denys
#9 lore raw

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

In reply to Denys Dmytriyenko

Thanks for pointing to this thread from https://lists.yoctoproject.org/g/meta-arm/message/5764

I have tried applying this patch series and it failed in other places. Specifically libm.a, libm.so LD script paths. I have tried adjusting them (attached the diff) and also few changes related to symbolic links (which was dead one). But still the compilation failed with

| ../git/meson.build:3:0: ERROR: Executables created by c compiler aarch64-none-linux-gnu-gcc -mcpu=cortex-a53+crc -mbranch-protection=standard -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=build/tmp/work/cortexa53-poky-linux/systemd/255.4/recipe-sysroot are not runnable.
| 
| A full log can be found atbuild/tmp/work/cortexa53-poky-linux/systemd/255.4/build/meson-logs/meson-log.txt

for packages like systemd, glib. Underlying error is still not clear to me. Is this related to multilib support in the external toolchain?

Many thanks,
Parthiban N

meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +40 -28
index 279ddffa..233dba5e 100644
@@ -57,6 +57,15 @@ BINV = "${EAT_VER_GCC}"
 
 SRC_URI = "file://SUPPORTED"
 
+# /lib || /lib64 ||  /usr/lib64 ->/usr/lib
+update_ld_script_path() {
+	if [ -f $1 ];then
+		sed -i -e "s# /lib/# ${base_libdir}/#g" $1
+		sed -i -e "s# /lib64/# ${base_libdir}/#g" $1
+		sed -i -e "s# /usr/lib64/# ${base_libdir}/#g" $1
+	fi
+}
+
 do_install() {
 	# Add stubs for files OE-core expects
 	install -d ${S}/nscd/
@@ -118,24 +127,25 @@ do_install() {
 	else
 		cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/lib/${linker_name} ${D}${base_libdir}/
 	fi
-	ln -sf ../../lib/librt.so.1 ${D}${libdir}/librt.so
-	ln -sf ../../lib/libcrypt.so.1 ${D}${libdir}/libcrypt.so
-	ln -sf ../../lib/libresolv.so.2 ${D}${libdir}/libresolv.so
-	ln -sf ../../lib/libnss_hesiod.so.2 ${D}${libdir}/libnss_hesiod.so
-	ln -sf ../../lib/libutil.so.1 ${D}${libdir}/libutil.so
-	ln -sf ../../lib/libBrokenLocale.so.1 ${D}${libdir}/libBrokenLocale.so
-	ln -sf ../../lib/libpthread.so.0 ${D}${libdir}/libpthread.so
-	ln -sf ../../lib/libthread_db.so.1 ${D}${libdir}/libthread_db.so
-	ln -sf ../../lib/libanl.so.1 ${D}${libdir}/libanl.so
-	ln -sf ../../lib/libdl.so.2 ${D}${libdir}/libdl.so
-	ln -sf ../../lib/libnss_db.so.2 ${D}${libdir}/libnss_db.so
-	ln -sf ../../lib/libnss_dns.so.2 ${D}${libdir}/libnss_dns.so
-	ln -sf ../../lib/libnss_files.so.2 ${D}${libdir}/libnss_files.so
-	ln -sf ../../lib/libnss_compat.so.2 ${D}${libdir}/libnss_compat.so
-	ln -sf ../../lib/libm.so.6 ${D}${libdir}/libm.so
-	ln -sf ../../lib/libc_malloc_debug.so.0 ${D}${libdir}/libc_malloc_debug.so
 
 	if ${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'false', 'true', d)}; then
+		ln -sf ../../lib/librt.so.1 ${D}${libdir}/librt.so
+		ln -sf ../../lib/libcrypt.so.1 ${D}${libdir}/libcrypt.so
+		ln -sf ../../lib/libresolv.so.2 ${D}${libdir}/libresolv.so
+		ln -sf ../../lib/libnss_hesiod.so.2 ${D}${libdir}/libnss_hesiod.so
+		ln -sf ../../lib/libutil.so.1 ${D}${libdir}/libutil.so
+		ln -sf ../../lib/libBrokenLocale.so.1 ${D}${libdir}/libBrokenLocale.so
+		ln -sf ../../lib/libpthread.so.0 ${D}${libdir}/libpthread.so
+		ln -sf ../../lib/libthread_db.so.1 ${D}${libdir}/libthread_db.so
+		ln -sf ../../lib/libanl.so.1 ${D}${libdir}/libanl.so
+		ln -sf ../../lib/libdl.so.2 ${D}${libdir}/libdl.so
+		ln -sf ../../lib/libnss_db.so.2 ${D}${libdir}/libnss_db.so
+		ln -sf ../../lib/libnss_dns.so.2 ${D}${libdir}/libnss_dns.so
+		ln -sf ../../lib/libnss_files.so.2 ${D}${libdir}/libnss_files.so
+		ln -sf ../../lib/libnss_compat.so.2 ${D}${libdir}/libnss_compat.so
+		ln -sf ../../lib/libm.so.6 ${D}${libdir}/libm.so
+		ln -sf ../../lib/libc_malloc_debug.so.0 ${D}${libdir}/libc_malloc_debug.so
+
 		# remove potential .so duplicates from base_libdir
 		# for all symlinks created above in libdir
 		rm -f ${D}${base_libdir}/librt.so
@@ -167,6 +177,16 @@ do_install() {
 
 		# Clean up duplicate libs that are both in base_libdir and libdir
 		rm -f ${D}${libdir}/libgcc*
+	else
+		ln -sf libc_malloc_debug.so.0 ${D}${libdir}/libc_malloc_debug.so
+		ln -sf libthread_db.so.1 ${D}${libdir}/libthread_db.so
+		ln -sf libmvec.so.1 ${D}${libdir}/libmvec.so
+		ln -sf libcrypt.so.1 ${D}${libdir}/libcrypt.so
+		ln -sf libresolv.so.2 ${D}${libdir}/libresolv.so
+		ln -sf libnss_hesiod.so.2 ${D}${libdir}/libnss_hesiod.so
+		ln -sf libnss_db.so.2 ${D}${libdir}/libnss_db.so
+		ln -sf libnss_compat.so.2 ${D}${libdir}/libnss_compat.so
+		ln -sf libanl.so.1 ${D}${libdir}/libanl.so
 	fi
 
 	# Besides ld-${EAT_VER_LIBC}.so, other libs can have duplicates like lib*-${EAT_VER_LIBC}.so
@@ -206,18 +226,10 @@ do_install() {
 	# Provided by quota
 	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# ../../${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# ../../${base_libdir}#g" -e "s# /usr/lib# .#g" ${D}${libdir}/libc.so
-	fi
-
-	if [ -f ${D}${base_libdir}/libc.so ];then
-		sed -i -e "s# /${EAT_LIBDIR}/${EAT_TARGET_SYS}# ../../lib#g" -e "s# /usr/${EAT_LIBDIR}/${EAT_TARGET_SYS}# .#g" -e "s# /${EAT_LIBDIR}/# /lib/#g" ${D}${base_libdir}/libc.so
-		if [ -f ${D}${base_libdir}/libc.so.6 ]; then
-			sed -i -e "s# /usr/${EAT_LIBDIR}/libc.so.6# /lib/libc.so.6#g" -e "s# /${EAT_LIBDIR}/libc.so.6# /lib/libc.so.6#g" ${D}${base_libdir}/libc.so.6
-		fi
-	fi
+	update_ld_script_path ${D}${libdir}/libc.so
+	[ "${D}${base_libdir}/libc.so" != "${D}${libdir}/libc.so" ] && update_ld_script_path ${D}${libdir}/libc.so
+	update_ld_script_path ${D}${libdir}/libm.so
+	update_ld_script_path ${D}${libdir}/libm.a
 
 	# Remove if empty
 	rmdir ${D}${bindir} || true
#10 lore raw

PATCH 3/3 external-arm-toolchain: remove ${base_libdir}/libpthread*.so from FILES:${PN}

In reply to Vasyl Vavrychuk

When usrmerge distro feature is not enabled, then ${base_libdir} resolves to /lib and /lib/libpthread*.so does not match any files. But, with usrmerge distro feature, ${base_libdir} is /usr/lib, so removed line leads to /usr/lib/libpthread.so symlink included in ${PN} which causes QA check failure.

---
 .../external-arm-toolchain/external-arm-toolchain.bb             | 1 -
 1 file changed, 1 deletion(-)
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +0 -1
index ab608128..f0955b29 100644
@@ -528,7 +528,6 @@ FILES:${PN} += "\
 	${base_libdir}/ld*.so.* \
 	${base_libdir}/ld-*.so \
 	${base_libdir}/libpthread*.so.* \
-	${base_libdir}/libpthread*.so \
 	${base_libdir}/libpthread-*.so \
 	${base_libdir}/libresolv*.so.* \
 	${base_libdir}/libresolv-*.so \
Signature · 1 line
2.40.0
Acked-by on v1 3/3
#11 lore raw

Re: [meta-arm] [PATCH 3/3] external-arm-toolchain: remove ${base_libdir}/libpthread*.so from FILES:${PN}

Quoted 7 lines · Vasyl Vavrychuk

When usrmerge distro feature is not enabled, then ${base_libdir} resolves to /lib and /lib/libpthread*.so does not match any files. But, with usrmerge distro feature, ${base_libdir} is /usr/lib, so removed line leads to /usr/lib/libpthread.so symlink included in ${PN} which causes QA check failure.

Quoted 18 lines
---
 .../external-arm-toolchain/external-arm-toolchain.bb             | 1 -
 1 file changed, 1 deletion(-)
meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb +0 -1
index ab608128..f0955b29 100644
@@ -528,7 +528,6 @@ FILES:${PN} += "\
 	${base_libdir}/ld*.so.* \
 	${base_libdir}/ld-*.so \
 	${base_libdir}/libpthread*.so.* \
-	${base_libdir}/libpthread*.so \
 	${base_libdir}/libpthread-*.so \
 	${base_libdir}/libresolv*.so.* \
 	${base_libdir}/libresolv-*.so \
Signature · 1 line
2.40.0