WasmEdge / WasmEdge

WasmEdge is a lightweight, high-performance, and extensible WebAssembly runtime for cloud native, edge, and decentralized applications. It powers serverless apps, embedded functions, microservices, smart contracts, and IoT devices.

Home Page:https://WasmEdge.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: <WasmEdge/example/plugin/get-string can not be compiled>

PinappleUnderTheSea opened this issue · comments

Summary

Both when I try to build and run get-string plugin by cmake and running .wasm file , I will meet some error and test.wasm can not be compiled

Current State

No response

Expected State

No response

Reproduction steps

  1. If I run mkdir build && cd build && cmake .., the terminal returns :
CMake Error at CMakeLists.txt:14 (target_include_directories):
  Error evaluating generator expression:

    $<TARGET_PROPERTY:wasmedgePlugin,INCLUDE_DIRECTORIES>

  Target "wasmedgePlugin" not found.

  1. If I run wat2wasm test.wat -o test.wasm && wasmedge test.wasm, the error message is :
[2024-04-02 15:20:42.821] [error] instantiation failed: unknown import, Code: 0x302
[2024-04-02 15:20:42.822] [error]     When linking module: "module_wasm_name" , function name: "get_string"
[2024-04-02 15:20:42.822] [error]     At AST node: import description
[2024-04-02 15:20:42.822] [error]     At AST node: import section
[2024-04-02 15:20:42.823] [error]     At AST node: module

I asked this question in Discord. The admin helped me a lot and suggest me to raise an issue here.

Screenshots

image
image

Any logs you want to share for showing the specific issue

No response

Components

CLI

WasmEdge Version or Commit you used

commit ecdee81

Operating system information

Ubuntu 22.094

Hardware Architecture

x86_64

Compiler flags and options

No response

@q82419
Could you please check this? Should we use the wasi-logging as the example instead of this one?

The build command should be:

cd WasmEdge
cmake -Bbuild -DWASMEDGE_BUILD_EXAMPLE=ON .
cmake --build build

And we will encounter another error due to the plugin API changes:

/Users/hydai/workspace/WasmEdge/examples/plugin/get-string/getstring.cpp:97:9: error: no type named 'PluginRegister' in namespace 'WasmEdge::Plugin'
Plugin::PluginRegister Register(&Descriptor);
~~~~~~~~^
1 error generated.

sorry maybe i have no idea about it because i am a freshman haha. I am just using and modifying this example to test my hostfuntion.

Fix this with PR #3322.