In linuxfromscratch we do a preliminary build of bash in order to run it later in a chroot environment without any dependencies from the host system:
./configure --prefix=/usr \ --build=x86_64-pc-linux-gnu \ --host=x86_64-lfs-linux-gnu \ --without-bash-malloc When we do this, the build runs: gcc -c -DHAVE_CONFIG_H -DSHELL -I. -I.. -I.. -I../include -I../lib -I. \ -Wno-parentheses -Wno-format-security -DDEBUG -g -DCROSS_COMPILING \ mkbuiltins.c Looking at ./builtins/mkbuiltins.c we have: #if !defined (CROSS_COMPILING) # include <config.h> ... #include "../bashansi.h" In bashansi.h there is: /* If bool is not a compiler builtin, prefer stdbool.h if we have it */ #if !defined (HAVE_C_BOOL) # if defined (HAVE_STDBOOL_H) # include <stdbool.h> # else # undef bool typedef unsigned char bool; # define true 1 # define false 0 # endif #endif This fails is using gcc-15 because with cstd-23 'bool' is a keyword and since config.h is not included, HAVE_C_BOOL is undefined. This patch fixes the problem: diff -Naur bash-5.3-rc1.orig/bashansi.h bash-5.3-rc1/bashansi.h --- bash-5.3-rc1.orig/bashansi.h 2024-03-25 11:17:49.000000000 -0500 +++ bash-5.3-rc1/bashansi.h 2025-05-21 15:15:56.269730519 -0500 @@ -35,17 +35,21 @@ # include "ansi_stdlib.h" #endif /* !HAVE_STDLIB_H */ -/* If bool is not a compiler builtin, prefer stdbool.h if we have it */ -#if !defined (HAVE_C_BOOL) -# if defined (HAVE_STDBOOL_H) -# include <stdbool.h> -# else -# undef bool +/* Explicitly check __STDC_VERSION__ here in addition to HAVE_C_BOOL: + in cross-compilation build tools does not include config.h.*/ +#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L + /* If bool is not a compiler builtin, prefer stdbool.h if we have it */ +# if !defined (HAVE_C_BOOL) +# if defined (HAVE_STDBOOL_H) +# include <stdbool.h> +# else +# undef bool typedef unsigned char bool; -# define true 1 -# define false 0 +# define true 1 +# define false 0 +# endif # endif -#endif +#endif /* __STDC_VERSION__ < 202311L */ /* Include <stddef.h>, or define substitutes (config.h handles ptrdiff_t). */ #ifdef HAVE_STDDEF_H