Skip to contentSkip to conversation

package/bash: fix build with host GCC 15

PATCH Applied Florian Larysch 3 participants 6 messages May 7, 2025 – May 16, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/bash: fix build with host GCC 15

bash uses K&R function declarations which have been removed in C23.

Since part of the build process (like the mkbuiltins helper) is written in C, building bash now fails on hosts with GCC 15 (which defaults to C23).

Since properly fixing this on the source code level is a larger endeavor, just set the C standard to an old enough version for now.

---
 package/bash/bash.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/bash/bash.mk +4 -0
index 81f698f166..84f581da79 100644
@@ -26,6 +26,10 @@ BASH_CONF_ENV += \
 	bash_cv_func_sigsetjmp=present \
 	bash_cv_printf_a_format=yes
 
+ifeq ($(BR2_HOST_GCC_AT_LEAST_15),y)
+BASH_CONF_ENV += CFLAGS_FOR_BUILD="$(HOST_CFLAGS) -std=gnu17"
+endif
+
 # The static build needs some trickery
 ifeq ($(BR2_STATIC_LIBS),y)
 BASH_CONF_OPTS += --enable-static-link
Signature · 6 lines
2.49.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Note that this is also going to cause issues for the target build once toolchains start picking up GCC 15, but since this also requires touching the toolchain infrastructure to make Buildroot aware of GCC 15 and I'm not too familiar with that I wanted to keep the patch for the acute issue separate.

Florian
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Hello Florian,

Quoted 5 lines · On Wed, 7 May 2025 20:59:30 +0200 Florian Larysch <[email protected]> wrote:

Note that this is also going to cause issues for the target build once toolchains start picking up GCC 15, but since this also requires touching the toolchain infrastructure to make Buildroot aware of GCC 15 and I'm not too familiar with that I wanted to keep the patch for the acute issue separate.

I already posted patches to add GCC 15.x support in Buildroot:

	https://patchwork.ozlabs.org/project/buildroot/list/?series=454269

however, we haven't merged this series for now precisely because we know there are a LOT of packages that are failing to build with GCC 15.x. We expect to merge the GCC 15.x support after Buildroot 2025.05 has been released.

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Hello Thomas,

Quoted 1 line · Thomas Petazzoni via buildroot

I already posted patches to add GCC 15.x support in Buildroot:

Ah, thanks for pointing that out. I was focused on getting my firmware building again and hadn't checked yet.

Quoted 2 lines

We expect to merge the GCC 15.x support after Buildroot 2025.05 has been released.

Okay, that is probably the wisest option.

Florian
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw
In reply to Florian Larysch
Quoted 10 lines · Florian Larysch

bash uses K&R function declarations which have been removed in C23.

Since part of the build process (like the mkbuiltins helper) is written in C, building bash now fails on hosts with GCC 15 (which defaults to C23).

Since properly fixing this on the source code level is a larger endeavor, just set the C standard to an old enough version for now.

Applied to master, thanks.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw
In reply to Florian Larysch
Quoted 10 lines · Florian Larysch

bash uses K&R function declarations which have been removed in C23.

Since part of the build process (like the mkbuiltins helper) is written in C, building bash now fails on hosts with GCC 15 (which defaults to C23).

Since properly fixing this on the source code level is a larger endeavor, just set the C standard to an old enough version for now.

Applied to 2025.02.x, thanks.

Regards,
Arnout

Quoted 9 lines
---
  package/bash/bash.mk | 4 ++++
  1 file changed, 4 insertions(+)
package/bash/bash.mk +0 -0
index 81f698f166..84f581da79 100644

package/bash/bash.mk BASH_CONF_ENV += \ · line 35

Quoted 10 lines
package/bash/bash.mk +4 -0
@@ -26,6 +26,10 @@ BASH_CONF_ENV += \
  	bash_cv_func_sigsetjmp=present \
  	bash_cv_printf_a_format=yes
 
+ifeq ($(BR2_HOST_GCC_AT_LEAST_15),y)
+BASH_CONF_ENV += CFLAGS_FOR_BUILD="$(HOST_CFLAGS) -std=gnu17"
+endif
+
  # The static build needs some trickery
  ifeq ($(BR2_STATIC_LIBS),y)
  BASH_CONF_OPTS += --enable-static-link

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot