I'm trying to debug this linkage error since a few days now and I cannot figure out what is going on. The lib compiles and a
libquickjs.a is generated fine. I am using the
wasimake tool to generate proper Makefile for
wasm-wasi target. When I try to link it to a binary I get the error is:
= note: rust-lld: error: function signature mismatch: JS_Eval >>> defined as (i32, i32, i32, i32, i32, i32) -> void in /home/xx/quickjs-rs/target/wasm32-wasi/debug/deps/libquickjs_sys-995f03fd80479779.4xbv5ant39qjmd1j.rcgu.o >>> defined as (i32, i32, i32, i32, i32) -> i64 in /home/xx/quickjs-rs/target/wasm32-wasi/debug/build/libquickjs-sys-e4acb27dbeb38a89/out/quickjs/libquickjs.a(quickjs.c.obj)
The fork where I'm trying to do this is here: https://github.com/rafaelcaricio/quickjs-rs
Since it compiles fine for the target
x86_64-unknown-linux-gnu I imagine it is something related to
wasm32-wasi that, for some reason, changes the signature of the functions exported by the library. But I have cross-compiled successfully the chimlib crate to
wasm-wasi and ran the binary with
wasmer runtime without any problems. I really have no idea where this different function signature is coming from.
I am completely lost here. I don't know what to look for. Any help would be really appreciated. Any pointers to where I should look to debug this issue?