riscv-software-src / opensbi

RISC-V Open Source Supervisor Binary Interface
Other
987 stars 496 forks source link

opensbi failed to build #365

Open ElyesH opened 2 months ago

ElyesH commented 2 months ago

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

tswaehn commented 1 month ago

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

ElyesH commented 1 day ago

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`