tylerwhall/zephyr-rust

Error building sample app: incompatible types when initializing type ‘int’ using type ‘k_timeout_t’

jpwright opened this issue · 1 comments

Running into this issue when trying to build the sample app today. I am able to build the Zephyr blinky sample without issue.

I am using Ubuntu 19.10, rustc version 1.41.1, west version 0.7.2.

jason@faraday:/media/jason/e/projects/zephyr-rust$ west build -p auto -b native_posix samples/rust-app/
[5/68] Building C object CMakeFiles/app.dir/src/main.c.obj
FAILED: CMakeFiles/app.dir/src/main.c.obj 
ccache /usr/bin/gcc -DBUILD_VERSION=zephyr-v2.3.0-397-g540ed9578613 -DKERNEL -D_FORTIFY_SOURCE=2 -D_POSIX_C_SOURCE=200809 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D__ZEPHYR__=1 -I/home/jason/zephyrproject/zephyr/include -Izephyr/include/generated -I/home/jason/zephyrproject/zephyr/soc/posix/inf_clock -I/home/jason/zephyrproject/zephyr/boards/posix/native_posix -I/media/jason/e/projects/zephyr-rust/uart-buffered/src -Os -imacros/media/jason/e/projects/zephyr-rust/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -imacros/home/jason/zephyrproject/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-address-of-packed-member -Wno-pointer-sign -Wpointer-arith -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/media/jason/e/projects/zephyr-rust/samples/rust-app=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/jason/zephyrproject/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/jason/zephyrproject=WEST_TOPDIR -ffunction-sections -fdata-sections -m32 -include /home/jason/zephyrproject/zephyr/arch/posix/include/posix_cheats.h -fno-freestanding -std=c11 -MD -MT CMakeFiles/app.dir/src/main.c.obj -MF CMakeFiles/app.dir/src/main.c.obj.d -o CMakeFiles/app.dir/src/main.c.obj   -c /media/jason/e/projects/zephyr-rust/samples/rust-app/src/main.c
In file included from /home/jason/zephyrproject/zephyr/include/zephyr.h:18,
                 from /media/jason/e/projects/zephyr-rust/samples/rust-app/src/main.c:1:
/home/jason/zephyrproject/zephyr/include/kernel.h:1107:16: error: incompatible types when initializing type ‘int’ using type ‘k_timeout_t’ {aka ‘struct <anonymous>’}
 1107 |  .init_delay = (delay),                                   \
      |                ^
/home/jason/zephyrproject/zephyr/include/kernel.h:1151:3: note: in expansion of macro ‘Z_THREAD_INITIALIZER’
 1151 |   Z_THREAD_INITIALIZER(&_k_thread_obj_##name,   \
      |   ^~~~~~~~~~~~~~~~~~~~
/media/jason/e/projects/zephyr-rust/samples/rust-app/src/main.c:9:1: note: in expansion of macro ‘K_THREAD_DEFINE’
    9 | K_THREAD_DEFINE(my_tid, MY_STACK_SIZE,
      | ^~~~~~~~~~~~~~~
[14/68] Building C object zephyr/arch/arch/posix/core/CMakeFiles/arch__posix__core.dir/posix_core.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /media/jason/e/projects/zephyr-rust/build

I get the same errors (and more after fixing that one) with the master branch of Zephyr. Try with v2.2.0 of Zephyr. Unfortunately the last several Zephyr releases have broken app compatibility, so I'll need to branch for 2.2 and port to 2.3.