* [Buildroot] [PATCH v2 1/2] toolchain-external: add a check for unsupported toolchains
@ 2016-02-01 13:40 Romain Naour
2016-02-01 13:40 ` [Buildroot] [PATCH v2 2/2] toolchain-external: move the sysroot toolchain support check to helper function Romain Naour
2016-02-01 14:38 ` [Buildroot] [PATCH v2 1/2] toolchain-external: add a check for unsupported toolchains Thomas Petazzoni
0 siblings, 2 replies; 7+ messages in thread
From: Romain Naour @ 2016-02-01 13:40 UTC (permalink / raw)
To: buildroot
Some toolchain can't be used by Buildroot due to sysroot location
issue, so the $(ARCH)-linux-gnu-gcc -print-file-name=libc.a command
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>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
v2: move the check to check_unusable_toolchain helper
use unsupported toolchain instead of broken toolchains (ThomasP)
---
toolchain/helpers.mk | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 02cc0bb..fd99efe 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -418,6 +418,11 @@ check_unusable_toolchain = \
echo "and contain a lot of pre-built libraries that would conflict with"; \
echo "the ones Buildroot wants to build."; \
exit 1; \
+ fi; \
+ non_existent_sysroot=`$${__CROSS_CC} -print-file-name=libc.a` ; \
+ if test "$${non_existent_sysroot}" = "libc.a" ; then \
+ echo "Unable to detect the toolchain sysroot, Buildroot cannot handle this toolchain." ; \
+ exit 1 ; \
fi
#
--
2.4.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH v2 2/2] toolchain-external: move the sysroot toolchain support check to helper function
2016-02-01 13:40 [Buildroot] [PATCH v2 1/2] toolchain-external: add a check for unsupported toolchains Romain Naour
@ 2016-02-01 13:40 ` Romain Naour
2016-02-01 13:43 ` Romain Naour
2016-02-01 14:35 ` Thomas Petazzoni
2016-02-01 14:38 ` [Buildroot] [PATCH v2 1/2] toolchain-external: add a check for unsupported toolchains Thomas Petazzoni
1 sibling, 2 replies; 7+ messages in thread
From: Romain Naour @ 2016-02-01 13:40 UTC (permalink / raw)
To: buildroot
The sysroot toolchain support check is duplicated at tree location in the
external toolchain infra. So move it inside the check_unusable_toolchain helper
that is called when the sysroot is copied to staging directory.
Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
v2: new patch
---
toolchain/helpers.mk | 4 ++++
toolchain/toolchain-external/toolchain-external.mk | 14 +-------------
2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index fd99efe..add433a 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -423,6 +423,10 @@ check_unusable_toolchain = \
if test "$${non_existent_sysroot}" = "libc.a" ; then \
echo "Unable to detect the toolchain sysroot, Buildroot cannot handle 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." ; \
fi
#
diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index 518afd6..5ad6309 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -467,17 +467,13 @@ $$(printf $(call toolchain_find_libc_a,$(1)) | sed -r -e 's:.*/(usr/)?(lib(32|64
endef
# Checks for an already installed toolchain: check the toolchain
-# location, check that it supports sysroot, and then verify that it
+# location, check that it is usable, and then verify that it
# matches the configuration provided in Buildroot: ABI, C++ support,
# kernel headers version, type of C library and all C library features.
define TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS
$(Q)$(call check_cross_compiler_exists,$(TOOLCHAIN_EXTERNAL_CC))
$(Q)$(call check_unusable_toolchain,$(TOOLCHAIN_EXTERNAL_CC))
$(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
- if test -z "$${SYSROOT_DIR}" ; then \
- @echo "External toolchain doesn't support --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))); \
@@ -588,10 +584,6 @@ endef
define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
$(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
- if test -z "$${SYSROOT_DIR}" ; then \
- @echo "External toolchain doesn't support --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="" ; \
@@ -633,10 +625,6 @@ endef
define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS
$(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
- if test -z "$${SYSROOT_DIR}" ; then \
- @echo "External toolchain doesn't support --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] 7+ messages in thread
* [Buildroot] [PATCH v2 2/2] toolchain-external: move the sysroot toolchain support check to helper function
2016-02-01 13:40 ` [Buildroot] [PATCH v2 2/2] toolchain-external: move the sysroot toolchain support check to helper function Romain Naour
@ 2016-02-01 13:43 ` Romain Naour
2016-02-01 14:35 ` Thomas Petazzoni
1 sibling, 0 replies; 7+ messages in thread
From: Romain Naour @ 2016-02-01 13:43 UTC (permalink / raw)
To: buildroot
Hi All,
Le 01/02/2016 14:40, Romain Naour a ?crit :
> The sysroot toolchain support check is duplicated at tree location in the
> external toolchain infra. So move it inside the check_unusable_toolchain helper
> that is called when the sysroot is copied to staging directory.
>
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
> ---
> v2: new patch
> ---
> toolchain/helpers.mk | 4 ++++
> toolchain/toolchain-external/toolchain-external.mk | 14 +-------------
> 2 files changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> index fd99efe..add433a 100644
> --- a/toolchain/helpers.mk
> +++ b/toolchain/helpers.mk
> @@ -423,6 +423,10 @@ check_unusable_toolchain = \
> if test "$${non_existent_sysroot}" = "libc.a" ; then \
> echo "Unable to detect the toolchain sysroot, Buildroot cannot handle 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." ; \
oops, missing:
exit 1 ; \
Sorry.
Best regards,
Romain
> fi
>
> #
> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index 518afd6..5ad6309 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -467,17 +467,13 @@ $$(printf $(call toolchain_find_libc_a,$(1)) | sed -r -e 's:.*/(usr/)?(lib(32|64
> endef
>
> # Checks for an already installed toolchain: check the toolchain
> -# location, check that it supports sysroot, and then verify that it
> +# location, check that it is usable, and then verify that it
> # matches the configuration provided in Buildroot: ABI, C++ support,
> # kernel headers version, type of C library and all C library features.
> define TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS
> $(Q)$(call check_cross_compiler_exists,$(TOOLCHAIN_EXTERNAL_CC))
> $(Q)$(call check_unusable_toolchain,$(TOOLCHAIN_EXTERNAL_CC))
> $(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
> - if test -z "$${SYSROOT_DIR}" ; then \
> - @echo "External toolchain doesn't support --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))); \
> @@ -588,10 +584,6 @@ endef
>
> define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
> $(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
> - if test -z "$${SYSROOT_DIR}" ; then \
> - @echo "External toolchain doesn't support --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="" ; \
> @@ -633,10 +625,6 @@ endef
>
> define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS
> $(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
> - if test -z "$${SYSROOT_DIR}" ; then \
> - @echo "External toolchain doesn't support --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] 7+ messages in thread
* [Buildroot] [PATCH v2 2/2] toolchain-external: move the sysroot toolchain support check to helper function
2016-02-01 13:40 ` [Buildroot] [PATCH v2 2/2] toolchain-external: move the sysroot toolchain support check to helper function Romain Naour
2016-02-01 13:43 ` Romain Naour
@ 2016-02-01 14:35 ` Thomas Petazzoni
1 sibling, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2016-02-01 14:35 UTC (permalink / raw)
To: buildroot
Romain,
On Mon, 1 Feb 2016 14:40:17 +0100, Romain Naour wrote:
> The sysroot toolchain support check is duplicated at tree location in the
tree location -> three locations
> external toolchain infra. So move it inside the check_unusable_toolchain helper
> that is called when the sysroot is copied to staging directory.
The check_unusable_toolchain helper is called in
TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS, not when the sysroot is copied to
staging.
I think you should state that we can safely remove the checks in
TOOLCHAIN_EXTERNAL_INSTALL_* because the check is already done in
TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS, so we now it is not needed to do it
again later.
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH v2 1/2] toolchain-external: add a check for unsupported toolchains
2016-02-01 13:40 [Buildroot] [PATCH v2 1/2] toolchain-external: add a check for unsupported toolchains Romain Naour
2016-02-01 13:40 ` [Buildroot] [PATCH v2 2/2] toolchain-external: move the sysroot toolchain support check to helper function Romain Naour
@ 2016-02-01 14:38 ` Thomas Petazzoni
2016-02-01 14:57 ` Romain Naour
1 sibling, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2016-02-01 14:38 UTC (permalink / raw)
To: buildroot
Romain,
On Mon, 1 Feb 2016 14:40:16 +0100, Romain Naour wrote:
> 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
I think this is not "usual", for example it's not the case for
Buildroot or Crosstool-NG toolchain.
> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> index 02cc0bb..fd99efe 100644
> --- a/toolchain/helpers.mk
> +++ b/toolchain/helpers.mk
> @@ -418,6 +418,11 @@ check_unusable_toolchain = \
> echo "and contain a lot of pre-built libraries that would conflict with"; \
> echo "the ones Buildroot wants to build."; \
> exit 1; \
> + fi; \
> + non_existent_sysroot=`$${__CROSS_CC} -print-file-name=libc.a` ; \
The variable should not be named non_existent_sysroot since it may
exist. Also, you could use the existing toolchain_find_libc_a function,
no? So maybe:
libc_a_path=$(call toolchain_find_libc_a,$${__CROSS_CC}) ; \
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH v2 1/2] toolchain-external: add a check for unsupported toolchains
2016-02-01 14:38 ` [Buildroot] [PATCH v2 1/2] toolchain-external: add a check for unsupported toolchains Thomas Petazzoni
@ 2016-02-01 14:57 ` Romain Naour
2016-02-01 15:47 ` Thomas Petazzoni
0 siblings, 1 reply; 7+ messages in thread
From: Romain Naour @ 2016-02-01 14:57 UTC (permalink / raw)
To: buildroot
Hi Thomas,
Le 01/02/2016 15:38, Thomas Petazzoni a ?crit :
> Romain,
>
> On Mon, 1 Feb 2016 14:40:16 +0100, Romain Naour wrote:
>
>> 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
>
> I think this is not "usual", for example it's not the case for
> Buildroot or Crosstool-NG toolchain.
Ok, I'll simply remove this comment then. It seems that there is no "usual" case
with sysroot toolchains.
>
>> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
>> index 02cc0bb..fd99efe 100644
>> --- a/toolchain/helpers.mk
>> +++ b/toolchain/helpers.mk
>> @@ -418,6 +418,11 @@ check_unusable_toolchain = \
>> echo "and contain a lot of pre-built libraries that would conflict with"; \
>> echo "the ones Buildroot wants to build."; \
>> exit 1; \
>> + fi; \
>> + non_existent_sysroot=`$${__CROSS_CC} -print-file-name=libc.a` ; \
>
> The variable should not be named non_existent_sysroot since it may
> exist. Also, you could use the existing toolchain_find_libc_a function,
> no? So maybe:
>
> libc_a_path=$(call toolchain_find_libc_a,$${__CROSS_CC}) ; \
ok for the variable naming, but I didn't used toolchain_find_libc_a directly
because realpath -f is used by this function.
The path returned is $PWD/libc.a when something go wrong with the sysroot.
So the test would be test -d in this case but I think it's better to test the
path returned by __CROSS_CC directly against "libc.a".
Thoughts ?
Best regards,
Romain
>
> Thanks!
>
> Thomas
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH v2 1/2] toolchain-external: add a check for unsupported toolchains
2016-02-01 14:57 ` Romain Naour
@ 2016-02-01 15:47 ` Thomas Petazzoni
0 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2016-02-01 15:47 UTC (permalink / raw)
To: buildroot
Hello,
On Mon, 1 Feb 2016 15:57:38 +0100, Romain Naour wrote:
> > The variable should not be named non_existent_sysroot since it may
> > exist. Also, you could use the existing toolchain_find_libc_a function,
> > no? So maybe:
> >
> > libc_a_path=$(call toolchain_find_libc_a,$${__CROSS_CC}) ; \
>
> ok for the variable naming, but I didn't used toolchain_find_libc_a directly
> because realpath -f is used by this function.
>
> The path returned is $PWD/libc.a when something go wrong with the sysroot.
> So the test would be test -d in this case but I think it's better to test the
> path returned by __CROSS_CC directly against "libc.a".
Ah, right. So just keep your code as it was: call gcc directly with
-print-file-name.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-02-01 15:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-01 13:40 [Buildroot] [PATCH v2 1/2] toolchain-external: add a check for unsupported toolchains Romain Naour
2016-02-01 13:40 ` [Buildroot] [PATCH v2 2/2] toolchain-external: move the sysroot toolchain support check to helper function Romain Naour
2016-02-01 13:43 ` Romain Naour
2016-02-01 14:35 ` Thomas Petazzoni
2016-02-01 14:38 ` [Buildroot] [PATCH v2 1/2] toolchain-external: add a check for unsupported toolchains Thomas Petazzoni
2016-02-01 14:57 ` Romain Naour
2016-02-01 15:47 ` Thomas Petazzoni
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.