All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] external-arm-toolchain-versions: Use ldd to get libc version
@ 2022-04-28 12:28 Sumit Garg
  2022-04-28 12:28 ` [PATCH 2/2] external-arm-toolchain: Add support for Arm GCC 11.2 binary release Sumit Garg
  2022-04-28 14:00 ` [PATCH 1/2] external-arm-toolchain-versions: Use ldd to get libc version Denys Dmytriyenko
  0 siblings, 2 replies; 7+ messages in thread
From: Sumit Garg @ 2022-04-28 12:28 UTC (permalink / raw)
  To: meta-arm; +Cc: jon.mason, ross.burton, denis, daniel.thompson, Sumit Garg

Arm GCC 11.2 binary release has moved away from keeping libc library
versioning info as libc-{EAT_VER_LIBC}.so. So rather switch to
retrieving libc version by parsing output from "$ ldd --version".

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
---
 .../external-arm-toolchain-versions.inc       | 43 ++++++++-----------
 1 file changed, 17 insertions(+), 26 deletions(-)

diff --git a/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc b/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
index a89f2f0..388987a 100644
--- a/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
+++ b/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
@@ -50,37 +50,28 @@ def eat_get_gcc_version(d):
 
 def eat_get_libc_version(d):
     import os,bb
+    import subprocess
+
     syspath = bb.data.expand('${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}', d)
     if not syspath:
         return 'UNKNOWN'
 
-    libpath = syspath + '/libc/' + bb.data.expand('${EAT_LIBDIR}/${EAT_TARGET_SYS}/', d)
-
-    if os.path.exists(libpath):
-        for file in os.listdir(libpath):
-            if file.find('libc-') == 0:
-                return file[5:-3]
-
-    libpath = syspath + '/libc/' + bb.data.expand('${EAT_LIBDIR}/', d)
-
-    if os.path.exists(libpath):
-        for file in os.listdir(libpath):
-            if file.find('libc-') == 0:
-                return file[5:-3]
-
-    libpath = syspath + '/libc/usr/' + bb.data.expand('${EAT_LIBDIR}/${EAT_TARGET_SYS}/', d)
-
-    if os.path.exists(libpath):
-        for file in os.listdir(libpath):
-            if file.find('libc-') == 0:
-                return file[5:-3]
-
-    libpath = syspath + '/libc/usr/' + bb.data.expand('${EAT_LIBDIR}/', d)
+    topdir = d.getVar('TOPDIR', True)
+    lddpath = syspath + '/libc/usr/bin/ldd'
+
+    if os.path.exists(lddpath):
+        cmd1 = 'sed -i -e \'s#/usr/bin/bash#/bin/bash#\' ' + lddpath
+        cmd2 = lddpath + ' --version'
+        try:
+            stdout, stderr = bb.process.run(cmd1, cwd=topdir, stderr=subprocess.PIPE)
+            stdout, stderr = bb.process.run(cmd2, cwd=topdir, stderr=subprocess.PIPE)
+        except bb.process.CmdError as exc:
+            bb.error('Failed to obtain external Arm libc version: %s' % exc)
+            return 'UNKNOWN'
+        else:
+            first_line = stdout.splitlines()[0]
+            return first_line.split()[2]
 
-    if os.path.exists(libpath):
-        for file in os.listdir(libpath):
-            if file.find('libc-') == 0:
-                return file[5:-3]
     return 'UNKNOWN'
 
 def eat_get_kernel_version(d):
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] external-arm-toolchain: Add support for Arm GCC 11.2 binary release
  2022-04-28 12:28 [PATCH 1/2] external-arm-toolchain-versions: Use ldd to get libc version Sumit Garg
@ 2022-04-28 12:28 ` Sumit Garg
  2022-04-28 14:00 ` [PATCH 1/2] external-arm-toolchain-versions: Use ldd to get libc version Denys Dmytriyenko
  1 sibling, 0 replies; 7+ messages in thread
From: Sumit Garg @ 2022-04-28 12:28 UTC (permalink / raw)
  To: meta-arm; +Cc: jon.mason, ross.burton, denis, daniel.thompson, Sumit Garg

Arm GCC 11.2 binary release has completely changed the way how libc was
packaged in earlier binary releases. So adjust do_install() accordingly
to support Arm GCC 11.2 as well as earlier binary releases.

Along with this update CI as well to point at Arm GCC 11.2 binary
releases.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
---
 ci/get-binary-toolchains                      | 10 ++--
 .../external-arm-toolchain.bb                 | 47 ++++++++-----------
 2 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/ci/get-binary-toolchains b/ci/get-binary-toolchains
