All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] toolchain/helper: check the arch sysroot
@ 2023-02-11 18:28 Romain Naour
  2023-02-11 18:28 ` [Buildroot] [PATCH 2/2] toolchain/toolchain-external/toolchain-external-codescape-mti-mips: remove wrong MIPS32r5 and MIPS64r5 support Romain Naour
  2023-02-15 20:59 ` [Buildroot] [PATCH 1/2] toolchain/helper: check the arch sysroot Arnout Vandecappelle
  0 siblings, 2 replies; 4+ messages in thread
From: Romain Naour @ 2023-02-11 18:28 UTC (permalink / raw)
  To: buildroot
  Cc: Thomas Petazzoni, Romain Naour, Giulio Benetti, Thomas De Schampheleire

Since the commit [1], the utils/genrandconfig script improved the
configuration randomization used by autobuilders. Since then it can
generate a configuration that is not suitable for an external toolchain
such the "Codescape IMG GNU Linux Toolchain".

Indeed this toolchain can be selected for mips32r5 or mips64r5 while only
mips32r2 or mips64r2 are really supported. The toolchain issue will be
fixed in a followup change.

We want to catch such issue in check_unusable_toolchain function otherwise
it is detected late during the sysroot import into staging and trigger
a weird error message:

ln: failed to create symbolic link 'output/host/mips64el-buildroot-linux-gnu/sysroot//nvmedata/autobuild/instance-25/buildroot/libc.a': No such file or directory
ln: failed to create symbolic link 'output/host/mips64el-buildroot-linux-gnu/sysroot/usr//nvmedata/autobuild/instance-25/buildroot/libc.a': No such file or directory

This is similar test than for the main sysroot check but this time we have
to use the toolchain cflags to check the architecture sysroot.

If the architecture sysroot doesn't exist, the toolchain will reply with
"libc.a".

Either the toolchain is really broken or we used a wrong target
architecture variant. In the later case, the toolchain infrastructure will
print a meaningful error message.

Note: We also may get a similar issue using the toolchain-external-custom package
if a toolchain is used with a wrong target architecture	variant.

Fixes:
http://autobuild.buildroot.org/results/701/701e8a5f713f7bdd1f32a4c549cdaac580e2522a/

[1] aeee90ec109b83c42779e6a2617f7d57e25a2b65

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
Cc: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
Note: We should improve the Buildroot testsuite to test the toolchain wrapper
      corner cases.
---
 toolchain/helpers.mk                                  | 11 +++++++++++
 .../toolchain-external/pkg-toolchain-external.mk      |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 1cd7494fdb..24c482923a 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -422,12 +422,16 @@ check_cross_compiler_exists = \
 #   the host tuple.
 # - Exclude distro-class toolchains which are not relocatable.
 # - Exclude broken toolchains which return "libc.a" with -print-file-name.
+# - Exclude toolchains used with wrong toolchain cflags or broken toolchains
+#   which return "libc.a" with -print-file-name and toolchain cflags.
 # - Exclude toolchains which doesn't support --sysroot option.
 #
 # $1: cross-gcc path
+# $1: toolchain cflags
 #
 check_unusable_toolchain = \
 	__CROSS_CC=$(strip $1) ; \
+	__TOOLCHAIN_CFLAGS=$(strip $2) ; \
 	vendor=`$${__CROSS_CC} -dumpmachine | cut -f2 -d'-'` ; \
 	if test "$${vendor}" = "angstrom" ; then \
 		echo "Angstrom toolchains are not pure toolchains: they contain" ; \
@@ -449,6 +453,13 @@ check_unusable_toolchain = \
 		echo "Unable to detect the toolchain sysroot, Buildroot cannot use this toolchain." ; \
 		exit 1 ; \
 	fi ; \
+	libc_a_archsysroot_path=`$${__CROSS_CC} $${__TOOLCHAIN_CFLAGS} -print-file-name=libc.a` ; \
+	if test "$${libc_a_archsysroot_path}" = "libc.a" ; then \
+		echo "Unable to detect the toolchain architecture sysroot." ; \
+		echo "Please check the Target Architecture Variant selected, the toolchains may not support it." ; \
+		echo "Buildroot cannot use this toolchain." ; \
+		exit 1 ; \
+	fi; \
 	sysroot_dir="$(call toolchain_find_sysroot,$${__CROSS_CC})" ; \
 	if test -z "$${sysroot_dir}" ; then \
 		echo "External toolchain doesn't support --sysroot. Cannot use." ; \
diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
index 299b6008aa..c37f3500d9 100644
--- a/toolchain/toolchain-external/pkg-toolchain-external.mk
+++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
@@ -563,7 +563,7 @@ endif
 # kernel headers version, type of C library and all C library features.
 define $(2)_CONFIGURE_CMDS
 	$$(Q)$$(call check_cross_compiler_exists,$$(TOOLCHAIN_EXTERNAL_CC))
-	$$(Q)$$(call check_unusable_toolchain,$$(TOOLCHAIN_EXTERNAL_CC))
+	$$(Q)$$(call check_unusable_toolchain,$$(TOOLCHAIN_EXTERNAL_CC),"$$(TOOLCHAIN_EXTERNAL_CFLAGS)")
 	$$(Q)SYSROOT_DIR="$$(call toolchain_find_sysroot,$$(TOOLCHAIN_EXTERNAL_CC))" ; \
 	$$(call check_kernel_headers_version,\
 		$$(BUILD_DIR),\
-- 
2.34.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH 2/2] toolchain/toolchain-external/toolchain-external-codescape-mti-mips: remove wrong MIPS32r5 and MIPS64r5 support
  2023-02-11 18:28 [Buildroot] [PATCH 1/2] toolchain/helper: check the arch sysroot Romain Naour
@ 2023-02-11 18:28 ` Romain Naour
  2023-03-04 11:27   ` Peter Korsgaard
  2023-02-15 20:59 ` [Buildroot] [PATCH 1/2] toolchain/helper: check the arch sysroot Arnout Vandecappelle
  1 sibling, 1 reply; 4+ messages in thread
From: Romain Naour @ 2023-02-11 18:28 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour, Thomas Petazzoni

This toolchain doesn't support MIPS32r5 and MIPS64r5 and the toolchain
infrastructure fail to import the sysroot to staging.

Fixes: c4a62fa6278058461ff9e501ba6e822486453493
Fixes: http://autobuild.buildroot.org/results/701/701e8a5f713f7bdd1f32a4c549cdaac580e2522a/

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 .../toolchain-external-codescape-mti-mips/Config.in            | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/toolchain/toolchain-external/toolchain-external-codescape-mti-mips/Config.in b/toolchain/toolchain-external/toolchain-external-codescape-mti-mips/Config.in
index c58c55119a..8217ddc38c 100644
--- a/toolchain/toolchain-external/toolchain-external-codescape-mti-mips/Config.in
+++ b/toolchain/toolchain-external/toolchain-external-codescape-mti-mips/Config.in
@@ -3,8 +3,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS
 	depends on BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
 	depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_7
 	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
-	depends on BR2_MIPS_CPU_MIPS32R2 || (BR2_MIPS_CPU_MIPS64R2 && !BR2_MIPS_SOFT_FLOAT) || \
-		BR2_MIPS_CPU_MIPS32R5 || (BR2_MIPS_CPU_MIPS64R5 && !BR2_MIPS_SOFT_FLOAT)
+	depends on BR2_MIPS_CPU_MIPS32R2 || (BR2_MIPS_CPU_MIPS64R2 && !BR2_MIPS_SOFT_FLOAT)
 	select BR2_TOOLCHAIN_EXTERNAL_GLIBC
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_7
-- 
2.34.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/2] toolchain/helper: check the arch sysroot
  2023-02-11 18:28 [Buildroot] [PATCH 1/2] toolchain/helper: check the arch sysroot Romain Naour
  2023-02-11 18:28 ` [Buildroot] [PATCH 2/2] toolchain/toolchain-external/toolchain-external-codescape-mti-mips: remove wrong MIPS32r5 and MIPS64r5 support Romain Naour
