[Buildroot] [PATCH] toolchain/toolchain-buildroot: error if no libc available

James Hilliard james.hilliard1 at gmail.com
Sun May 15 19:32:31 UTC 2022


On Sun, May 15, 2022 at 5:04 AM Romain Naour <romain.naour at gmail.com> wrote:
>
> Each libc available in Buildroot to build an internal toolchain have
> dependencies (architecture, static build only, mmu only etc...).
>
> For examples, uClibc-ng is the only toolchain that support static only
> builds. But since uClibc-ng doesn't support all architecture available
> in Buildroot (nios2, riscv), we must prevent selecting static only
> configuration (BR2_STATIC_LIBS) on such architectures.
>
> For such broken configuration, we can start building a toolchain by
> building host-binutils and host-gcc-final without building
> host-gcc-initial, linux-headers and uclibc package.
>
> The build fail during host-gcc-final build with the following error:
>
> In file included from ../../../libgcc/libgcc2.c:27:
> ../../../libgcc/../gcc/tsystem.h:87:10: fatal error: stdio.h: No such file or directory
>    87 | #include <stdio.h>
>       |          ^~~~~~~~~
> compilation terminated.
>
> We can't add an uClibc-ng dependency on BR2_STATIC_LIBS option since
> it's also used for external toolchain backend.
> Instead add a check if BR2_TOOLCHAIN_BUILDROOT_LIBC is not empty

I think something like this is probably better:
https://patchwork.ozlabs.org/project/buildroot/patch/20220506054651.2853406-1-james.hilliard1@gmail.com/

>
> While at it, add a Kconfig comment for the user.
>
> Fixes:
> http://autobuild.buildroot.net/results/42965d286285d5d6cfbb39f6195c87fa05dd3283/
>
> Signed-off-by: Romain Naour <romain.naour at gmail.com>
> Cc: Giulio Benetti <giulio.benetti at benettiengineering.com>
> Cc: Thomas De Schampheleire <thomas.de_schampheleire at nokia.com>
> Cc: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
> ---
>  toolchain/toolchain-buildroot/Config.in              | 3 +++
>  toolchain/toolchain-buildroot/toolchain-buildroot.mk | 4 ++++
>  2 files changed, 7 insertions(+)
>
> diff --git a/toolchain/toolchain-buildroot/Config.in b/toolchain/toolchain-buildroot/Config.in
> index 8d9cf4cc68..a97b17acb8 100644
> --- a/toolchain/toolchain-buildroot/Config.in
> +++ b/toolchain/toolchain-buildroot/Config.in
> @@ -107,6 +107,9 @@ config BR2_TOOLCHAIN_BUILDROOT_LIBC
>         default "glibc"  if BR2_TOOLCHAIN_BUILDROOT_GLIBC
>         default "musl"   if BR2_TOOLCHAIN_BUILDROOT_MUSL
>
> +comment "No libc available for this target! Please check your configuration"
> +       depends on !BR2_TOOLCHAIN_BUILDROOT_LIBC
> +
>  source "package/linux-headers/Config.in.host"
>  source "package/linux-headers/Config.in"
>  source "package/musl/Config.in"
> diff --git a/toolchain/toolchain-buildroot/toolchain-buildroot.mk b/toolchain/toolchain-buildroot/toolchain-buildroot.mk
> index b30cc332d2..7688d44615 100644
> --- a/toolchain/toolchain-buildroot/toolchain-buildroot.mk
> +++ b/toolchain/toolchain-buildroot/toolchain-buildroot.mk
> @@ -6,6 +6,10 @@
>
>  BR_LIBC = $(call qstrip,$(BR2_TOOLCHAIN_BUILDROOT_LIBC))
>
> +ifeq ($(BR2_TOOLCHAIN_BUILDROOT):$(BR_LIBC),y:)
> +$(error "No libc available for this target! Please check your configuration.")
> +endif
> +
>  # Triggering the build of the host-gcc-final will automatically do the
>  # build of binutils, uClibc, kernel headers and all the intermediate
>  # gcc steps.
> --
> 2.35.3
>
> _______________________________________________
> buildroot mailing list
> buildroot at buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot



More information about the buildroot mailing list