Skip to content

zephyr: The simple-file and simple-http samples don't compile. #4628

@lucasAbadFr

Description

@lucasAbadFr

Subject of the issue

The simple-file and simple-http Zephyr samples fail to compile on current main.
Both samples were originally introduced to demonstrate WASI libc support on Zephyr, but they are now broken due to missing includes and undeclared functions in the Zephyr platform layer.

Your environment

  • Host OS: Ubuntu 22.04
  • WAMR: current main
  • Zephyr: v3.7.0 (LTS)
  • Platform: Zephyr
  • CPU arch: ARM Cortex-M (tested on frdm_mcxn947/mcxn947)

Steps to reproduce

Simply follow the sample readme.

Expected behavior

Both samples should compile and run.

Actual behavior

Compilation fails with errors such as:

error: invalid use of incomplete typedef 'os_timespec' {aka 'struct timespec'}
error: storage size of 'ts' isn't known
warning: implicit declaration of function 'nanosleep' [-Wimplicit-function-declaration]
error: storage size of 'ts' isn't known

Extra info

The root cause is that os_timespec is only forward-declared as struct timespec, which is not defined in Zephyr unless CONFIG_POSIX_API=y.
However, the Zephyr port of WAMR is intended to work without enabling the POSIX API.
As a result, the samples cannot currently build against Zephyr v3.7 LTS.

I plan to submit a PR to fix this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions