pola-rs / polars

Dataframes powered by a multithreaded, vectorized query engine, written in Rust
https://docs.pola.rs
Other
30.54k stars 1.98k forks source link

WASM build fails with "lazy" "streaming" features #18589

Open d3bgger opened 2 months ago

d3bgger commented 2 months ago

Checks

Reproducible example

Cargo.toml

[package]
name = "rust-polars-wasm"
version = "0.1.0"
authors = [""]
edition = "2018"

[lib]
crate-type = ["cdylib", "rlib"]

[dependencies]
wasm-bindgen = "0.2.84"

[dependencies.polars]
version = "*"
default-features = false
features = [
  "lazy",
  "streaming",
  "csv",
]

[profile.release]
opt-level = "s"

src/lib.rs

use polars::prelude::*;
use wasm_bindgen::prelude::*;

#[wasm_bindgen(start)]
fn main() -> Result<(), JsValue> {
    Ok(())
}

Log output

warning: lz4-sys@1.10.0: liblz4/lib/lz4.c:222:11: fatal error: 'stdlib.h' file not found
warning: lz4-sys@1.10.0:   222 | # include <stdlib.h>   /* malloc, calloc, free */

liblz4/lib/lz4frame.c:88:10: fatal error: 'string.h' file not found
  cargo:warning=   88 | #include <string.h>   /* memset, memcpy, memmove */

In file included from liblz4/lib/lz4hc.c:66:
  cargo:warning=liblz4/lib/lz4.c:222:11: fatal error: 'stdlib.h' file not found
  cargo:warning=  222 | # include <stdlib.h>   /* malloc, calloc, free */

liblz4/lib/xxhash.c:107:10: fatal error: 'stdlib.h' file not found
  cargo:warning=  107 | #include <stdlib.h>

Issue description

When adding "lazy" and "streaming" features and building with wasm-pack build --target web the build fails.

If these two features are not both added, but use one or the other, the build is successful.

d3bgger commented 2 months ago

As I understand, the root cause is that C is not supported (yet) for wasm32-unknown-unknown https://github.com/rustwasm/team/issues/291

But can I opt out of needing lz4 at all, since I don't use compression?