Skip to contentSkip to conversation

package/am33x-cm3: fix build with gcc >= 15

Buildroot Peter Korsgaard 1 participant 1 message Oct 20

lore
Share & tools
lore
#0 lore raw

commit: https://gitlab.com/buildroot.org/buildroot/-/commit/874aba9eba6799b6bd033bac73e35af8970fde3a
branch: https://gitlab.com/buildroot.org/buildroot/-/tree/master

gcc 15 defaults to the C23 standard, where bool, true and false are keywords. The am33x-cm3 code base defines them in its own stddef.h, so the build fails with:

src/include/stddef.h:18:15: error: 'bool' cannot be defined via 'typedef'
18 | typedef _Bool bool;
| ^~~~
src/include/stddef.h:19:8: error: cannot use keyword 'false' as enumeration constant

   19 | enum { false, true };
      |        ^~~~~

The upstream project has not received any commit since 2018 and none of its branches fix this issue, so rather than carrying a patch that cannot be submitted to an active upstream, force the GNU C11 standard in the .mk file.

---
 package/am33x-cm3/am33x-cm3.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
package/am33x-cm3/am33x-cm3.mk +3 -1
index 8c890a75fc..f753e46134 100644
@@ -13,8 +13,10 @@ AM33X_CM3_LICENSE_FILES = License.txt
 
 # The build command below will use the standard cross-compiler (normally
 # build for Cortex-A8, to build the FW for the Cortex-M3.
+# The code base predates C23 and defines its own bool/true/false, so
+# force an older C standard to build with gcc >= 15.
 define AM33X_CM3_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) CC="$(TARGET_CC)" CROSS_COMPILE="$(TARGET_CROSS)" -C $(@D) all
+	$(TARGET_MAKE_ENV) $(MAKE) CC="$(TARGET_CC) -std=gnu11" CROSS_COMPILE="$(TARGET_CROSS)" -C $(@D) all
 endef
 
 define AM33X_CM3_INSTALL_TARGET_CMDS

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