Support for wasm target?
rodrigopivi opened this issue · 2 comments
Is there any intention to support wasm32-unknown-unknown
target? I've tried to target web assembly but there are current old or deprecated dependencies that don't support wasm32 looking at the cargo tree
. How hard would it be updating or replacing some of the dependencies that use libraries like time
rustc-serialize
memchr
and support wasm?
Hello @rodrigopivi. Supporting wasm
is something I'd like to bring and I think replacing these dependencies wouldn't be too hard but the main problem I had was with crfsuite-rs
(https://github.com/snipsco/crfsuite-rs).
Because crfsuite-rs
is just a binding of the C version of crfsuite
. The steps to compile it are the following:
- compile C code for a given target into a static library using the
cc
crate - convert header into rust code using
bindgen
Which is basically what the crfsuite-sys
crate does.
I successfuly compiled the static library for wasm32 target (at least I have an artefact), but I had a problem with bindgen
to generate an API (no symbols were actually generated) which looks a lot like this issue rust-lang/rust-bindgen#751.
And even after hacking a bit this part (like trying to reuse a generated API from an other 32bit target). The linking part failed which could be whether the result of a bad compilation of the static library or something else I don't know.
In order word, I tried and I failed. But I have a strong feeling that is doable if we put enough time into it. And the first step to do so is to compile crfsuite-rs
for wasm32 and any help are welcome on this! So feel free to open a PR if you have any idea on how to do it.
What about this https://github.com/seanghay/web-crfsuite 😉