Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] toolchain-external: add a check for broken toolchains
@ 2016-02-01 11:31 Romain Naour
  2016-02-01 13:03 ` Romain Naour
  2016-02-01 13:15 ` Thomas Petazzoni
  0 siblings, 2 replies; 3+ messages in thread
From: Romain Naour @ 2016-02-01 11:31 UTC (permalink / raw)
  To: buildroot

Some toolchain release can be broken due to sysroot location issue,
so the $(ARCH)-linux-gnu-gcc -print-file-name=libc.a command is
broken and return only "libc.a"

This lead to an error during the header check version helper,
so these toolchains can't be imported into Buildroot.

cc1: fatal error: $PWD/libc.a/usr/include/linux/version.h: No such file or directory
compilation terminated.
support/scripts/check-kernel-headers.sh: line 38: /tmp/check-headers.4V5PPF: Permission denied

This issue happen with the first linaro 2015.11 [1] release and
CodeSourcery standard edition [2].

Here is the sysroot directory tree for linaro 2015.11:
$ ls libc/arm-linux-gnueabihf
etc  lib  sbin  usr  var

Here is the sysroot directory tree for CodeSourcery standard:
$ ls libc/sgxx-glibc
etc  lib  lib64  sbin  usr  var

Usually the sysroot is located directly under libc directory
$ ls libc/
etc  lib  sbin  usr  var

Add a check to error out with an explicit error message

[1] https://bugs.linaro.org/show_bug.cgi?id=1995#c7
[2] http://lists.busybox.net/pipermail/buildroot/2014-October/110696.html

Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
 toolchain/toolchain-external/toolchain-external.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index 9ebf7bd..303a32a 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -478,6 +478,10 @@ define TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS
 		@echo "External toolchain doesn't support --sysroot. Cannot use." ; \
 		exit 1 ; \
 	fi ; \
+	if test "$${SYSROOT_DIR}" = "libc.a" ; then \
+		@echo "External toolchain broken, unable to find the main sysroot. Cannot use." ; \
+		exit 1 ; \
+	fi ; \
 	$(call check_kernel_headers_version,\
 		$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC)),\
 		$(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))); \
@@ -571,6 +575,10 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
 		@echo "External toolchain doesn't support --sysroot. Cannot use." ; \
 		exit 1 ; \
 	fi ; \
+	if test "$${SYSROOT_DIR}" = "libc.a" ; then \
+		@echo "External toolchain broken, unable to find the main sysroot. Cannot use." ; \
+		exit 1 ; \
+	fi ; \
 	ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
 	ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
 	SUPPORT_LIB_DIR="" ; \
-- 
2.4.3

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

* [Buildroot] [PATCH] toolchain-external: add a check for broken toolchains
  2016-02-01 11:31 [Buildroot] [PATCH] toolchain-external: add a check for broken toolchains Romain Naour