@ 2023-02-15 20:59 ` Arnout Vandecappelle
  1 sibling, 0 replies; 4+ messages in thread
From: Arnout Vandecappelle @ 2023-02-15 20:59 UTC (permalink / raw)
  To: Romain Naour, buildroot
  Cc: Giulio Benetti, Thomas De Schampheleire, Thomas Petazzoni



On 11/02/2023 19:28, Romain Naour wrote:
> Since the commit [1], the utils/genrandconfig script improved the
> configuration randomization used by autobuilders. Since then it can
> generate a configuration that is not suitable for an external toolchain
> such the "Codescape IMG GNU Linux Toolchain".
> 
> Indeed this toolchain can be selected for mips32r5 or mips64r5 while only
> mips32r2 or mips64r2 are really supported. The toolchain issue will be
> fixed in a followup change.
> 
> We want to catch such issue in check_unusable_toolchain function otherwise
> it is detected late during the sysroot import into staging and trigger
> a weird error message:
> 
> ln: failed to create symbolic link 'output/host/mips64el-buildroot-linux-gnu/sysroot//nvmedata/autobuild/instance-25/buildroot/libc.a': No such file or directory
> ln: failed to create symbolic link 'output/host/mips64el-buildroot-linux-gnu/sysroot/usr//nvmedata/autobuild/instance-25/buildroot/libc.a': No such file or directory
> 
> This is similar test than for the main sysroot check but this time we have
> to use the toolchain cflags to check the architecture sysroot.
> 
> If the architecture sysroot doesn't exist, the toolchain will reply with
> "libc.a".
> 
> Either the toolchain is really broken or we used a wrong target
> architecture variant. In the later case, the toolchain infrastructure will
> print a meaningful error message.
> 
> Note: We also may get a similar issue using the toolchain-external-custom package
> if a toolchain is used with a wrong target architecture	variant.
> 
> Fixes:
> http://autobuild.buildroot.org/results/701/701e8a5f713f7bdd1f32a4c549cdaac580e2522a/
> 
> [1] aeee90ec109b83c42779e6a2617f7d57e25a2b65
> 
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
> Cc: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

  Both applied to master, thanks.

  Regards,
  Arnout

> ---
> Note: We should improve the Buildroot testsuite to test the toolchain wrapper
>        corner cases.
> ---
>   toolchain/helpers.mk                                  | 11 +++++++++++
>   .../toolchain-external/pkg-toolchain-external.mk      |  2 +-
>   2 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> index 1cd7494fdb..24c482923a 100644
> --- a/toolchain/helpers.mk
> +++ b/toolchain/helpers.mk
> @@ -422,12 +422,16 @@ check_cross_compiler_exists = \
>   #   the host tuple.
>   # - Exclude distro-class toolchains which are not relocatable.
>   # - Exclude broken toolchains which return "libc.a" with -print-file-name.
> +# - Exclude toolchains used with wrong toolchain cflags or broken toolchains
> +#   which return "libc.a" with -print-file-name and toolchain cflags.
>   # - Exclude toolchains which doesn't support --sysroot option.
>   #
>   # $1: cross-gcc path
> +# $1: toolchain cflags
>   #
>   check_unusable_toolchain = \
>   	__CROSS_CC=$(strip $1) ; \
> +	__TOOLCHAIN_CFLAGS=$(strip $2) ; \
>   	vendor=`$${__CROSS_CC} -dumpmachine | cut -f2 -d'-'` ; \
>   	if test "$${vendor}" = "angstrom" ; then \
>   		echo "Angstrom toolchains are not pure toolchains: they contain" ; \
> @@ -449,6 +453,13 @@ check_unusable_toolchain = \
>   		echo "Unable to detect the toolchain sysroot, Buildroot cannot use this toolchain." ; \
>   		exit 1 ; \
>   	fi ; \
> +	libc_a_archsysroot_path=`$${__CROSS_CC} $${__TOOLCHAIN_CFLAGS} -print-file-name=libc.a` ; \
> +	if test "$${libc_a_archsysroot_path}" = "libc.a" ; then \
> +		echo "Unable to detect the toolchain architecture sysroot." ; \
> +		echo "Please check the Target Architecture Variant selected, the toolchains may not support it." ; \
> +		echo "Buildroot cannot use this toolchain." ; \
> +		exit 1 ; \
> +	fi; \
>   	sysroot_dir="$(call toolchain_find_sysroot,$${__CROSS_CC})" ; \
>   	if test -z "$${sysroot_dir}" ; then \
>   		echo "External toolchain doesn't support --sysroot. Cannot use." ; \
> diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
> index 299b6008aa..c37f3500d9 100644
> --- a/toolchain/toolchain-external/pkg-toolchain-external.mk
> +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
> @@ -563,7 +563,7 @@ endif
>   # kernel headers version, type of C library and all C library features.
>   define $(2)_CONFIGURE_CMDS
>   	$$(Q)$$(call check_cross_compiler_exists,$$(TOOLCHAIN_EXTERNAL_CC))
> -	$$(Q)$$(call check_unusable_toolchain,$$(TOOLCHAIN_EXTERNAL_CC))
> +	$$(Q)$$(call check_unusable_toolchain,$$(TOOLCHAIN_EXTERNAL_CC),"$$(TOOLCHAIN_EXTERNAL_CFLAGS)")
>   	$$(Q)SYSROOT_DIR="$$(call toolchain_find_sysroot,$$(TOOLCHAIN_EXTERNAL_CC))" ; \
>   	$$(call check_kernel_headers_version,\
>   		$$(BUILD_DIR),\
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 2/2] toolchain/toolchain-external/toolchain-external-codescape-mti-mips: remove wrong MIPS32r5 and MIPS64r5 support
  2023-02-11 18:28 ` [Buildroot] [PATCH 2/2] toolchain/toolchain-external/toolchain-external-codescape-mti-mips: remove wrong MIPS32r5 and MIPS64r5 support Romain Naour
