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

Problem when compiling for target wasm32-unknown-unknown #94

Open
tanis2000 opened this issue Apr 11, 2019 · 9 comments
Open

Problem when compiling for target wasm32-unknown-unknown #94

tanis2000 opened this issue Apr 11, 2019 · 9 comments

Comments

@tanis2000
Copy link

This is somewhat connected to #91

When trying to compile for the wasm32 target (without emscripten) but with cargo web build, I get some errors due to the libc dependency.

i.e.:

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:47:34
   |
47 |                          x: *mut c_int,
   |                                  ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:48:34
   |
48 |                          y: *mut c_int,
   |                                  ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:49:37
   |
49 |                          comp: *mut c_int,
   |                                     ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:50:36
   |
50 |                          req_comp: c_int)
   |                                    ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `FILE` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:53:44
   |
53 |         pub fn stbi_load_from_file(f: *mut FILE,
   |                                            ^^^^ not found in this scope
error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:54:44
   |
54 |                                    x: *mut c_int,
   |                                            ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:55:44
   |
55 |                                    y: *mut c_int,
   |                                            ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:56:47
   |
56 |                                    comp: *mut c_int,
   |                                               ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:57:46
   |
57 |                                    req_comp: c_int)
   |                                              ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_void` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:61:52
   |
61 |                                         user: *mut c_void,
   |                                                    ^^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
   |
25 |     use std::ffi::c_void;
   |
25 |     use std::os::raw::c_void;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:62:49
   |
62 |                                         x: *mut c_int,
   |                                                 ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:63:49
   |
63 |                                         y: *mut c_int,
   |                                                 ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:64:52
   |
64 |                                         comp: *mut c_int,
   |                                                    ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:65:51
   |
65 |                                         req_comp: c_int)
   |                                                   ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:69:44
   |
69 |                                       len: c_int,
   |                                            ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:70:47
   |
70 |                                       x: *mut c_int,
   |                                               ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:71:47
   |
71 |                                       y: *mut c_int,
   |                                               ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:72:50
   |
72 |                                       comp: *mut c_int,
   |                                                  ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:73:49
   |
73 |                                       req_comp: c_int)
   |                                                 ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_float` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:74:47
   |
74 |                                       -> *mut c_float;
   |                                               ^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_float;
   |

error: aborting due to previous error
For more information about this error, try `rustc --explain E0432`.
error[E0412]: cannot find type `c_char` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:76:44
   |
76 |         pub fn stbi_loadf(filename: *const c_char,
   |                                            ^^^^^^
help: a primitive type with a similar name exists
   |
76 |         pub fn stbi_loadf(filename: *const char,
   |                                            ^^^^
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_char;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:77:35
   |
77 |                           x: *mut c_int,
   |                                   ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:78:35
   |
78 |                           y: *mut c_int,
   |                                   ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:79:38
   |
79 |                           comp: *mut c_int,
   |                                      ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:80:37
   |
80 |                           req_comp: c_int)
   |                                     ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_float` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:81:35
   |
81 |                           -> *mut c_float;
   |                                   ^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_float;
   |

error[E0412]: cannot find type `FILE` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:83:45
   |
83 |         pub fn stbi_loadf_from_file(f: *mut FILE,
   |                                             ^^^^ not found in this scope
error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:84:45
   |
84 |                                     x: *mut c_int,
   |                                             ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:85:45
   |
85 |                                     y: *mut c_int,
   |                                             ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:86:48
   |
86 |                                     comp: *mut c_int,
   |                                                ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:87:47
   |
87 |                                     req_comp: c_int)
   |                                               ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error: Could not compile `walkdir`.
warning: build failed, waiting for other jobs to finish...
error[E0412]: cannot find type `c_float` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:88:45
   |
88 |                                     -> *mut c_float;
   |                                             ^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_float;
   |

error[E0412]: cannot find type `c_void` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:91:53
   |
91 |                                          user: *mut c_void,
   |                                                     ^^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
   |
25 |     use std::ffi::c_void;
   |
25 |     use std::os::raw::c_void;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:92:50
   |
92 |                                          x: *mut c_int,
   |                                                  ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:93:50
   |
93 |                                          y: *mut c_int,
   |                                                  ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:94:53
   |
94 |                                          comp: *mut c_int,
   |                                                     ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:95:52
   |
95 |                                          req_comp: c_int)
   |                                                    ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_float` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:96:50
   |
96 |                                          -> *mut c_float;
   |                                                  ^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_float;
   |

error[E0412]: cannot find type `c_float` in this scope
  --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:98:45
   |
98 |         pub fn stbi_hdr_to_ldr_gamma(gamma: c_float);
   |                                             ^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
25 |     use std::os::raw::c_float;
   |

error[E0412]: cannot find type `c_float` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:100:45
    |
100 |         pub fn stbi_hdr_to_ldr_scale(scale: c_float);
    |                                             ^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_float;
    |

error[E0412]: cannot find type `c_float` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:102:45
    |
102 |         pub fn stbi_ldr_to_hdr_gamma(gamma: c_float);
    |                                             ^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_float;
    |

error[E0412]: cannot find type `c_float` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:104:45
    |
104 |         pub fn stbi_ldr_to_hdr_scale(scale: c_float);
    |                                             ^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_float;
    |

error[E0412]: cannot find type `c_void` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:107:54
    |
107 |                                           user: *mut c_void)
    |                                                      ^^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
    |
