Wasm-bindgen: target_family condition not met

Created on 12 Mar 2018  路  4Comments  路  Source: rustwasm/wasm-bindgen

Hi @alexcrichton! It's quite exciting to be writing someone who is so prolific in the Rust community.
Thank you so much for wasm-bindgen and thank you for your time.

Laying out my issue:

Host: nightly-x86_64-pc-windows-gnu
Version: rustc 1.26.0-nightly

Attempting to compile this library with cargo build --release --target wasm32-unknown-unknown.
Receiving long error output all having to do with undeclared modules:

sys::try_lock_exclusive(self)
    |         ^^^ Use of undeclared type or module `sys`

error[E0433]: failed to resolve. Use of undeclared type or module `MmapInner`
   --> C:\Users\guilf\.cargo\registry\src\github.com-1ecc6299db9ec823\memmap-0.5.2\src\lib.rs:130:9
    |
130 |         MmapInner::open(&file, prot, 0, len as usize).map(|inner| Mmap { inner: inner })
    |         ^^^^^^^^^ Use of undeclared type or module `MmapInner`
error[E0433]

Looking at memmap v0.5.2, I see the MmapInner module declared here if Windows target family and also on line 12 if Linux target family condition is met.

Is this occurring because wasm32-unknown-unknown is neither Windows nor Linux target family?

Most helpful comment

Ah yeah I believe this is an instance of a crate that isn't currently ported to wasm so the compilation error is coming out. The target_family for wasm32-unknown-unknown I think isn't set at all right now!

All 4 comments

Ah yeah I believe this is an instance of a crate that isn't currently ported to wasm so the compilation error is coming out. The target_family for wasm32-unknown-unknown I think isn't set at all right now!

Thank you. Is that what this issue and this as well are covering?

Sort of! In general though I'd guess that the memmap crate is going to need an entirely custom implementation for wasm in that we can't transparently use either of the existing Unix/Windows implementations. In that sense it's also a bug for memmap itself :(

I don't think real memmap is even possible for WASM currently unless it means shimming it to simply copy data for read-only mode.

Was this page helpful?
0 / 5 - 0 ratings