index 838342a..bfdd8c5 100755
--- a/ci/get-binary-toolchains
+++ b/ci/get-binary-toolchains
@@ -2,7 +2,7 @@
 set -u
 
 HOST_ARCH=$(uname -m)
-VER="10.3-2021.07"
+VER="11.2-2022.02"
 
 DOWNLOAD_DIR=$1
 TOOLCHAIN_DIR=$2
@@ -15,18 +15,18 @@ if [ $HOST_ARCH = "aarch64" ]; then
 	#AArch64 Linux hosted cross compilers
 
 	#AArch32 target with hard float (arm-none-linux-gnueabihf)
-	wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu-a/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-arm-none-linux-gnueabihf.tar.xz
+	wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-arm-none-linux-gnueabihf.tar.xz
 elif [ $HOST_ARCH = "x86_64" ]; then
 	#x86_64 Linux hosted cross compilers
 
 	#AArch32 target with hard float (arm-linux-none-gnueabihf)
-	wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu-a/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-arm-none-linux-gnueabihf.tar.xz
+	wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-arm-none-linux-gnueabihf.tar.xz
 
 	#AArch64 GNU/Linux target (aarch64-none-linux-gnu)
-	wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu-a/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-aarch64-none-linux-gnu.tar.xz
+	wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-aarch64-none-linux-gnu.tar.xz
 
 	#AArch64 GNU/Linux target (aarch64_be-none-linux-gnu)