25  |     use std::ffi::c_void;
    |
25  |     use std::os::raw::c_void;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:108:46
    |
108 |                                           -> c_int;
    |                                              ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:110:69
    |
110 |         pub fn stbi_is_hdr_from_memory(buffer: *const stbi_uc, len: c_int) -> c_int;
    |                                                                     ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:110:79
    |
110 |         pub fn stbi_is_hdr_from_memory(buffer: *const stbi_uc, len: c_int) -> c_int;
    |                                                                               ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_char` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:112:45
    |
112 |         pub fn stbi_is_hdr(filename: *const c_char) -> c_int;
    |                                             ^^^^^^
help: a primitive type with a similar name exists
    |
112 |         pub fn stbi_is_hdr(filename: *const char) -> c_int;
    |                                             ^^^^
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_char;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:112:56
    |
112 |         pub fn stbi_is_hdr(filename: *const c_char) -> c_int;
    |                                                        ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `FILE` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:114:46
    |
114 |         pub fn stbi_is_hdr_from_file(f: *mut FILE) -> c_int;
    |                                              ^^^^ not found in this scope
error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:114:55
    |
114 |         pub fn stbi_is_hdr_from_file(f: *mut FILE) -> c_int;
    |                                                       ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_char` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:116:48
    |
116 |         pub fn stbi_failure_reason() -> *const c_char;
    |                                                ^^^^^^
help: a primitive type with a similar name exists
    |
116 |         pub fn stbi_failure_reason() -> *const char;
    |                                                ^^^^
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_char;
    |

error[E0412]: cannot find type `c_void` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:118:60
    |
118 |         pub fn stbi_image_free(retval_from_stbi_load: *mut c_void);
    |                                                            ^^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
    |
25  |     use std::ffi::c_void;
    |
25  |     use std::os::raw::c_void;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:121:43
    |
121 |                                      len: c_int,
    |                                           ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:122:46
    |
122 |                                      x: *mut c_int,
    |                                              ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:123:46
    |
123 |                                      y: *mut c_int,
    |                                              ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:124:49
    |
124 |                                      comp: *mut c_int)
    |                                                 ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:125:41
    |
125 |                                      -> c_int;
    |                                         ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_void` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:128:52
    |
128 |                                         user: *mut c_void,
    |                                                    ^^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
    |
25  |     use std::ffi::c_void;
    |
25  |     use std::os::raw::c_void;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:129:49
    |
129 |                                         x: *mut c_int,
    |                                                 ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:130:49
    |
130 |                                         y: *mut c_int,
    |                                                 ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:131:52
    |
131 |                                         comp: *mut c_int)
    |                                                    ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:132:44
    |
132 |                                         -> c_int;
    |                                            ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_char` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:134:43
    |
