-
Notifications
You must be signed in to change notification settings - Fork 656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zephyr: unable to compile with WAMR_BUILD_LIBC_WASI
flag.
#3311
Comments
Status
|
@lucasAbadFr could you upload the patch or create a PR and change it to draft or WIP, so that others can have a try according to your work? |
@wenyongh thanks for your reply. A new zephyr sample called I've just opened a draft and noticed that I didn't adhere to the code guideline or other guidelines. These changes will cause most tests to fail. Please note that the work wasn't intended to be shared in this state. |
Hi @wenyongh, I managed to make a simple wasi module work (by breaking a lot of things). I would be interested to know if it work on someone else board. I updated the Also i'm open to any tips to compile a WASI module with libc (from wasi-sdk) linked. |
@lucasAbadFr I am not sure who is using zephyr but I believe there are some developers requiring libc-wasi on zephyr. I found there are many modifications in |
Thanks for the feedback. The CI fail due to the new struct and API defined in As for the changes in The main changes are in I'm curently investigating how to solve this issue and working to maintain compatibility with POSIX platform, which is the most used/maintained one. |
OK, I read the code and added some comments, it should be OK to abstract some |
) To address #3311. This work also implements the WASI support on Zephyr. Note that some comments haven't been addressed and will be fixed in the further patches.
Fixed issues in os_renameat and added os_is_* methods for stdin/stdout/stderr. ps. #3311. Signed-off-by: Stephen Berard <[email protected]>
Hello, I'm currently experimenting with sockets in WAMR on Zephyr, and I'm encountering some challenges.
nucleo-h563zi
board, but I'm facing compilation issues.Compilation issues
Plain compilation
I compilated the
http_client
to a wasm module and like with thesimple
sample, I included it in a header file. But when I ran it on the board I had:WAMR_BUILD_LIBC_WASI flag
After looking at the
socket-api
sample, I found that I need to use theWAMR_BUILD_LIBC_WASI
flag, so I added this flag to theCMakeLists.txt
file but it didn't work.The output of the compilation is the same described in this issue
My errors concist mainly of:
libc_errno.h
not found.nfds_t
unknown type.pthread_condattr_t
unknown type &CLOCK_MONOTONIC
undeclared.Try to resolve
I browsed the issues and found this Pull Request, but applying the fix lead to more errors and just one error was fixed.
In
core/shared/platform/zephyr/shared_platform.cmake
I added the following lines:The error
libc_errno.h
was fixed but the other errors still persist. I also get all the errors from the/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c
file, mostly linked to the File System API ( e.g errors onstruct pollfd
).Test on host
I reused the
socket-api
sample to compile and run thehttp_client
module and it worked on my host machine.Runtime configuration
Am I missing something ?
My runtime configuration is the following:
-- Build Configurations: Build as target THUMBV8 CMAKE_BUILD_TYPE WAMR Interpreter enabled WAMR AOT enabled WAMR Fast JIT disabled WAMR LLVM ORC JIT disabled Libc builtin enabled Libc WASI enabled Fast interpreter disabled Multiple modules disabled Bulk memory feature enabled Wakeup of blocking operations enabled Reference types disabled GC performance profiling disabled Global heap pool enabled Custom global heap size: 131072 Module instance context enabled Quick AOT/JIT entries enabled
How to use the address pool ?
I would like to have some help with the
libc_wasi_init(wasm_module, argc, argv, &wasi_parse_ctx)
function because if I understood it's mandatory to run a network application on WAMR.I looked at the
product-mini/plateforms/posix/main.c
&product-mini/plateforms/common/libc_wasi.c
files but didn't fully understand the implementation because it is made to parse arguments from the command line.Meanwhile, I'm trying to run the
http_client
module on the board, so I don't have the possibility to pass arguments to the module.I came up with this configuration before
wasm_runtime_full_init(&init_args)
call inmain.c
.But I'm not sure if it's the right way to use the
libc_wasi_parse
function.Should I change build policy ?
I tried to adapt the
CMakeLists.txt
file from thesimple
sample. What I changed:WAMR_BUILD_LIBC_WASI
flag.wamr-sdk
as an external projecxt and compile thelibapp_framework.a
.http_client
module.http_client.h
module.Any help will be appreciated. Thanks.
The text was updated successfully, but these errors were encountered: