toolchain-external: add a check for unsupported toolchains
PATCH v4 1/3 toolchain-external: add a check for unsupported toolchains
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
Add a check to error out with an explicit error message
The check don't use toolchain_find_libc_a function directly since "realpath -f" is used internally and return an absolute path.
[1] https://bugs.linaro.org/show_bug.cgi?id=1995#c7
[2] http://lists.busybox.net/pipermail/buildroot/2014-October/110696.html
---
v4: rebase on master
v3: rename non_existent_sysroot to libc_a_path (ThomasP)
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(+)
toolchain/helpers.mk +5 -0
@@ -371,6 +371,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; \ + libc_a_path=`$${__CROSS_CC} -print-file-name=libc.a` ; \ + if test "$${libc_a_path}" = "libc.a" ; then \ + echo "Unable to detect the toolchain sysroot, Buildroot cannot use this toolchain." ; \ + exit 1 ; \ fi #
Signature · 1 line
2.5.5
PATCH v4 2/3 toolchain-external: move the sysroot toolchain support check to helper function
The sysroot toolchain support check is duplicated at two locations in the external toolchain infra. So move it inside the check_unusable_toolchain helper that is called when the toolchain package is configured (TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS).
The check in TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS can be safely removed since it's already done in check_unusable_toolchain helper.
The check in TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS was removed by 2a87b64f8e8a832a351f8552eb032e4b18431949.
---
v4: rebase on master
v3: add missing exit 1
s/$(__CROSS_CC)/$${__CROSS_CC}/
Improve commit log (ThomasP)
v2: new patch
--- toolchain/helpers.mk | 5 +++++ toolchain/toolchain-external/toolchain-external.mk | 10 +--------- 2 files changed, 6 insertions(+), 9 deletions(-)
toolchain/helpers.mk +5 -0
@@ -376,6 +376,11 @@ check_unusable_toolchain = \ if test "$${libc_a_path}" = "libc.a" ; then \ echo "Unable to detect the toolchain sysroot, 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." ; \ + exit 1 ; \ fi #
toolchain/toolchain-external/toolchain-external.mk +1 -9
@@ -493,17 +493,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))); \
@@ -654,10 +650,6 @@ endif 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="" ; \
Signature · 1 line
2.5.5
PATCH v4 3/3 toolchain/helper: update check_unusable_toolchain comment
In reply to Romain Naour---
v4: new patch
--- toolchain/helpers.mk | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
toolchain/helpers.mk +6 -3
@@ -348,9 +348,12 @@ check_cross_compiler_exists = \ fi # -# Check for toolchains known not to work with Buildroot. For now, we -# only check for Angstrom toolchains, by looking at the vendor part of -# the host tuple. +# Check for toolchains known not to work with Buildroot. +# - For the Angstrom toolchains, we check by looking at the vendor part of +# the host tuple. +# - Exclude distro-class toolchains which are not relocatable. +# - Exclude broken toolchains which return "libc.a" with -print-file-name. +# - Exclude toolchains which doesn't support --sysroot option. # # $1: cross-gcc path #
Signature · 1 line
2.5.5
PATCH v4 1/3 toolchain-external: add a check for unsupported toolchains
In reply to Romain NaourHello,
Quoted 34 lines · Romain Naour
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 deniedThis 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 varHere is the sysroot directory tree for CodeSourcery standard:
$ ls libc/sgxx-glibc etc lib lib64 sbin usr varAdd a check to error out with an explicit error message
The check don't use
toolchain_find_libc_afunction directly since "realpath -f" is used internally and return an absolute path.[1] https://bugs.linaro.org/show_bug.cgi?id=1995#c7
[2] http://lists.busybox.net/pipermail/buildroot/2014-October/110696.htmlSigned-off-by Romain Naour <[email protected]>Cc "Yann E. MORIN" <[email protected]>Cc Arnout Vandecappelle (Essensium/Mind) <[email protected]>Cc Thomas De Schampheleire <[email protected]>
Quoted 8 lines
---
v4: rebase on master
v3: renamenon_existent_sysroottolibc_a_path(ThomasP)
v2: move the check tocheck_unusable_toolchainhelper
use unsupported toolchain instead of broken toolchains (ThomasP)--- toolchain/helpers.mk | 5 +++++ 1 file changed, 5 insertions(+)
All three patches applied to master, thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com