Open BSDer opened 1 year ago
Yes, please do!
Please note that we do not have any maintainer working with BSD nor any BSD CI coverage. Experience shows that anything not covered by the CI is bound to eventually break. So it is likely that this can be a bit of a whack a mole game - but typically only minor patches are needed. Still, it is annoying when an update breaks things.
I wonder how much effort it would be to add BSD compilation to our Linux+Docker based CI. If that would be in place, a lot of issues would get caught an fixed prior to PRs being merged.
Ok, will do the pull request but before I would like to make sure RIOT is actually usable on FreeBSD by, e.g. compiling examples.
I just hit an issue that I am unsure how to handle: it seems that RIOT, as a project, relays on -std=c11
(as found in makefiles/cflags.inc.mk
), but newlib seems to be based on -std=c99
.
I get the following error when building for BOARD = rpi-pico
:
...
"gmake" -C RIOT/core
"gmake" -C RIOT/core/lib
In file included from RIOT/core/lib/atomic_c11.c:40:
/usr/local/arm-none-eabi/include/stdatomic.h: In function 'atomic_flag_test_and_set_explicit':
/usr/local/arm-none-eabi/include/stdatomic.h:386:17: error: request for member '__val' in something not a structure or union
386 | return (atomic_exchange_explicit(&__object->__flag, 1, __order));
| ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/arm-none-eabi/include/stdatomic.h: In function 'atomic_flag_clear_explicit':
/usr/local/arm-none-eabi/include/stdatomic.h:393:9: error: request for member '__val' in something not a structure or union
393 | atomic_store_explicit(&__object->__flag, 0, __order);
| ^~~~~~~~~~~~~~~~~~~~~
gmake[2]: *** [RIOT/Makefile.base:146: RIOT/examples/default/bin/rpi-pico/core_lib/atomic_c11.o] Error 1
gmake[1]: *** [RIOT/Makefile.base:31: ALL--RIOT/core/lib] Error 2
gmake: *** [RIOT/Makefile.include:759: application_default.module] Error 2
If I force CFLAGS += -std=c99
in makefiles/libc/newlib.mk
, this error would go away but compilation fails earlier with:
...
"gmake" -C RIOT/core
In file included from RIOT/core/sched.c:26:
RIOT/core/lib/include/assert.h:136:5: error: expected identifier or '(' before '{' token
136 | { enum { static_assert_failed_on_div_by_0 = 1 / (!!(cond)) }; }
| ^
RIOT/core/sched.c:63:1: note: in expansion of macro 'static_assert'
63 | static_assert(SCHED_PRIO_LEVELS <= 32, "SCHED_PRIO_LEVELS may at most be 32");
| ^~~~~~~~~~~~~
gmake[2]: *** [RIOT/Makefile.base:146: RIOT/examples/default/bin/rpi-pico/core/sched.o] Error 1
gmake[1]: *** [RIOT/Makefile.base:31: ALL--RIOT/core] Error 2
gmake: *** [RIOT/Makefile.include:759: application_default.module] Error 2
Can you suggest how to handle properly -std
? Thank you.
Description
Cannot build on latest FreeBSD (CURRENT).
This patch fixes the build:
Shall I create a pull request?