Compilation failure on `wasm32-unknown-emscripten`: `platform_impl` is defined multiple times and type mismatch in `into_abi`
When compiling a Rust project using cpal for wasm32-unknown-emscripten, the build fails due to multiple errors:
-
Duplicate module definition (
E0428):error[E0428]: the name `platform_impl` is defined multiple times --> cpal-0.15.3/src/platform/mod.rs:640:1 622 | mod platform_impl { | ----------------- previous definition of the module `platform_impl` here ... 640 | mod platform_impl { | ^^^^^^^^^^^^^^^^^ `platform_impl` redefined hereIt seems like
platform_implis being defined twice, likely due to conditional compilation issues. -
Type mismatch (
E0308) ininto_abifunction:error[E0308]: mismatched types --> cpal-0.15.3/src/lib.rs:248:9 247 | fn into_abi(self) -> Self::Abi { | --------- expected `Option<u32>` because of return type 248 | match self { 249 | Self::Default => None, 250 | Self::Fixed(fc) => Some(fc), 251 | } 252 | .into_abi() | ___________________^ expected `Option<u32>`, found `f64`The
into_abi()function appears to be returning af64, whereas the expected type isOption<u32>.
Steps to Reproduce:
-
Create a Rust project with
cpal = "0.15.3"inCargo.toml.cargo new --bin cpal_test cd cpal_test cargo add cpal --version 0.15.3 -
Compile using:
cargo build --release --target=wasm32-unknown-emscripten -
Observe the errors.
#960 I run into this issue, but not sure how to contribute to this repository.
@mitchmindtree hello, how are you? can you provide us some instruction on what is the planned host API for default platform_impl for wasm32_unknown_emscripten?