opensbi icon indicating copy to clipboard operation
opensbi copied to clipboard

opensbi failed to build

Open ElyesH opened this issue 1 year ago • 2 comments

I've used c23 dialect to build test coreboot and got the following error: CC ramstage/arch/riscv/opensbi.o In file included from 3rdparty/opensbi/include/sbi/fw_dynamic.h:46, from src/arch/riscv/opensbi.c:8: 3rdparty/opensbi/include/sbi/sbi_types.h:47:33: error: two or more data types in declaration specifiers 47 | typedef int bool; | ^~~~ 3rdparty/opensbi/include/sbi/sbi_types.h:47:1: error: useless type name in empty declaration [-Werror] 47 | typedef int bool; | ^~~~~~~ cc1: all warnings being treated as errors make[2]: *** [Makefile:423: /cb-build/coreboot-gerrit.0/gcc/EMULATION_QEMU_RISCV_RV64_/ramstage/arch/riscv/opensbi.o] Error 1 make[2]: Leaving directory '/home/coreboot/node-root/workspace/coreboot-gerrit' https://qa.coreboot.org/job/coreboot-gerrit/260415/testReport/junit/(root)/gcc/EMULATION_QEMU_RISCV_RV64_/

Thx

ElyesH avatar Jul 14 '24 09:07 ElyesH

what are the make parameters that make opensbi fail to build?

tswaehn avatar Aug 16 '24 21:08 tswaehn

The problem is that you unconditionally typedef bool in this file opensbi/include/sbi/sbi_types.h! C23 already have bool .

Please use something like : #if __STDC_VERSION__ <= 201710L typedef _Bool bool; #endif

ElyesH avatar Sep 15 '24 06:09 ElyesH

gcc-15 will make this a bigger problem since it warns about it and the default cflags have -Werror

lu-zero avatar Apr 11 '25 10:04 lu-zero

Do you have a suggestion to fix it? Maybe you want to create a merge request.

tswaehn avatar Apr 11 '25 10:04 tswaehn

What was suggested in the comment above mine should work. I'll prepare something this weekend if nobody beats me at it.

lu-zero avatar Apr 11 '25 11:04 lu-zero

d539d64a23bbd64ba324eed595449bcc9c7be0cb fixed it in master. It can be closed.

lu-zero avatar Apr 12 '25 08:04 lu-zero