jq-rs icon indicating copy to clipboard operation
jq-rs copied to clipboard

It doesn't work with wasm

Open thinkrapido opened this issue 3 years ago • 1 comments

I want to do a transformation with the wasm build, but it isn't working. I think because of the bindings to libjq but I'm not sure.

jq-rs = "0.4.1"

thinkrapido avatar May 10 '22 01:05 thinkrapido

I've had some progress with targeting wasm32-unknown-unknown. My dev setup is macOS + nix, and my initial hurdles were tooling related. Eventually I successfully compiled a wasm module by including the following nix packages:

gcc
autoconf
automake
libtool

I also needed to force the build to select gcc over clang:

CC=gcc cargo build --release --target wasm32-unknown-unknown

The issue I'm facing now is that the built wasm module exposes jq's extern "C" declarations. For my particular usage that's a dead end because the framework I'm building with instantiates wasmer with a hardcoded interface that doesn't include such functions and thus errors.

It's a real shame, because I was quite excited by the use case! (I'm trying to build a decentralised map-reduce network where peers author and verify execution of jq programs on user-attested json.)

8e8b2c avatar May 22 '24 14:05 8e8b2c