@ 2023-03-04 11:27   ` Peter Korsgaard
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2023-03-04 11:27 UTC (permalink / raw)
  To: Romain Naour; +Cc: Thomas Petazzoni, buildroot

>>>>> "Romain" == Romain Naour <romain.naour@gmail.com> writes:

 > This toolchain doesn't support MIPS32r5 and MIPS64r5 and the toolchain
 > infrastructure fail to import the sysroot to staging.

 > Fixes: c4a62fa6278058461ff9e501ba6e822486453493
 > Fixes: http://autobuild.buildroot.org/results/701/701e8a5f713f7bdd1f32a4c549cdaac580e2522a/

 > Signed-off-by: Romain Naour <romain.naour@gmail.com>
 > Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Committed to 2022.11.x and 2022.02.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2023-03-04 11:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-11 18:28 [Buildroot] [PATCH 1/2] toolchain/helper: check the arch sysroot Romain Naour
2023-02-11 18:28 ` [Buildroot] [PATCH 2/2] toolchain/toolchain-external/toolchain-external-codescape-mti-mips: remove wrong MIPS32r5 and MIPS64r5 support Romain Naour
2023-03-04 11:27   ` Peter Korsgaard
2023-02-15 20:59 ` [Buildroot] [PATCH 1/2] toolchain/helper: check the arch sysroot Arnout Vandecappelle

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.