Skip to content

Conversation

@severinpolo
Copy link
Contributor

I was trying to compile a local project with cblas-sys as a dependency to the target wasm32-unknown-unknown using wasm-pack. I got a compilation error stating that the used aliases for the c-types are not found:

error[E0432]: unresolved imports `libc::c_char`, `libc::c_double`, `libc::c_float`, `libc::c_int`
  --> $HOME/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cblas-sys-0.2.0/src/lib.rs:11:12
   |
11 | use libc::{c_char, c_double, c_float, c_int};
   |            ^^^^^^  ^^^^^^^^  ^^^^^^^  ^^^^^ no `c_int` in the root
   |            |       |         |
   |            |       |         no `c_float` in the root
   |            |       no `c_double` in the root
   |            no `c_char` in the root
   |
   = help: consider importing this type alias instead:
           core::ffi::c_char
   = help: consider importing this type alias instead:
           core::ffi::c_double
   = help: consider importing this type alias instead:
           core::ffi::c_float
   = help: consider importing this type alias instead:
           core::ffi::c_int

I followed the suggestion to exchange the type aliases and use the ones in the core::ffi module. Using these types, cblas-sys compiles without errors to the wasm32-unknown-unknown target.

@IvanUkhov
Copy link
Member

Thank you! I wonder why it was overlooked before that libc is not needed. It probably applies to all sys crates in blas-lapack-rs.

@IvanUkhov IvanUkhov merged commit a9effbe into blas-lapack-rs:main May 28, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants