Open turbolent opened 1 week ago
I've solved this for now by post-processing the library manually with e.g.
$ install_name_tool -id libwasmi.dylib libwasmi.dylib
wasmtime has a build step to do this automatically, this could be maybe adopted here: https://github.com/bytecodealliance/wasmtime/blob/06377eb08a649619cc8ac9a934cb3f119017f3ef/crates/c-api/CMakeLists.txt#L108-L114
@turbolent Thanks a lot for the issue report! Since you already know what needs to be done (e.g. Wasmtime's solution), would you be willing to open a PR? :)
It looks like wasmi's CMake configuration already has code for this: https://github.com/wasmi-labs/wasmi/blob/7a302a98654523e631ae0d896d4d22911445b6b8/crates/c_api/CMakeLists.txt#L115-L133
I'm not familiar enough with the macOS linker to say what the behaviour should be.
Describe the bug
Similar to https://github.com/bytecodealliance/wasmtime/issues/984:
On macOS, the built dylib has an ID with a relative path,
@rpath
:Loading the dynamic library then results in
Expected behavior
Loading the built dynamic library should work.
To Reproduce
What Wasmi version was used?
68205d4
Bug occurs on Wasmi CLI or Wasmi library?
Wasmi C library
Ideally please provide minified Wasm (
.wasm
) or Wat (.wat
) file to reproduce.N/A
Follow steps in https://lib.rs/crates/wasmi_c_api_impl
Link against the dylib and run the binary