Hello, I'm attempting to adapt the simple
sample to function as a Zephyr app directly, without utilizing wasm-micro-runtime
as a module. However, during this process, I encountered 2 issues:
wasm_runtime_lookup_function
Since this commit the wasm_runtime_lookup_function
definition has changed:
wasm_runtime_lookup_function(WASMModuleInstanceCommon *const module_inst,
- const char *name, const char *signature)
+ const char *name)
So it need to be fixed in app-mgr/app-manager/module_wasm_app.c
diff --git a/app-mgr/app-manager/module_wasm_app.c b/app-mgr/app-manager/module_wasm_app.c
index 6fd929b..979a3f3 100644
--- a/app-mgr/app-manager/module_wasm_app.c
+++ b/app-mgr/app-manager/module_wasm_app.c
@@ -193,9 +193,9 @@ app_manager_lookup_function(const wasm_module_inst_t module_inst,
{
wasm_function_inst_t func;
- func = wasm_runtime_lookup_function(module_inst, name, signature);
+ func = wasm_runtime_lookup_function(module_inst, name);
if (!func && name[0] == '_')
- func = wasm_runtime_lookup_function(module_inst, name + 1, signature);
+ func = wasm_runtime_lookup_function(module_inst, name + 1);
return func;
}
📄: Notes: May be removing the const char *signature
argument need to be done for app_manager_lookup_function
, but I didn't go that far.
The host-tool
build Policy
In the CMakeList.txt
, it's hardcoded in a way that we need to clone the repo with submodules. I also saw that a PR is open to address this issue but it's a month old.
22 set (IWASM_DIR ${REPO_ROOT_DIR}/deps/wasm-micro-runtime/core/iwasm)
24 set (SHARED_DIR ${REPO_ROOT_DIR}/deps/wasm-micro-runtime/core/shared)
But In my case I have a fork of wasm-micro-runtime
and I want to use this environment. So this cause this kind of errors when I build:
CMake Error at CMakeLists.txt:49 (include):
include could not find requested file:
/home/user/wamr-app-framework/test-tools/host-tool/../../deps/wasm-micro-runtime/core/shared/platform/linux/shared_platform.cmake
CMake Error at CMakeLists.txt:50 (include):
include could not find requested file:
/home/user/wamr-app-framework/test-tools/host-tool/../../deps/wasm-micro-runtime/core/shared/utils/shared_utils.cmake
CMake Error at CMakeLists.txt:51 (include):
include could not find requested file:
/home/user/wamr-app-framework/test-tools/host-tool/../../deps/wasm-micro-runtime/core/shared/mem-alloc/mem_alloc.cmake
CMake Error at CMakeLists.txt:53 (include):
include could not find requested file:
/home/user/wamr-app-framework/test-tools/host-tool/../../deps/wasm-micro-runtime/core/shared/coap/lib_coap.cmake
📄: Notes: I commented my implementation, that why the lines correspond to nothing, but the errors come from:
31 include (${SHARED_DIR}/platform/${WAMR_BUILD_PLATFORM}/shared_platform.cmake)
32 include (${SHARED_DIR}/utils/shared_utils.cmake)
33 include (${SHARED_DIR}/mem-alloc/mem_alloc.cmake)
35 include (${SHARED_DIR}/coap/lib_coap.cmake)
So I propose to change the build policy to something like that:
# Treatment for SHARED_DIR and IWASM_DIR
# if:
# 1. WAMR_ROOT_DIR or WAMR_DIR are set in the env
# 2. The submodules exist.
# else:
# Throw an error message
if(DEFINED ENV{WAMR_ROOT_DIR})
set(CORE_DIR $ENV{WAMR_ROOT_DIR}/core)
elseif(DEFINED ENV{WAMR_DIR})
set(CORE_DIR $ENV{WAMR_DIR/core})
elseif(IS_DIRECTORY ${REPO_ROOT_DIR}/deps/wasm-micro-runtime/core/)
set(CORE_DIR ${REPO_ROOT_DIR}/deps/wasm-micro-runtime/core/)
else()
message(FATAL_ERROR "'WAMR_ROOT_DIR' or 'WAMR_DIR' environment variables are not set and\
the directory '${REPO_ROOT_DIR}/deps/wasm-micro-runtime/core/' does not exist.\
Please set one of these environment variables or clone the git repository with submodules.")
endif()
set(IWASM_DIR ${CORE_DIR}/iwasm)
set(SHARED_DIR ${CORE_DIR}/shared)
📄: Notes: The WAMR_ROOT_DIR
or WAMR_DIR
could be set in an other CMakeList.txt
file, exported in a .sh
, or passed as command line parameters.
I'm also quite interested in the setup used for the app-manager
demo on Zephyr, because I'm able to make it compile but it doesn't work as expected, and the readme doesn't really detail this aspect. Should I open an issue on wasm-micro-runtime
or pass by another mean of communication ?