servo / rust-stb-image

Rust bindings to the awesome stb_image library
Other
68 stars 34 forks source link

Error when building for target wasm32-unknown-emscripten #91

Open tanis2000 opened 6 years ago

tanis2000 commented 6 years ago

If I try to build for wasm32-unknown-emscripten using the following command:

cargo build --target wasm32-unknown-emscripten

I get the following error:

   Compiling stb_image v0.2.2
error[E0308]: mismatched types
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/image.rs:75:33
   |
75 |     if !convert_hdr && stbi_is_hdr(bytes)!=0   {
   |                                    ^^^^^ expected u8, found i8
   |
   = note: expected type `*const u8`
              found type `*const i8`

error[E0308]: mismatched types
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/image.rs:76:30
   |
76 |         let buffer = stbi_loadf(bytes,
   |                                 ^^^^^ expected u8, found i8
   |
   = note: expected type `*const u8`
              found type `*const i8`

error[E0308]: mismatched types
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/image.rs:87:29
   |
87 |         let buffer = stbi_load(bytes,
   |                                ^^^^^ expected u8, found i8
   |
   = note: expected type `*const u8`
              found type `*const i8`

error: aborting due to 3 previous errors

error: Could not compile `stb_image`.
jdm commented 5 years ago

This may also be fixed by the solution I proposed in #94. Otherwise, it's probably easiest to add as *const _ to all of the problematic lines.