-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Open
Open
Copy link
Labels
area: RustIssues affecting Rust support in ZephyrIssues affecting Rust support in ZephyrbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bugLow impact/importance bug
Description
Describe the bug
Experimenting with Rust support in Zephyr, trying to follow the direction on https://docs.zephyrproject.org/latest/develop/languages/rust/index.html to get the hello_world sample working on qemu_cortex_m3
Running west build -p always -b qemu_cortex_m3 ../modules/lang/rust/samples/hello_world/
Gets a bindgen error from zephyrproject/modules/lang/rust/zephyr-sys/build.rs:103:10:
Regression
- This is a regression.
Steps to reproduce
Following https://docs.zephyrproject.org/latest/develop/languages/rust/index.html,
west config manifest.project-filter +zephyr-lang-rustwest updatewest build -p always -b qemu_cortex_m3 ../modules/lang/rust/samples/hello_world/
Relevant log output
(.venv) :~/zephyrproject/zephyr$ west build -p always -b qemu_cortex_m3 ../modules/lang/rust/samples/hello_world/
-- west build: making build dir /home/jxie/zephyrproject/zephyr/build pristine
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/jxie/zephyrproject/modules/lang/rust/samples/hello_world
-- CMake version: 3.22.1
-- Found Python3: /home/jxie/zephyrproject/.venv/bin/python3 (found suitable version "3.10.12", minimum required is "3.10") found components: Interpreter
-- Cache files will be written to: /home/jxie/.cache/zephyr
-- Zephyr version: 4.2.99 (/home/jxie/zephyrproject/zephyr)
-- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
-- Board: qemu_cortex_m3, qualifiers: ti_lm3s6965
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.17.4 (/home/jxie/zephyr-sdk-0.17.4)
-- Found toolchain: zephyr 0.17.4 (/home/jxie/zephyr-sdk-0.17.4)
-- Found Dtc: /home/jxie/zephyr-sdk-0.17.4/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.7.0", minimum required is "1.4.6")
-- Found BOARD.dts: /home/jxie/zephyrproject/zephyr/boards/qemu/cortex_m3/qemu_cortex_m3.dts
-- Generated zephyr.dts: /home/jxie/zephyrproject/zephyr/build/zephyr/zephyr.dts
-- Generated pickled edt: /home/jxie/zephyrproject/zephyr/build/zephyr/edt.pickle
-- Generated devicetree_generated.h: /home/jxie/zephyrproject/zephyr/build/zephyr/include/generated/zephyr/devicetree_generated.h
Parsing /home/jxie/zephyrproject/zephyr/Kconfig
Loaded configuration '/home/jxie/zephyrproject/zephyr/boards/qemu/cortex_m3/qemu_cortex_m3_defconfig'
Merged configuration '/home/jxie/zephyrproject/modules/lang/rust/samples/hello_world/prj.conf'
Configuration saved to '/home/jxie/zephyrproject/zephyr/build/zephyr/.config'
Kconfig header saved to '/home/jxie/zephyrproject/zephyr/build/zephyr/include/generated/zephyr/autoconf.h'
-- Found GnuLd: /home/jxie/zephyr-sdk-0.17.4/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/jxie/zephyr-sdk-0.17.4/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- Using ccache: /usr/bin/ccache
-- Found gen_kobject_list: /home/jxie/zephyrproject/zephyr/scripts/build/gen_kobject_list.py
-- Includes: /home/jxie/zephyrproject/zephyr/build/zephyr/include/generated/zephyr;/home/jxie/zephyrproject/zephyr/include;/home/jxie/zephyrproject/zephyr/build/zephyr/include/generated;/home/jxie/zephyrproject/zephyr/soc/ti/lm3s6965;/home/jxie/zephyrproject/zephyr/lib/libc/picolibc/include;/home/jxie/zephyrproject/zephyr/lib/libc/common/include;/home/jxie/zephyrproject/zephyr/lib/midi2/.;/home/jxie/zephyrproject/zephyr/soc/ti/lm3s6965/.;/home/jxie/zephyrproject/modules/hal/cmsis_6/CMSIS/Core/Include;/home/jxie/zephyrproject/zephyr/modules/cmsis_6/.;/home/jxie/zephyrproject/modules/hal/microchip/include;/home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/.;/home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/m0p;/home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals;/home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p;/home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p/sysctl;$<TARGET_PROPERTY:compiler,nostdinc_include>
-- Defines: KERNEL;__ZEPHYR__=1;$<TARGET_PROPERTY:compiler,security_fortify_compile_time>;__LINUX_ERRNO_EXTENSIONS__;PICOLIBC_LONG_LONG_PRINTF_SCANF;_POSIX_C_SOURCE=200809L;__PROGRAM_START;K_HEAP_MEM_POOL_SIZE=0
-- Building Rust llvm target thumbv7m-none-eabi
-- Processing crates:
-- module: zephyr
-- module: zephyr-build
-- module: zephyr-sys
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jxie/zephyrproject/zephyr/build
-- west build: building application
[1/130] Preparing syscall dependency handling
[3/130] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.2.99 (/home/jxie/zephyrproject/zephyr), build: v4.2.0-5542-g18d885d76cc2
[10/130] Building Rust application
Compiling proc-macro2 v1.0.101
Compiling unicode-ident v1.0.19
Compiling quote v1.0.41
Compiling memchr v2.7.6
Compiling regex-syntax v0.8.7
Compiling anyhow v1.0.100
Compiling glob v0.3.3
Compiling ucd-trie v0.1.7
Compiling prettyplease v0.2.37
Compiling libc v0.2.177
Compiling serde_core v1.0.228
Compiling minimal-lexical v0.2.1
Compiling clang-sys v1.8.1
Compiling cfg-if v1.0.3
Compiling serde v1.0.228
Compiling libloading v0.8.9
Compiling aho-corasick v1.1.3
Compiling pest v2.8.3
Compiling nom v7.1.3
Compiling unicode-width v0.1.14
Compiling syn v2.0.106
Compiling yansi-term v0.1.2
Compiling hashbrown v0.16.0
Compiling either v1.15.0
Compiling bindgen v0.70.1
Compiling regex-automata v0.4.12
Compiling pest_meta v2.8.3
Compiling equivalent v1.0.2
Compiling indexmap v2.11.4
Compiling cexpr v0.6.0
Compiling itertools v0.13.0
Compiling annotate-snippets v0.9.2
Compiling itoa v1.0.15
Compiling bitflags v2.9.4
Compiling rustc-hash v1.1.0
Compiling shlex v1.3.0
Compiling fnv v1.0.7
Compiling ryu v1.0.20
Compiling log v0.4.28
Compiling strsim v0.11.1
Compiling ident_case v1.0.1
Compiling unsafe-libyaml v0.2.11
Compiling portable-atomic v1.11.1
Compiling portable-atomic-util v0.2.4
Compiling critical-section v1.2.0
Compiling paste v1.0.15
Compiling gcd v2.3.0
Compiling fugit v0.3.7
Compiling regex v1.12.1
Compiling arrayvec v0.7.6
Compiling pest_generator v2.8.3
Compiling darling_core v0.20.11
Compiling serde_derive v1.0.228
Compiling pest_derive v2.8.3
Compiling darling_macro v0.20.11
Compiling darling v0.20.11
Compiling zephyr-macros v0.1.0 (/home/jxie/zephyrproject/modules/lang/rust/zephyr-macros)
Compiling serde_yaml_ng v0.10.0
Compiling zephyr-build v0.1.0 (/home/jxie/zephyrproject/modules/lang/rust/zephyr-build)
Compiling zephyr-sys v0.1.0 (/home/jxie/zephyrproject/modules/lang/rust/zephyr-sys)
Compiling zephyr v0.1.0 (/home/jxie/zephyrproject/modules/lang/rust/zephyr)
error: failed to run custom build command for `zephyr-sys v0.1.0 (/home/jxie/zephyrproject/modules/lang/rust/zephyr-sys)`
Caused by:
process didn't exit successfully: `/home/jxie/zephyrproject/zephyr/build/rust/target/release/build/zephyr-sys-28606a0e51bf12cd/build-script-build` (exit status: 101)
--- stdout
Clang version: ClangVersion { parsed: Some((14, 0)), full: "Ubuntu clang version 14.0.0-1ubuntu1.1" }
includes: Ok("/home/jxie/zephyrproject/zephyr/build/zephyr/include/generated/zephyr /home/jxie/zephyrproject/zephyr/include /home/jxie/zephyrproject/zephyr/build/zephyr/include/generated /home/jxie/zephyrproject/zephyr/soc/ti/lm3s6965 /home/jxie/zephyrproject/zephyr/lib/libc/picolibc/include /home/jxie/zephyrproject/zephyr/lib/libc/common/include /home/jxie/zephyrproject/zephyr/lib/midi2/. /home/jxie/zephyrproject/zephyr/soc/ti/lm3s6965/. /home/jxie/zephyrproject/modules/hal/cmsis_6/CMSIS/Core/Include /home/jxie/zephyrproject/zephyr/modules/cmsis_6/. /home/jxie/zephyrproject/modules/hal/microchip/include /home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/. /home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/m0p /home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals /home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p /home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p/sysctl ")
defines: Ok("KERNEL __ZEPHYR__=1 __LINUX_ERRNO_EXTENSIONS__ PICOLIBC_LONG_LONG_PRINTF_SCANF _POSIX_C_SOURCE=200809L __PROGRAM_START K_HEAP_MEM_POOL_SIZE=0")
Entry: -I/home/jxie/zephyrproject/zephyr/build/zephyr/include/generated/zephyr
Entry: -I/home/jxie/zephyrproject/zephyr/include
Entry: -I/home/jxie/zephyrproject/zephyr/build/zephyr/include/generated
Entry: -I/home/jxie/zephyrproject/zephyr/soc/ti/lm3s6965
Entry: -I/home/jxie/zephyrproject/zephyr/lib/libc/picolibc/include
Entry: -I/home/jxie/zephyrproject/zephyr/lib/libc/common/include
Entry: -I/home/jxie/zephyrproject/zephyr/lib/midi2/.
Entry: -I/home/jxie/zephyrproject/zephyr/soc/ti/lm3s6965/.
Entry: -I/home/jxie/zephyrproject/modules/hal/cmsis_6/CMSIS/Core/Include
Entry: -I/home/jxie/zephyrproject/zephyr/modules/cmsis_6/.
Entry: -I/home/jxie/zephyrproject/modules/hal/microchip/include
Entry: -I/home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/.
Entry: -I/home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/m0p
Entry: -I/home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals
Entry: -I/home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p
Entry: -I/home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p/sysctl
Entry: -DKERNEL
Entry: -D__ZEPHYR__=1
Entry: -D__LINUX_ERRNO_EXTENSIONS__
Entry: -DPICOLIBC_LONG_LONG_PRINTF_SCANF
Entry: -D_POSIX_C_SOURCE=200809L
Entry: -D__PROGRAM_START
Entry: -DK_HEAP_MEM_POOL_SIZE=0
cargo:rerun-if-env-changed=TARGET
cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_thumbv7m-none-eabi
cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_thumbv7m_none_eabi
cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS
cargo:rerun-if-changed=/home/jxie/zephyrproject/modules/lang/rust/zephyr-sys/wrapper.h
--- stderr
/home/jxie/zephyrproject/zephyr/include/zephyr/kernel_includes.h:20:10: fatal error: 'stddef.h' file not found
thread 'main' panicked at /home/jxie/zephyrproject/modules/lang/rust/zephyr-sys/build.rs:103:10:
Unable to generate bindings: ClangDiagnostic("/home/jxie/zephyrproject/zephyr/include/zephyr/kernel_includes.h:20:10: fatal error: 'stddef.h' file not found\n")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[119/130] Linking C static library zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a
FAILED: always-run-cargo.dummy rust/target/thumbv7m-none-eabi/release/librustapp.a rust/wrapper.c /home/jxie/zephyrproject/zephyr/build/always-run-cargo.dummy /home/jxie/zephyrproject/zephyr/build/rust/target/thumbv7m-none-eabi/release/librustapp.a /home/jxie/zephyrproject/zephyr/build/rust/wrapper.c
cd /home/jxie/zephyrproject/modules/lang/rust/samples/hello_world && /usr/bin/cmake -E env BUILD_DIR=/home/jxie/zephyrproject/zephyr/build ZEPHYR_BASE=/home/jxie/zephyrproject/zephyr DOTCONFIG=/home/jxie/zephyrproject/zephyr/build/zephyr/.config ZEPHYR_DTS=/home/jxie/zephyrproject/zephyr/build/zephyr/zephyr.dts INCLUDE_DIRS="/home/jxie/zephyrproject/zephyr/build/zephyr/include/generated/zephyr /home/jxie/zephyrproject/zephyr/include /home/jxie/zephyrproject/zephyr/build/zephyr/include/generated /home/jxie/zephyrproject/zephyr/soc/ti/lm3s6965 /home/jxie/zephyrproject/zephyr/lib/libc/picolibc/include /home/jxie/zephyrproject/zephyr/lib/libc/common/include /home/jxie/zephyrproject/zephyr/lib/midi2/. /home/jxie/zephyrproject/zephyr/soc/ti/lm3s6965/. /home/jxie/zephyrproject/modules/hal/cmsis_6/CMSIS/Core/Include /home/jxie/zephyrproject/zephyr/modules/cmsis_6/. /home/jxie/zephyrproject/modules/hal/microchip/include /home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/. /home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/m0p /home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals /home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p /home/jxie/zephyrproject/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p/sysctl " INCLUDE_DEFINES="KERNEL __ZEPHYR__=1 __LINUX_ERRNO_EXTENSIONS__ PICOLIBC_LONG_LONG_PRINTF_SCANF _POSIX_C_SOURCE=200809L __PROGRAM_START K_HEAP_MEM_POOL_SIZE=0" WRAPPER_FILE="/home/jxie/zephyrproject/zephyr/build/rust/wrapper.c" DT_AUGMENTS="/home/jxie/zephyrproject/modules/lang/rust/dt-rust.yaml" BINARY_DIR_INCLUDE_GENERATED="/home/jxie/zephyrproject/zephyr/build/zephyr/include/generated/zephyr" cargo build --release --config patch.crates-io.zephyr.path=\"/home/jxie/zephyrproject/modules/lang/rust/zephyr\" --config patch.crates-io.zephyr-build.path=\"/home/jxie/zephyrproject/modules/lang/rust/zephyr-build\" --config patch.crates-io.zephyr-sys.path=\"/home/jxie/zephyrproject/modules/lang/rust/zephyr-sys\" --target thumbv7m-none-eabi --target-dir /home/jxie/zephyrproject/zephyr/build/rust/target
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/jxie/zephyrproject/zephyr/buildImpact
Not sure
Environment
- Linux
- zephyr-sdk-0.17.4 + rust 1.90-x86_64-unknown-linux-gnu
- Zephyr commit hash: 18d885d
Additional Context
Building the non-rust hello_world for qemu_cortex_m3 works fine:
west build -p always -b qemu_cortex_m3 samples/hello_world/
Metadata
Metadata
Assignees
Labels
area: RustIssues affecting Rust support in ZephyrIssues affecting Rust support in ZephyrbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bugLow impact/importance bug