-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation for WASM? #93
Comments
I think right now only EDIT: rustwasm/team#291 |
Two years have passed, has there been any progress on this matter? I finally got it to work with wasm32-unknown-emscripten after a lot of trouble recently, but trunk doesn't support wasm32-unknown-emscripten |
I tried to follow the steps listed in #139 (using current master) but it seemed to fail when building for git clone https://github.com/gyscos/zstd-rs --recursive
cd zstd-rs
git checkout 9334ec7
cd zstd-safe/zstd-sys/
cargo build --target wasm32-unknown-unknown --no-default-features --example it_work
|
Do you have that target installed? |
Yes: Running this block still fails for me with the same errors as above:
|
And you do have What if you add EDIT: looks like it relies on clang-8 at least: rust-lang/cc-rs#378 What is your clang version? |
|
Looks possibly related to this? https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=903110 (for Debian, but the idea might be the same) Basically there's a possibility your installed LLVM is not built with wasm support. I don't know much about either macos or LLVM build config, so I may be out of my depth. Also seeing this:
You can also try
|
This is helpful! When I set
But then when trying to build for
|
Are you running this on a m1 MacBook? Is this relevant? (The next comment however hints that it may not be a solution for everyone) |
Ironically, that was just the thread I needed to see to get everything to work! I'm on an intel, not M1 Mac; the comment below the one you linked to (rust-bitcoin/rust-secp256k1#283 (comment)), gave the Here's the full sequence that worked for me:
I also tested it in Thanks so much for your help! Looking forward to having this in a release! 🙂 |
Published zstd 0.10.1. We can start documenting this maybe in this github's project wiki. |
Hello, Did you happen to yank this version ? I'm trying to force the 0.10.1 version (can't use 0.11 easily because I also depend on async-compression ), and cargo tells me it cannot find it :
|
Hi! Yes, the version was yanked and replaced by 0.11.0. The new feature-based inclusion of the zdict_training code happened to break backward compatibility, and required a semver bump. |
Hm, it looks like the dictionary feature actually broke again wasm compilation:
I can trim less details if necessary, but hopefully that's enough to have an idea. (using [[package]]
name = "zstd"
version = "0.11.1+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a16b8414fde0414e90c612eba70985577451c4c504b99885ebed24762cb81a"
dependencies = [
"zstd-safe",
]
[[package]]
name = "zstd-safe"
version = "5.0.1+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c12659121420dd6365c5c3de4901f97145b79651fb1d25814020ed2ed0585ae"
dependencies = [
"libc",
"zstd-sys",
]
[[package]]
name = "zstd-sys"
version = "2.0.1+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b"
dependencies = [
"cc",
"libc",
] |
I just found out this PR #139 , so I assume I have to deactivate the dict feature and try again, which is going to take me a while to try out because of feature unification and the feature being default, I'll see. Indeed, |
@kevin-valerio I have seen your misleading comment in two repos. Either delete it or add that it doesn't fix any wasm build issues, just skips that part. |
I'm having a real hard time here. I think that I am narrowing it all down, but still seem to get stuck. Initially the error was due to
However, once I pin it to
Which ultimately led me here. I've tried a lot of different things, but nothing seems to work. Any help would be appreciated! Here is my [lib]
crate-type = ["cdylib", "rlib"]
[features]
default = ["console_error_panic_hook"]
[dependencies]
wasm-bindgen = "0.2.84"
textractor = { path = "../textractor-core" }
# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
# code size when deploying.
console_error_panic_hook = { version = "0.1.7", optional = true }
getrandom = { version = "0.2.15", features=["js"] }
zstd-sys = { version = "=2.0.9", default-features = false }
[dev-dependencies]
wasm-bindgen-test = "0.3.34"
[profile.release]
# Tell `rustc` to optimize for small code size.
opt-level = "s" I've got an updated
|
If it helps, parquet-wasm has a lockfile with it building successfully. But you also need to ensure that you're using clang from homebrew, not the default one provided by macos, because that one doesn't have support for wasm.
|
Wow. That was it. So simple... it's odd because I've been using rust and |
It's because zstd-rs uses a C shim, which is uncommon among rust wasm projects |
Hello, I tried using the
wasm
feature and targetedwasm32-unknown-unknown
, but I get a bunch of errors, many of which includefatal error: 'stdlib.h' file not found
, resulting in an error when building. What is the correct process to targetwasm32-unknown-unknown
?The text was updated successfully, but these errors were encountered: