tylerwhall/zephyr-rust

Build fails with current Zephyr versions

tomtor opened this issue · 3 comments

I have tried building with Zephyr SDK 0.10.3 (last version supported by https://github.com/zephyrproject-rtos/zephyr) and 0.13, but misc/mempool.h has to be replaced with sys/mempool.h

diff --git a/rust-smem.c b/rust-smem.c
index 4fc58f3..d9f19d9 100644
--- a/rust-smem.c
+++ b/rust-smem.c
@@ -1,6 +1,6 @@
 #include <zephyr.h>
 #include <init.h>
-#include <misc/mempool.h>
+#include <sys/mempool.h>
 #include <app_memory/app_memdomain.h>

 struct k_mem_domain rust_std_domain;
diff --git a/rust/zephyr-sys/wrapper.h b/rust/zephyr-sys/wrapper.h
index baf81fc..f7fd276 100644
--- a/rust/zephyr-sys/wrapper.h
+++ b/rust/zephyr-sys/wrapper.h
@@ -4,7 +4,7 @@

 #include <rust_syscall_macros.h>
 #include <kernel.h>
-#include <misc/mempool.h>
+#include <sys/mempool.h>
 #include <device.h>
 #include <uart.h>
 #include <uart_buffered.h>
diff --git a/syscall-thunk.c b/syscall-thunk.c
index 5d226a1..6a0a2df 100644
--- a/syscall-thunk.c
+++ b/syscall-thunk.c
@@ -1,6 +1,6 @@
 #define __ZEPHYR_DEFINE_SYSCALLS__
 #include <rust_syscall_macros.h>
 #include <kernel.h>
-#include <misc/mempool.h>
+#include <sys/mempool.h>
 #include <device.h>
 #include <uart.h>

after that step I get errors like:

error[E0425]: cannot find function `k_poll_signal_reset` in module `zephyr_sys::syscalls::kernel`
  --> /home/tom/src/zephyr-rust/rust/zephyr-core/src/poll_signal.rs:27:53
   |
27 |                     zephyr_sys::syscalls::$context::k_poll_signal_reset(
   |                                                     ^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `k_poll_signal_raise`
...

and

In file included from zephyr/include/generated/rust_syscall_macros.h:6,
                 from /home/tom/src/zephyr-rust/syscall-thunk.c:2:
/home/tom/src/zephyr/include/syscall.h:93:21: error: expected ';' before '_Bool'
 static ALWAYS_INLINE bool z_syscall_trap(void)
                     ^
                     ;
ninja: build stopped: subcommand failed.

Do I need an older specific version of https://github.com/zephyrproject-rtos/zephyr ?

@tomtor The 1.14 LTS branch is known to work. I'll see about supporting current master. It was building against master as of a couple months ago, I believe.

I pushed a few small fixes to get it building up through v2.0. v2.1 fails due to the syscall header generation having been reworked upstream.

gen_syscall_header.py is the file in question which was forked from upstream Zephyr. This needs more looking into. I'd like to support master and LTS in the same branch if possible.

I'd recommend the 1.14 LTS branch for now, as that's what I've been using for my zephyr-rust projects.

@tylerwhall Thanks for looking into this, 1.14 LTS does indeed build fine for me.