@ 2016-02-01 13:03 ` Romain Naour
  2016-02-01 13:15 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Romain Naour @ 2016-02-01 13:03 UTC (permalink / raw)
  To: buildroot

Le 01/02/2016 12:31, Romain Naour a ?crit :
> Some toolchain release can be broken due to sysroot location issue,
> so the $(ARCH)-linux-gnu-gcc -print-file-name=libc.a command is
> broken and return only "libc.a"
> 
> This lead to an error during the header check version helper,
> so these toolchains can't be imported into Buildroot.
> 
> cc1: fatal error: $PWD/libc.a/usr/include/linux/version.h: No such file or directory
> compilation terminated.
> support/scripts/check-kernel-headers.sh: line 38: /tmp/check-headers.4V5PPF: Permission denied
> 
> This issue happen with the first linaro 2015.11 [1] release and
> CodeSourcery standard edition [2].
> 
> Here is the sysroot directory tree for linaro 2015.11:
> $ ls libc/arm-linux-gnueabihf
> etc  lib  sbin  usr  var
> 
> Here is the sysroot directory tree for CodeSourcery standard:
> $ ls libc/sgxx-glibc
> etc  lib  lib64  sbin  usr  var
> 
> Usually the sysroot is located directly under libc directory
> $ ls libc/
> etc  lib  sbin  usr  var
> 
> Add a check to error out with an explicit error message
> 
> [1] https://bugs.linaro.org/show_bug.cgi?id=1995#c7
> [2] http://lists.busybox.net/pipermail/buildroot/2014-October/110696.html
> 
> Signed-off-by: Romain Naour <romain.naour@gmail.com>

Please forget this patch, it doesn't work as expected :(
I'll move the check to check_unusable_toolchain helper instead.

Best regards,
Romain

> ---
>  toolchain/toolchain-external/toolchain-external.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index 9ebf7bd..303a32a 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -478,6 +478,10 @@ define TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS
>  		@echo "External toolchain doesn't support --sysroot. Cannot use." ; \
>  		exit 1 ; \
>  	fi ; \
> +	if test "$${SYSROOT_DIR}" = "libc.a" ; then \
> +		@echo "External toolchain broken, unable to find the main sysroot. Cannot use." ; \
> +		exit 1 ; \
> +	fi ; \
>  	$(call check_kernel_headers_version,\
>  		$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC)),\
>  		$(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))); \
> @@ -571,6 +575,10 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
>  		@echo "External toolchain doesn't support --sysroot. Cannot use." ; \
>  		exit 1 ; \
>  	fi ; \
> +	if test "$${SYSROOT_DIR}" = "libc.a" ; then \
> +		@echo "External toolchain broken, unable to find the main sysroot. Cannot use." ; \
> +		exit 1 ; \
> +	fi ; \
>  	ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
>  	ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
>  	SUPPORT_LIB_DIR="" ; \
> 

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

* [Buildroot] [PATCH] toolchain-external: add a check for broken toolchains
  2016-02-01 11:31 [Buildroot] [PATCH] toolchain-external: add a check for broken toolchains Romain Naour
  2016-02-01 13:03 ` Romain Naour
@ 2016-02-01 13:15 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2016-02-01 13:15 UTC (permalink / raw)
  To: buildroot

Dear Romain Naour,

(I saw your e-mail saying that you are sending a new version, but
still.)

On Mon,  1 Feb 2016 12:31:27 +0100, Romain Naour wrote:

> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index 9ebf7bd..303a32a 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -478,6 +478,10 @@ define TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS
>  		@echo "External toolchain doesn't support --sysroot. Cannot use." ; \
>  		exit 1 ; \
>  	fi ; \
> +	if test "$${SYSROOT_DIR}" = "libc.a" ; then \
> +		@echo "External toolchain broken, unable to find the main sysroot. Cannot use." ; \
> +		exit 1 ; \
> +	fi ; \

I don't think "broken" is the appropriate word. The external toolchain
might be fine, maybe the Buildroot logic to use it is wrong. So maybe
the wording should be something like:

"Unable to detect the toolchain sysroot, Buildroot cannot handle this
toolchain".

>  	$(call check_kernel_headers_version,\
>  		$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC)),\
>  		$(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))); \
> @@ -571,6 +575,10 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
>  		@echo "External toolchain doesn't support --sysroot. Cannot use." ; \
>  		exit 1 ; \
>  	fi ; \
> +	if test "$${SYSROOT_DIR}" = "libc.a" ; then \
> +		@echo "External toolchain broken, unable to find the main sysroot. Cannot use." ; \
> +		exit 1 ; \
> +	fi ; \

Why do you need this check here as well? It has already been verified
in the CONFIGURE_CMDS, and it aborts if the test fails, so how could it
go up to the INSTALL_TARGET_CMDS step ?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

end of thread, other threads:[~2016-02-01 13:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-01 11:31 [Buildroot] [PATCH] toolchain-external: add a check for broken toolchains Romain Naour
2016-02-01 13:03 ` Romain Naour
2016-02-01 13:15 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox