How to build with WASM
gitmalong opened this issue · comments
Hi!
I added gluesql to my project
gluesql = { version = "0.14.0", features = ["idb-storage"] }
but when trying to build it from a project based on https://github.com/leptos-rs/leptos/tree/main/examples/tailwind_csr_trunk I am facing
error[E0583]: file not found for module `sys`
--> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/errno-0.3.2/src/lib.rs:26:1
|
26 | mod sys;
| ^^^^^^^^
How can I make the WASM build work?
Thanks
to make your project to work on wasm build, you can not use sys
module.
in the error message you shared, it looks that you are using errno
crate.
https://github.com/lambda-fairy/rust-errno
that errno
crate does not support wasm build so you would be better to remove it from your project.
The starter project I shared compiles to WASM and the only thing I changed was adding the gluesql dependency. errno is part of the gluesql dependency tree
├── gluesql v0.14.0
│ ├── gluesql-cli v0.14.0
│ │ ├── anyhow v1.0.72
│ │ ├── clap v3.2.25
│ │ │ ├── atty v0.2.14
│ │ │ │ └── libc v0.2.147
│ │ │ ├── bitflags v1.3.2
│ │ │ ├── clap_derive v3.2.25 (proc-macro)
│ │ │ │ ├── heck v0.4.1
│ │ │ │ ├── proc-macro-error v1.0.4
│ │ │ │ │ ├── proc-macro-error-attr v1.0.4 (proc-macro)
│ │ │ │ │ │ ├── proc-macro2 v1.0.66 (*)
│ │ │ │ │ │ └── quote v1.0.32 (*)
│ │ │ │ │ │ [build-dependencies]
│ │ │ │ │ │ └── version_check v0.9.4
│ │ │ │ │ ├── proc-macro2 v1.0.66 (*)
│ │ │ │ │ ├── quote v1.0.32 (*)
│ │ │ │ │ └── syn v1.0.109
│ │ │ │ │ ├── proc-macro2 v1.0.66 (*)
│ │ │ │ │ ├── quote v1.0.32 (*)
│ │ │ │ │ └── unicode-ident v1.0.11
│ │ │ │ │ [build-dependencies]
│ │ │ │ │ └── version_check v0.9.4
│ │ │ │ ├── proc-macro2 v1.0.66 (*)
│ │ │ │ ├── quote v1.0.32 (*)
│ │ │ │ └── syn v1.0.109 (*)
│ │ │ ├── clap_lex v0.2.4
│ │ │ │ └── os_str_bytes v6.5.1
│ │ │ ├── indexmap v1.9.3
│ │ │ │ └── hashbrown v0.12.3
│ │ │ │ └── ahash v0.7.6
│ │ │ │ ├── getrandom v0.2.10
│ │ │ │ │ ├── cfg-if v1.0.0
│ │ │ │ │ └── libc v0.2.147
│ │ │ │ └── once_cell v1.18.0
│ │ │ │ [build-dependencies]
│ │ │ │ └── version_check v0.9.4
│ │ │ │ [build-dependencies]
│ │ │ │ └── autocfg v1.1.0
│ │ │ ├── once_cell v1.18.0
│ │ │ ├── strsim v0.10.0
│ │ │ ├── termcolor v1.2.0
│ │ │ └── textwrap v0.16.0
│ │ ├── edit v0.1.4
│ │ │ ├── tempfile v3.8.0
│ │ │ │ ├── cfg-if v1.0.0
│ │ │ │ ├── fastrand v2.0.0
│ │ │ │ └── rustix v0.38.8
│ │ │ │ ├── bitflags v2.4.0
│ │ │ │ ├── errno v0.3.2
│ │ │ │ │ └── libc v0.2.147
│ │ │ │ └── libc v0.2.147
│ │ │ └── which v4.4.0
│ │ │ ├── either v1.9.0
│ │ │ └── libc v0.2.147
This is because pkg/rust
in gluesql contains the cli
project.
Get gluesql-core
and gluesql-idb-storage
separately and try to build them.
Has this issue been resolved as well? ref #1377
This is because
pkg/rust
in gluesql contains thecli
project. Getgluesql-core
andgluesql-idb-storage
separately and try to build them.
Using these packages and adding this to .cargo/config
made it work for me:
[build]
target = "wasm32-unknown-unknown"