134 |         pub fn stbi_info(filename: *const c_char,
    |                                           ^^^^^^
help: a primitive type with a similar name exists
    |
134 |         pub fn stbi_info(filename: *const char,
    |                                           ^^^^
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_char;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:135:34
    |
135 |                          x: *mut c_int,
    |                                  ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:136:34
    |
136 |                          y: *mut c_int,
    |                                  ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:137:37
    |
137 |                          comp: *mut c_int)
    |                                     ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:138:29
    |
138 |                          -> c_int;
    |                             ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `FILE` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:140:44
    |
140 |         pub fn stbi_info_from_file(f: *mut FILE,
    |                                            ^^^^ not found in this scope
error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:141:44
    |
141 |                                    x: *mut c_int,
    |                                            ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:142:44
    |
142 |                                    y: *mut c_int,
    |                                            ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:143:47
    |
143 |                                    comp: *mut c_int)
    |                                               ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:144:39
    |
144 |                                    -> c_int;
    |                                       ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:146:82
    |
146 |         pub fn stbi_set_unpremultiply_on_load(flag_true_if_should_unpremultiply: c_int);
    |                                                                                  ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:148:76
    |
148 |         pub fn stbi_convert_iphone_png_to_rgb(flag_true_if_should_convert: c_int);
    |                                                                            ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_char` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:150:65
    |
150 |         pub fn stbi_zlib_decode_malloc_guesssize(buffer: *const c_char,
    |                                                                 ^^^^^^
help: a primitive type with a similar name exists
    |
150 |         pub fn stbi_zlib_decode_malloc_guesssize(buffer: *const char,
    |                                                                 ^^^^
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_char;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:151:55
    |
151 |                                                  len: c_int,
    |                                                       ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:152:64
    |
152 |                                                  initial_size: c_int,
    |                                                                ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:153:63
    |
153 |                                                  outlen: *mut c_int)
    |                                                               ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_char` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:154:58
    |
154 |                                                  -> *mut c_char;
    |                                                          ^^^^^^
help: a primitive type with a similar name exists
    |
154 |                                                  -> *mut char;
    |                                                          ^^^^
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_char;
    |

error[E0412]: cannot find type `c_char` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:156:55
    |
156 |         pub fn stbi_zlib_decode_malloc(buffer: *const c_char,
    |                                                       ^^^^^^
help: a primitive type with a similar name exists
    |
156 |         pub fn stbi_zlib_decode_malloc(buffer: *const char,
    |                                                       ^^^^
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_char;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:157:45
    |
157 |                                        len: c_int,
    |                                             ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:158:53
    |
158 |                                        outlen: *mut c_int)
    |                                                     ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_char` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:159:48
    |
159 |                                        -> *mut c_char;
    |                                                ^^^^^^
help: a primitive type with a similar name exists
    |
159 |                                        -> *mut char;
    |                                                ^^^^
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_char;
    |

error[E0412]: cannot find type `c_char` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:161:56
    |
161 |         pub fn stbi_zlib_decode_buffer(obuffer: *const c_char,
    |                                                        ^^^^^^
help: a primitive type with a similar name exists
    |
161 |         pub fn stbi_zlib_decode_buffer(obuffer: *const char,
    |                                                        ^^^^
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_char;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:162:46
    |
162 |                                        olen: c_int,
    |                                              ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_char` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:163:56
    |
163 |                                        ibuffer: *const c_char,
    |                                                        ^^^^^^
help: a primitive type with a similar name exists
    |
163 |                                        ibuffer: *const char,
    |                                                        ^^^^
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_char;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:164:46
    |
164 |                                        ilen: c_int)
    |                                              ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:165:43
    |
165 |                                        -> c_int;
    |                                           ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_char` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:167:64
    |
167 |         pub fn stbi_zlib_decode_noheader_malloc(buffer: *const c_char,
    |                                                                ^^^^^^
help: a primitive type with a similar name exists
    |
167 |         pub fn stbi_zlib_decode_noheader_malloc(buffer: *const char,
    |                                                                ^^^^
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_char;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:168:54
    |
168 |                                                 len: c_int,
    |                                                      ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:169:62
    |
169 |                                                 outlen: *mut c_int)
    |                                                              ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_char` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:170:57
    |
170 |                                                 -> *mut c_char;
    |                                                         ^^^^^^
help: a primitive type with a similar name exists
    |
170 |                                                 -> *mut char;
    |                                                         ^^^^
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_char;
    |

error[E0412]: cannot find type `c_char` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:172:63
    |
172 |         pub fn stbi_zlib_decode_noheader_buffer(obuffer: *mut c_char,
    |                                                               ^^^^^^
help: a primitive type with a similar name exists
    |
172 |         pub fn stbi_zlib_decode_noheader_buffer(obuffer: *mut char,
    |                                                               ^^^^
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_char;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:173:55
    |
173 |                                                 olen: c_int,
    |                                                       ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_char` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:174:65
    |
174 |                                                 ibuffer: *const c_char,
    |                                                                 ^^^^^^
help: a primitive type with a similar name exists
    |
174 |                                                 ibuffer: *const char,
    |                                                                 ^^^^
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_char;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:175:55
    |
175 |                                                 ilen: c_int)
    |                                                       ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

error[E0412]: cannot find type `c_int` in this scope
   --> /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/stb_image-0.2.2/src/stb_image.rs:176:52
    |
176 |                                                 -> c_int;
    |                                                    ^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
    |
25  |     use std::os::raw::c_int;
    |

@jdm
Copy link
Member

jdm commented Apr 11, 2019

The answer here may be use remove the use of libc and use types from std::os::raw instead.

@jdm
Copy link
Member

jdm commented Apr 11, 2019

Although it may be necessary to hide the APIs that accept FILE arguments.

@tanis2000
Copy link
Author

@jdm I tried what you suggested and the current state of my tests is here:
https://github.com/tanis2000/rust-stb-image/tree/no-libc

It happens that it's still working fine on macOS (haven't tried other desktop OS yet) but if I include this crate in another project and build it with cargo web build I get an error during linking:

error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "wasm" "--no-threads" "-z" "stack-size=1048576" "--stack-first" "--allow-undefined" "--no-entry" "--export-table" "--fatal-warnings" "--export-dynamic" "--no-demangle" "-L" "/Users/tanis/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.1552888bf400l3vb.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.1a86z27dt4lzn0ab.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.1k9s2bfzxlhi2zoq.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.1y85qwr4wbdlws0d.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.2271eouzpwwr1mbo.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.22holi3za28xrzjh.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.29dkwx7x2s0upl75.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.2hebggoq03qbonvd.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.2ii1zcy8gt785z7e.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.2s73e3fl00each62.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.33oulgo7004bx9i0.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.36csiy6r15j9jmn2.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.3cgilsyycevn4we2.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.3vggcc5q7vgexacs.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.3xgfliafx15obf51.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.4aio88nckybg003d.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.4bxrzsygua02rbdn.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.4fwk4tgswjlgc55h.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.4r9n8erk35hybu05.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.54wx996rx71sx5o9.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.5516hcrbtlyq64fd.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.5ddc0r4zwpbis3iu.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.5exz1idydh1i78e5.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.8olvnts1nd7bzt8.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.v6fu6bl5ulfymeh.rcgu.o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.yaaqn9bokzzpdkb.rcgu.o" "-o" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.wasm" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/test_stb_image.2w619fg82u1aekgt.rcgu.o" "--gc-sections" "-O0" "-L" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps" "-L" "/Users/tanis/Documents/test-stb-image/target/debug/deps" "-L" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/build/stb_image-b36a7eba92a2b177/out" "-L" "/Users/tanis/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib" "/Users/tanis/Documents/test-stb-image/target/wasm32-unknown-unknown/debug/deps/libstb_image-63d5aa55b7ef9e8f.rlib" "/Users/tanis/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/libstd-3df4b302d72ef6ec.rlib" "/Users/tanis/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/libpanic_abort-9bf16624dd05c0fb.rlib" "/Users/tanis/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/libdlmalloc-a9b824235cb3bcc0.rlib" "/Users/tanis/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/libbacktrace_sys-f8521075e248b627.rlib" "/Users/tanis/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/libunwind-7c91ffdc8da860d3.rlib" "/Users/tanis/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/librustc_demangle-0ad27b9879d551d3.rlib" "/Users/tanis/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/liblibc-588f18eae3ea58be.rlib" "/Users/tanis/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/liballoc-4ebf5caee903d98f.rlib" "/Users/tanis/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/librustc_std_workspace_core-8895b32baedb08c6.rlib" "/Users/tanis/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/libcore-6a9d233d01acc350.rlib" "/Users/tanis/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/libcompiler_builtins-851bb3b5f6c4db49.rlib"
  = note: rust-lld: error: unknown file type: stb_image.o

@jdm
Copy link
Member

jdm commented Apr 12, 2019

@tanis2000 This crate uses a very old version of cc-rs to compile the C library, back when it used to be called gcc-rs. Try upgrading it to a modern version and updating build.rs and see if that makes a different.

@tanis2000
Copy link
Author

@jdm I upgraded the build.rs script to the latest cc-rs but it actually made things worse.
It works fine when building for the desktop but it's giving the following error when compiling with cargo web build from within the library folder itself:

error: failed to run custom build command for `stb_image v0.2.2 (/Users/tanis/Documents/rust-stb-image)`
process didn't exit successfully: `/Users/tanis/Documents/rust-stb-image/target/debug/build/stb_image-a85c27b930fed555/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("wasm32-unknown-unknown")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-apple-darwin")
CC_wasm32-unknown-unknown = None
CC_wasm32_unknown_unknown = None
TARGET_CC = None
CC = None
CFLAGS_wasm32-unknown-unknown = None
CFLAGS_wasm32_unknown_unknown = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
running: "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=wasm32-unknown-unknown" "-Wall" "-Wextra" "-o" "/Users/tanis/Documents/rust-stb-image/target/wasm32-unknown-unknown/debug/build/stb_image-f82d8dbbea50779c/out/src/stb_image.o" "-c" "src/stb_image.c"
cargo:warning=src/stb_image.c:390:10: fatal error: 'stdio.h' file not found
cargo:warning=#include <stdio.h>
cargo:warning=         ^~~~~~~~~
cargo:warning=1 error generated.
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=wasm32-unknown-unknown" "-Wall" "-Wextra" "-o" "/Users/tanis/Documents/rust-stb-image/target/wasm32-unknown-unknown/debug/build/stb_image-f82d8dbbea50779c/out/src/stb_image.o" "-c" "src/stb_image.c" with args "clang" did not execute successfully (status code exit code: 1).

', /Users/tanis/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.35/src/lib.rs:2398:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

@jdm
Copy link
Member

jdm commented Apr 12, 2019

Sorry, that exceeds my ability to make guesses about solutions at this point.

@tanis2000
Copy link
Author

My guess is that I need to tell clang where the wasm32 sysroot is, but I have no clue myself.

@tanis2000
Copy link
Author

I've opened a PR with my changes where I switched from libc to std::os::raw types. You can review it here: #95

It still doesn't compile for wasm32 and I haven't yet found a way around it, but at least we have a starting point.

@gmesika-coti
Copy link

was there a solution for this?
having same issue too

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

3 participants