-	wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu-a/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-aarch64_be-none-linux-gnu.tar.xz
+	wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/gcc-arm-$VER-$HOST_ARCH-aarch64_be-none-linux-gnu.tar.xz
 else
 	echo "ERROR - Unknown build arch of $HOST_ARCH"
 	exit 1
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 a58eeb4..dcc8ebf 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
@@ -79,29 +79,10 @@ do_install() {
 
 	CP_ARGS="-Prf --preserve=mode,timestamps --no-preserve=ownership"
 	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/${EAT_LIBDIR}/*  ${D}${base_libdir}
-	if [ -d ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/${EAT_LIBDIR}/${EAT_TARGET_SYS} ]; then
-		cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/${EAT_LIBDIR}/${EAT_TARGET_SYS}/*  ${D}${base_libdir}
-	else
-		if [ -f ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/${EAT_LIBDIR}/ld-${EAT_VER_LIBC}.so ]; then
-			cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/${EAT_LIBDIR}/*  ${D}${base_libdir}
-		else
-			cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/usr/${EAT_LIBDIR}/*.so*  ${D}${base_libdir}
-		fi
-	fi
-	if [ -d ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/usr/${EAT_LIBDIR}/${EAT_TARGET_SYS} ]; then
-		cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/usr/${EAT_LIBDIR}/${EAT_TARGET_SYS}/*  ${D}${libdir}
-	else
-		cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/usr/${EAT_LIBDIR}/*  ${D}${libdir}
-		if [ ! -f ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/${EAT_LIBDIR}/ld-${EAT_VER_LIBC}.so ]; then
-			rm -rf ${D}${libdir}/*.so*
-		fi
-	fi
+	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/${EAT_LIBDIR}/*  ${D}${base_libdir}
+	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/usr/${EAT_LIBDIR}/*  ${D}${libdir}
 	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/usr/share/*  ${D}${datadir}
 	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/usr/include/*  ${D}${includedir}
-	if [ -d ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/usr/include/${EAT_TARGET_SYS} ]; then
-		cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/usr/include/${EAT_TARGET_SYS}/*  ${D}${includedir}
-		rm -r ${D}${includedir}/${EAT_TARGET_SYS}
-	fi
 
 	cp ${CP_ARGS} ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/include/* ${D}${includedir}
 	if [ -d ${D}${includedir}/c++/${EAT_VER_GCC}/${EAT_TARGET_SYS} ]; then
@@ -128,7 +109,11 @@ do_install() {
 
 	# fix up the copied symlinks (they are still pointing to the multiarch directory)
 	linker_name="${@bb.utils.contains("TUNE_FEATURES", "aarch64", "ld-linux-aarch64.so.1", bb.utils.contains("TUNE_FEATURES", "callconvention-hard", "ld-linux-armhf.so.3", "ld-linux.so.3",d), d)}"
-	ln -sf ld-${EAT_VER_LIBC}.so ${D}${base_libdir}/${linker_name}
+	if [ -f ${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}/libc/${EAT_LIBDIR}/ld-${EAT_VER_LIBC}.so ]; then
+		ln -sf ld-${EAT_VER_LIBC}.so ${D}${base_libdir}/${linker_name}
+	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
@@ -144,6 +129,7 @@ do_install() {
 	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
@@ -164,7 +150,7 @@ do_install() {
 	rm -f ${D}${base_libdir}/libm.so
 
 	# Move these completely to ${libdir} and delete duplicates in ${base_libdir}
-	for lib in asan atomic gfortran gomp itm lsan sanitizer stdc++ tsan ubsan; do
+	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
@@ -180,6 +166,10 @@ do_install() {
 	# 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
 	for i in ${D}${base_libdir}/lib*-${EAT_VER_LIBC}.so; do
+		if [ ! -e $i ] ; then
+			continue
+		fi
+
 		f=$(echo $i | sed 's/-${EAT_VER_LIBC}//')
 		l=$(ls $f.*)
 		if [ $(readlink -f $i ) = $l ]; then
@@ -217,9 +207,9 @@ do_install() {
 	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" "s# /${EAT_LIBDIR}/# /lib/#g" ${D}${base_libdir}/libc.so
+		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" "s# /${EAT_LIBDIR}/libc.so.6# /lib/libc.so.6#g" ${D}${base_libdir}/libc.so.6
+			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
 
@@ -460,13 +450,16 @@ FILES:libgfortran-staticdev = "${libdir}/libgfortran.a"
 
 # From gcc-sanitizers.inc:
 
-FILES:libasan += "${libdir}/libasan.so.*"
+FILES:libasan += "${libdir}/libasan.so.* ${libdir}/libhwasan.so.*"
 FILES:libasan-dev += "\
     ${libdir}/libasan_preinit.o \
     ${libdir}/libasan.so \
+    ${libdir}/libhwasan.so \
     ${libdir}/libasan.la \
 "
-FILES:libasan-staticdev += "${libdir}/libasan.a"
+FILES:libasan-staticdev += "${libdir}/libasan.a \
+    ${libdir}/libhwasan.a \
+"
 
 FILES:libubsan += "${libdir}/libubsan.so.*"
 FILES:libubsan-dev += "\
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] external-arm-toolchain-versions: Use ldd to get libc version
  2022-04-28 12:28 [PATCH 1/2] external-arm-toolchain-versions: Use ldd to get libc version Sumit Garg
  2022-04-28 12:28 ` [PATCH 2/2] external-arm-toolchain: Add support for Arm GCC 11.2 binary release Sumit Garg
@ 2022-04-28 14:00 ` Denys Dmytriyenko
  2022-04-28 19:03   ` Jon Mason
  1 sibling, 1 reply; 7+ messages in thread
From: Denys Dmytriyenko @ 2022-04-28 14:00 UTC (permalink / raw)
  To: Sumit Garg; +Cc: meta-arm, jon.mason, ross.burton, daniel.thompson

On Thu, Apr 28, 2022 at 05:58:47PM +0530, Sumit Garg wrote:
> Arm GCC 11.2 binary release has moved away from keeping libc library
> versioning info as libc-{EAT_VER_LIBC}.so. So rather switch to
> retrieving libc version by parsing output from "$ ldd --version".
> 
> Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> ---
>  .../external-arm-toolchain-versions.inc       | 43 ++++++++-----------
>  1 file changed, 17 insertions(+), 26 deletions(-)
> 
> diff --git a/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc b/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
> index a89f2f0..388987a 100644
> --- a/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
> +++ b/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
> @@ -50,37 +50,28 @@ def eat_get_gcc_version(d):
>  
>  def eat_get_libc_version(d):
>      import os,bb
> +    import subprocess
> +
>      syspath = bb.data.expand('${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}', d)
>      if not syspath:
>          return 'UNKNOWN'
>  
> -    libpath = syspath + '/libc/' + bb.data.expand('${EAT_LIBDIR}/${EAT_TARGET_SYS}/', d)
> -
> -    if os.path.exists(libpath):
> -        for file in os.listdir(libpath):
> -            if file.find('libc-') == 0:
> -                return file[5:-3]
> -
> -    libpath = syspath + '/libc/' + bb.data.expand('${EAT_LIBDIR}/', d)
> -
> -    if os.path.exists(libpath):
> -        for file in os.listdir(libpath):
> -            if file.find('libc-') == 0:
> -                return file[5:-3]
> -
> -    libpath = syspath + '/libc/usr/' + bb.data.expand('${EAT_LIBDIR}/${EAT_TARGET_SYS}/', d)
> -
> -    if os.path.exists(libpath):
> -        for file in os.listdir(libpath):
> -            if file.find('libc-') == 0:
> -                return file[5:-3]
> -
> -    libpath = syspath + '/libc/usr/' + bb.data.expand('${EAT_LIBDIR}/', d)
> +    topdir = d.getVar('TOPDIR', True)
> +    lddpath = syspath + '/libc/usr/bin/ldd'
> +
> +    if os.path.exists(lddpath):
> +        cmd1 = 'sed -i -e \'s#/usr/bin/bash#/bin/bash#\' ' + lddpath

Are you trying to sed-in-place ldd executable, which is relative to 
${EXTERNAL_TOOLCHAIN} that can be installed system-wide w/o necessary 
permissions?


> +        cmd2 = lddpath + ' --version'
> +        try:
> +            stdout, stderr = bb.process.run(cmd1, cwd=topdir, stderr=subprocess.PIPE)
> +            stdout, stderr = bb.process.run(cmd2, cwd=topdir, stderr=subprocess.PIPE)
> +        except bb.process.CmdError as exc:
> +            bb.error('Failed to obtain external Arm libc version: %s' % exc)
> +            return 'UNKNOWN'
> +        else:
> +            first_line = stdout.splitlines()[0]
> +            return first_line.split()[2]
>  
> -    if os.path.exists(libpath):
> -        for file in os.listdir(libpath):
> -            if file.find('libc-') == 0:
> -                return file[5:-3]
>      return 'UNKNOWN'
>  
>  def eat_get_kernel_version(d):
> -- 
> 2.17.1
> 

-- 
Regards,
Denys Dmytriyenko <denis@denix.org>
PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964
Fingerprint: 25FC E4A5 8A72 2F69 1186  6D76 4209 0272 9A92 C964


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] external-arm-toolchain-versions: Use ldd to get libc version
  2022-04-28 14:00 ` [PATCH 1/2] external-arm-toolchain-versions: Use ldd to get libc version Denys Dmytriyenko
@ 2022-04-28 19:03   ` Jon Mason
  2022-04-28 19:16     ` Denys Dmytriyenko
  2022-04-29  6:30     ` Sumit Garg
  0 siblings, 2 replies; 7+ messages in thread
From: Jon Mason @ 2022-04-28 19:03 UTC (permalink / raw)
  To: Denys Dmytriyenko
  Cc: Sumit Garg, meta-arm, jon.mason, ross.burton, daniel.thompson

Sumit, 
It passes my CI.  Can you answer Denys's question below?

WE're going to cut the branch tomorrow, and I'd really like to get
this in.  However, if it's not ready, we'll push it to the next
release.

Thanks,
Jon

On Thu, Apr 28, 2022 at 10:00:01AM -0400, Denys Dmytriyenko wrote:
> On Thu, Apr 28, 2022 at 05:58:47PM +0530, Sumit Garg wrote:
> > Arm GCC 11.2 binary release has moved away from keeping libc library
> > versioning info as libc-{EAT_VER_LIBC}.so. So rather switch to
> > retrieving libc version by parsing output from "$ ldd --version".
> > 
> > Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> > ---
> >  .../external-arm-toolchain-versions.inc       | 43 ++++++++-----------
> >  1 file changed, 17 insertions(+), 26 deletions(-)
> > 
> > diff --git a/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc b/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
> > index a89f2f0..388987a 100644
> > --- a/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
> > +++ b/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
> > @@ -50,37 +50,28 @@ def eat_get_gcc_version(d):
> >  
> >  def eat_get_libc_version(d):
> >      import os,bb
> > +    import subprocess
> > +
> >      syspath = bb.data.expand('${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}', d)
> >      if not syspath:
> >          return 'UNKNOWN'
> >  
> > -    libpath = syspath + '/libc/' + bb.data.expand('${EAT_LIBDIR}/${EAT_TARGET_SYS}/', d)
> > -
> > -    if os.path.exists(libpath):
> > -        for file in os.listdir(libpath):
> > -            if file.find('libc-') == 0:
> > -                return file[5:-3]
> > -
> > -    libpath = syspath + '/libc/' + bb.data.expand('${EAT_LIBDIR}/', d)
> > -
> > -    if os.path.exists(libpath):
> > -        for file in os.listdir(libpath):
> > -            if file.find('libc-') == 0:
> > -                return file[5:-3]
> > -
> > -    libpath = syspath + '/libc/usr/' + bb.data.expand('${EAT_LIBDIR}/${EAT_TARGET_SYS}/', d)
> > -
> > -    if os.path.exists(libpath):
> > -        for file in os.listdir(libpath):
> > -            if file.find('libc-') == 0:
> > -                return file[5:-3]
> > -
> > -    libpath = syspath + '/libc/usr/' + bb.data.expand('${EAT_LIBDIR}/', d)
> > +    topdir = d.getVar('TOPDIR', True)
> > +    lddpath = syspath + '/libc/usr/bin/ldd'
> > +
> > +    if os.path.exists(lddpath):
> > +        cmd1 = 'sed -i -e \'s#/usr/bin/bash#/bin/bash#\' ' + lddpath
> 
> Are you trying to sed-in-place ldd executable, which is relative to 
> ${EXTERNAL_TOOLCHAIN} that can be installed system-wide w/o necessary 
> permissions?
> 
> 
> > +        cmd2 = lddpath + ' --version'
> > +        try:
> > +            stdout, stderr = bb.process.run(cmd1, cwd=topdir, stderr=subprocess.PIPE)
> > +            stdout, stderr = bb.process.run(cmd2, cwd=topdir, stderr=subprocess.PIPE)
> > +        except bb.process.CmdError as exc:
> > +            bb.error('Failed to obtain external Arm libc version: %s' % exc)
> > +            return 'UNKNOWN'
> > +        else:
> > +            first_line = stdout.splitlines()[0]
> > +            return first_line.split()[2]
> >  
> > -    if os.path.exists(libpath):
> > -        for file in os.listdir(libpath):
> > -            if file.find('libc-') == 0:
> > -                return file[5:-3]
> >      return 'UNKNOWN'
> >  
> >  def eat_get_kernel_version(d):
> > -- 
> > 2.17.1
> > 
> 
> -- 
> Regards,
> Denys Dmytriyenko <denis@denix.org>
> PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964
> Fingerprint: 25FC E4A5 8A72 2F69 1186  6D76 4209 0272 9A92 C964
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] external-arm-toolchain-versions: Use ldd to get libc version
  2022-04-28 19:03   ` Jon Mason
@ 2022-04-28 19:16     ` Denys Dmytriyenko
  2022-04-29  6:22       ` Sumit Garg
  2022-04-29  6:30     ` Sumit Garg
  1 sibling, 1 reply; 7+ messages in thread
From: Denys Dmytriyenko @ 2022-04-28 19:16 UTC (permalink / raw)
  To: Jon Mason; +Cc: Sumit Garg, meta-arm, jon.mason, ross.burton, daniel.thompson

On Thu, Apr 28, 2022 at 03:03:16PM -0400, Jon Mason wrote:
> Sumit, 
> It passes my CI.  Can you answer Denys's question below?
> 
> WE're going to cut the branch tomorrow, and I'd really like to get
> this in.  However, if it's not ready, we'll push it to the next
> release.
> 
> Thanks,
> Jon
> 
> On Thu, Apr 28, 2022 at 10:00:01AM -0400, Denys Dmytriyenko wrote:
> > On Thu, Apr 28, 2022 at 05:58:47PM +0530, Sumit Garg wrote:
> > > Arm GCC 11.2 binary release has moved away from keeping libc library
> > > versioning info as libc-{EAT_VER_LIBC}.so. So rather switch to
> > > retrieving libc version by parsing output from "$ ldd --version".
> > > 
> > > Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> > > ---
> > >  .../external-arm-toolchain-versions.inc       | 43 ++++++++-----------
> > >  1 file changed, 17 insertions(+), 26 deletions(-)
> > > 
> > > diff --git a/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc b/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
> > > index a89f2f0..388987a 100644
> > > --- a/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
> > > +++ b/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
> > > @@ -50,37 +50,28 @@ def eat_get_gcc_version(d):
> > >  
> > >  def eat_get_libc_version(d):
> > >      import os,bb
> > > +    import subprocess
> > > +
> > >      syspath = bb.data.expand('${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}', d)
> > >      if not syspath:
> > >          return 'UNKNOWN'
> > >  
> > > -    libpath = syspath + '/libc/' + bb.data.expand('${EAT_LIBDIR}/${EAT_TARGET_SYS}/', d)
> > > -
> > > -    if os.path.exists(libpath):
> > > -        for file in os.listdir(libpath):
> > > -            if file.find('libc-') == 0:
> > > -                return file[5:-3]
> > > -
> > > -    libpath = syspath + '/libc/' + bb.data.expand('${EAT_LIBDIR}/', d)
> > > -
> > > -    if os.path.exists(libpath):
> > > -        for file in os.listdir(libpath):
> > > -            if file.find('libc-') == 0:
> > > -                return file[5:-3]
> > > -
> > > -    libpath = syspath + '/libc/usr/' + bb.data.expand('${EAT_LIBDIR}/${EAT_TARGET_SYS}/', d)
> > > -
> > > -    if os.path.exists(libpath):
> > > -        for file in os.listdir(libpath):
> > > -            if file.find('libc-') == 0:
> > > -                return file[5:-3]
> > > -
> > > -    libpath = syspath + '/libc/usr/' + bb.data.expand('${EAT_LIBDIR}/', d)
> > > +    topdir = d.getVar('TOPDIR', True)
> > > +    lddpath = syspath + '/libc/usr/bin/ldd'
> > > +
> > > +    if os.path.exists(lddpath):
> > > +        cmd1 = 'sed -i -e \'s#/usr/bin/bash#/bin/bash#\' ' + lddpath

Running an executable from a target sysroot is also questionable, but since 
it's a shell script and only used to print the version, is probably Ok.


> > Are you trying to sed-in-place ldd executable, which is relative to 
> > ${EXTERNAL_TOOLCHAIN} that can be installed system-wide w/o necessary 
> > permissions?

The way to bypass the bad shebang is to call the interpreter directly (and 
it's not bash specific, so /bin/sh should work):

$ /bin/sh $syspath/libc/usr/bin/ldd --version

In previous releases, ldd came with even more weird shebang, e.g.:

#! /arm/tools/gnu/bash/4.2/rhe6-x86_64/bin/bash

All that gets corrected in do_install() of external-arm-toolchain.bb anyway.


> > > +        cmd2 = lddpath + ' --version'
> > > +        try:
> > > +            stdout, stderr = bb.process.run(cmd1, cwd=topdir, stderr=subprocess.PIPE)
> > > +            stdout, stderr = bb.process.run(cmd2, cwd=topdir, stderr=subprocess.PIPE)
> > > +        except bb.process.CmdError as exc:
> > > +            bb.error('Failed to obtain external Arm libc version: %s' % exc)
> > > +            return 'UNKNOWN'
> > > +        else:
> > > +            first_line = stdout.splitlines()[0]
> > > +            return first_line.split()[2]
> > >  
> > > -    if os.path.exists(libpath):
> > > -        for file in os.listdir(libpath):
> > > -            if file.find('libc-') == 0:
> > > -                return file[5:-3]
> > >      return 'UNKNOWN'
> > >  
> > >  def eat_get_kernel_version(d):
> > > -- 
> > > 2.17.1

-- 
Regards,
Denys Dmytriyenko <denis@denix.org>
PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964
Fingerprint: 25FC E4A5 8A72 2F69 1186  6D76 4209 0272 9A92 C964


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] external-arm-toolchain-versions: Use ldd to get libc version
  2022-04-28 19:16     ` Denys Dmytriyenko
@ 2022-04-29  6:22       ` Sumit Garg
  0 siblings, 0 replies; 7+ messages in thread
From: Sumit Garg @ 2022-04-29  6:22 UTC (permalink / raw)
  To: Denys Dmytriyenko
  Cc: Jon Mason, meta-arm, jon.mason, ross.burton, daniel.thompson

On Fri, 29 Apr 2022 at 00:46, Denys Dmytriyenko <denis@denix.org> wrote:
>
> On Thu, Apr 28, 2022 at 03:03:16PM -0400, Jon Mason wrote:
> > Sumit,
> > It passes my CI.  Can you answer Denys's question below?
> >
> > WE're going to cut the branch tomorrow, and I'd really like to get
> > this in.  However, if it's not ready, we'll push it to the next
> > release.
> >
> > Thanks,
> > Jon
> >
> > On Thu, Apr 28, 2022 at 10:00:01AM -0400, Denys Dmytriyenko wrote:
> > > On Thu, Apr 28, 2022 at 05:58:47PM +0530, Sumit Garg wrote:
> > > > Arm GCC 11.2 binary release has moved away from keeping libc library
> > > > versioning info as libc-{EAT_VER_LIBC}.so. So rather switch to
> > > > retrieving libc version by parsing output from "$ ldd --version".
> > > >
> > > > Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> > > > ---
> > > >  .../external-arm-toolchain-versions.inc       | 43 ++++++++-----------
> > > >  1 file changed, 17 insertions(+), 26 deletions(-)
> > > >
> > > > diff --git a/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc b/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
> > > > index a89f2f0..388987a 100644
> > > > --- a/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
> > > > +++ b/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
> > > > @@ -50,37 +50,28 @@ def eat_get_gcc_version(d):
> > > >
> > > >  def eat_get_libc_version(d):
> > > >      import os,bb
> > > > +    import subprocess
> > > > +
> > > >      syspath = bb.data.expand('${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}', d)
> > > >      if not syspath:
> > > >          return 'UNKNOWN'
> > > >
> > > > -    libpath = syspath + '/libc/' + bb.data.expand('${EAT_LIBDIR}/${EAT_TARGET_SYS}/', d)
> > > > -
> > > > -    if os.path.exists(libpath):
> > > > -        for file in os.listdir(libpath):
> > > > -            if file.find('libc-') == 0:
> > > > -                return file[5:-3]
> > > > -
> > > > -    libpath = syspath + '/libc/' + bb.data.expand('${EAT_LIBDIR}/', d)
> > > > -
> > > > -    if os.path.exists(libpath):
> > > > -        for file in os.listdir(libpath):
> > > > -            if file.find('libc-') == 0:
> > > > -                return file[5:-3]
> > > > -
> > > > -    libpath = syspath + '/libc/usr/' + bb.data.expand('${EAT_LIBDIR}/${EAT_TARGET_SYS}/', d)
> > > > -
> > > > -    if os.path.exists(libpath):
> > > > -        for file in os.listdir(libpath):
> > > > -            if file.find('libc-') == 0:
> > > > -                return file[5:-3]
> > > > -
> > > > -    libpath = syspath + '/libc/usr/' + bb.data.expand('${EAT_LIBDIR}/', d)
> > > > +    topdir = d.getVar('TOPDIR', True)
> > > > +    lddpath = syspath + '/libc/usr/bin/ldd'
> > > > +
> > > > +    if os.path.exists(lddpath):
> > > > +        cmd1 = 'sed -i -e \'s#/usr/bin/bash#/bin/bash#\' ' + lddpath
>
> Running an executable from a target sysroot is also questionable, but since
> it's a shell script and only used to print the version, is probably Ok.
>

Yeah this was the sanest way I could find to retrieve libc version
that will work for all binary toolchain releases.

>
> > > Are you trying to sed-in-place ldd executable, which is relative to
> > > ${EXTERNAL_TOOLCHAIN} that can be installed system-wide w/o necessary
> > > permissions?
>

Ah, you are right there could be a permissions issue.

> The way to bypass the bad shebang is to call the interpreter directly (and
> it's not bash specific, so /bin/sh should work):
>
> $ /bin/sh $syspath/libc/usr/bin/ldd --version
>

Will use this instead in v2.

> In previous releases, ldd came with even more weird shebang, e.g.:
>
> #! /arm/tools/gnu/bash/4.2/rhe6-x86_64/bin/bash
>
> All that gets corrected in do_install() of external-arm-toolchain.bb anyway.
>

Yeah.

-Sumit

>
> > > > +        cmd2 = lddpath + ' --version'
> > > > +        try:
> > > > +            stdout, stderr = bb.process.run(cmd1, cwd=topdir, stderr=subprocess.PIPE)
> > > > +            stdout, stderr = bb.process.run(cmd2, cwd=topdir, stderr=subprocess.PIPE)
> > > > +        except bb.process.CmdError as exc:
> > > > +            bb.error('Failed to obtain external Arm libc version: %s' % exc)
> > > > +            return 'UNKNOWN'
> > > > +        else:
> > > > +            first_line = stdout.splitlines()[0]
> > > > +            return first_line.split()[2]
> > > >
> > > > -    if os.path.exists(libpath):
> > > > -        for file in os.listdir(libpath):
> > > > -            if file.find('libc-') == 0:
> > > > -                return file[5:-3]
> > > >      return 'UNKNOWN'
> > > >
> > > >  def eat_get_kernel_version(d):
> > > > --
> > > > 2.17.1
>
> --
> Regards,
> Denys Dmytriyenko <denis@denix.org>
> PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964
> Fingerprint: 25FC E4A5 8A72 2F69 1186  6D76 4209 0272 9A92 C964


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] external-arm-toolchain-versions: Use ldd to get libc version
  2022-04-28 19:03   ` Jon Mason
  2022-04-28 19:16     ` Denys Dmytriyenko
@ 2022-04-29  6:30     ` Sumit Garg
  1 sibling, 0 replies; 7+ messages in thread
From: Sumit Garg @ 2022-04-29  6:30 UTC (permalink / raw)
  To: Jon Mason
  Cc: Denys Dmytriyenko, meta-arm, jon.mason, ross.burton, daniel.thompson

Hi Jon,

On Fri, 29 Apr 2022 at 00:33, Jon Mason <jdmason@kudzu.us> wrote:
>
> Sumit,
> It passes my CI.  Can you answer Denys's question below?
>

I have incorporated Denys's suggestion in v2.

> WE're going to cut the branch tomorrow, and I'd really like to get
> this in.  However, if it's not ready, we'll push it to the next
> release.

I think v2 should be ready to go in. I have tested different poky
build combinations using gcc11 and gcc10 binary releases for Arm 32bit
and 64bit Qemu targets.

-Sumit

>
> Thanks,
> Jon
>
> On Thu, Apr 28, 2022 at 10:00:01AM -0400, Denys Dmytriyenko wrote:
> > On Thu, Apr 28, 2022 at 05:58:47PM +0530, Sumit Garg wrote:
> > > Arm GCC 11.2 binary release has moved away from keeping libc library
> > > versioning info as libc-{EAT_VER_LIBC}.so. So rather switch to
> > > retrieving libc version by parsing output from "$ ldd --version".
> > >
> > > Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> > > ---
> > >  .../external-arm-toolchain-versions.inc       | 43 ++++++++-----------
> > >  1 file changed, 17 insertions(+), 26 deletions(-)
> > >
> > > diff --git a/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc b/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
> > > index a89f2f0..388987a 100644
> > > --- a/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
> > > +++ b/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc
> > > @@ -50,37 +50,28 @@ def eat_get_gcc_version(d):
> > >
> > >  def eat_get_libc_version(d):
> > >      import os,bb
> > > +    import subprocess
> > > +
> > >      syspath = bb.data.expand('${EXTERNAL_TOOLCHAIN}/${EAT_TARGET_SYS}', d)
> > >      if not syspath:
> > >          return 'UNKNOWN'
> > >
> > > -    libpath = syspath + '/libc/' + bb.data.expand('${EAT_LIBDIR}/${EAT_TARGET_SYS}/', d)
> > > -
> > > -    if os.path.exists(libpath):
> > > -        for file in os.listdir(libpath):
> > > -            if file.find('libc-') == 0:
> > > -                return file[5:-3]
> > > -
> > > -    libpath = syspath + '/libc/' + bb.data.expand('${EAT_LIBDIR}/', d)
> > > -
> > > -    if os.path.exists(libpath):
> > > -        for file in os.listdir(libpath):
> > > -            if file.find('libc-') == 0:
> > > -                return file[5:-3]
> > > -
> > > -    libpath = syspath + '/libc/usr/' + bb.data.expand('${EAT_LIBDIR}/${EAT_TARGET_SYS}/', d)
> > > -
> > > -    if os.path.exists(libpath):
> > > -        for file in os.listdir(libpath):
> > > -            if file.find('libc-') == 0:
> > > -                return file[5:-3]
> > > -
> > > -    libpath = syspath + '/libc/usr/' + bb.data.expand('${EAT_LIBDIR}/', d)
> > > +    topdir = d.getVar('TOPDIR', True)
> > > +    lddpath = syspath + '/libc/usr/bin/ldd'
> > > +
> > > +    if os.path.exists(lddpath):
> > > +        cmd1 = 'sed -i -e \'s#/usr/bin/bash#/bin/bash#\' ' + lddpath
> >
> > Are you trying to sed-in-place ldd executable, which is relative to
> > ${EXTERNAL_TOOLCHAIN} that can be installed system-wide w/o necessary
> > permissions?
> >
> >
> > > +        cmd2 = lddpath + ' --version'
> > > +        try:
> > > +            stdout, stderr = bb.process.run(cmd1, cwd=topdir, stderr=subprocess.PIPE)
> > > +            stdout, stderr = bb.process.run(cmd2, cwd=topdir, stderr=subprocess.PIPE)
> > > +        except bb.process.CmdError as exc:
> > > +            bb.error('Failed to obtain external Arm libc version: %s' % exc)
> > > +            return 'UNKNOWN'
> > > +        else:
> > > +            first_line = stdout.splitlines()[0]
> > > +            return first_line.split()[2]
> > >
> > > -    if os.path.exists(libpath):
> > > -        for file in os.listdir(libpath):
> > > -            if file.find('libc-') == 0:
> > > -                return file[5:-3]
> > >      return 'UNKNOWN'
> > >
> > >  def eat_get_kernel_version(d):
> > > --
> > > 2.17.1
> > >
> >
> > --
> > Regards,
> > Denys Dmytriyenko <denis@denix.org>
> > PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964
> > Fingerprint: 25FC E4A5 8A72 2F69 1186  6D76 4209 0272 9A92 C964
> >


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-04-29  6:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28 12:28 [PATCH 1/2] external-arm-toolchain-versions: Use ldd to get libc version Sumit Garg
2022-04-28 12:28 ` [PATCH 2/2] external-arm-toolchain: Add support for Arm GCC 11.2 binary release Sumit Garg
2022-04-28 14:00 ` [PATCH 1/2] external-arm-toolchain-versions: Use ldd to get libc version Denys Dmytriyenko
2022-04-28 19:03   ` Jon Mason
2022-04-28 19:16     ` Denys Dmytriyenko
2022-04-29  6:22       ` Sumit Garg
2022-04-29  6:30     ` Sumit Garg

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.