bytecodealliance / wamr-rust-sdk

Apache License 2.0
35 stars 10 forks source link

Expected `u8`, found `i8` when compiling for aarch64-unknown-linux-gnu #14

Closed Zelzahn closed 8 months ago

Zelzahn commented 8 months ago

When I try to compile for the aarch64-unknown-linux-gnu architecture, I get the following warnings:

error[E0308]: mismatched types
    --> /home/zelzahn/.cargo/git/checkouts/wamr-rust-sdk-a60624a35074c840/9d6f2bb/src/module.rs:57:17
     |
54   |             wasm_runtime_load(
     |             ----------------- arguments to this function are incorrect
...
57   |                 error_buf.as_mut_ptr(),
     |                 ^^^^^^^^^^^^^^^^^^^^^^ expected `*mut u8`, found `*mut i8`
     |
     = note: expected raw pointer `*mut u8`
                found raw pointer `*mut i8`
note: function defined here
    --> /home/zelzahn/wamr/target/debug/build/wamr-sys-6076dfabf472a1d1/out/bindings.rs:1133:12
     |
1133 |     pub fn wasm_runtime_load(
     |            ^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /home/zelzahn/.cargo/git/checkouts/wamr-rust-sdk-a60624a35074c840/9d6f2bb/src/module.rs:71:25
   |
70 |                     return Err(RuntimeError::CompilationError(error_buf_to_string(
   |                                                               ------------------- arguments to this function are incorrect
71 |                         &error_buf,
   |                         ^^^^^^^^^^ expected `&[u8; 128]`, found `&[i8; 128]`
   |
   = note: expected reference `&[u8; 128]`
              found reference `&[i8; 128]`
note: function defined here
  --> /home/zelzahn/.cargo/git/checkouts/wamr-rust-sdk-a60624a35074c840/9d6f2bb/src/helper.rs:12:8
   |
12 | pub fn error_buf_to_string(&error_buf: &[c_char; DEFAULT_ERROR_BUF_SIZE]) -> String {
   |        ^^^^^^^^^^^^^^^^^^^ ---------------------------------------------

error[E0308]: arguments to this function are incorrect
    --> /home/zelzahn/.cargo/git/checkouts/wamr-rust-sdk-a60624a35074c840/9d6f2bb/src/module.rs:115:13
     |
115  |             wasm_runtime_set_wasi_args(
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
note: expected `*mut *const u8`, found `*mut *const i8`
    --> /home/zelzahn/.cargo/git/checkouts/wamr-rust-sdk-a60624a35074c840/9d6f2bb/src/module.rs:117:17
     |
117  |                 real_paths,
     |                 ^^^^^^^^^^
     = note: expected raw pointer `*mut *const u8`
                found raw pointer `*mut *const i8`
note: expected `*mut *const u8`, found `*mut *const i8`
    --> /home/zelzahn/.cargo/git/checkouts/wamr-rust-sdk-a60624a35074c840/9d6f2bb/src/module.rs:119:17
     |
119  |                 mapped_paths,
     |                 ^^^^^^^^^^^^
     = note: expected raw pointer `*mut *const u8`
                found raw pointer `*mut *const i8`
note: expected `*mut *const u8`, found `*mut *const i8`
    --> /home/zelzahn/.cargo/git/checkouts/wamr-rust-sdk-a60624a35074c840/9d6f2bb/src/module.rs:121:17
     |
121  |                 env,
     |                 ^^^
     = note: expected raw pointer `*mut *const u8`
                found raw pointer `*mut *const i8`
note: expected `*mut *mut u8`, found `*mut *mut i8`
    --> /home/zelzahn/.cargo/git/checkouts/wamr-rust-sdk-a60624a35074c840/9d6f2bb/src/module.rs:123:17
     |
123  |                 args,
     |                 ^^^^
     = note: expected raw pointer `*mut *mut u8`
                found raw pointer `*mut *mut i8`
note: function defined here
    --> /home/zelzahn/wamr/target/debug/build/wamr-sys-6076dfabf472a1d1/out/bindings.rs:1176:12
     |
1176 |     pub fn wasm_runtime_set_wasi_args(
     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/zelzahn/.cargo/git/checkouts/wamr-rust-sdk-a60624a35074c840/9d6f2bb/src/module.rs:135:17
     |
133  |             wasm_runtime_set_wasi_ns_lookup_pool(
     |             ------------------------------------ arguments to this function are incorrect
134  |                 self.get_inner_module(),
135  |                 ns_lookup_pool,
     |                 ^^^^^^^^^^^^^^ expected `*mut *const u8`, found `*mut *const i8`
     |
     = note: expected raw pointer `*mut *const u8`
                found raw pointer `*mut *const i8`
note: function defined here
    --> /home/zelzahn/wamr/target/debug/build/wamr-sys-6076dfabf472a1d1/out/bindings.rs:1196:12
     |
1196 |     pub fn wasm_runtime_set_wasi_ns_lookup_pool(
     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/zelzahn/.cargo/git/checkouts/wamr-rust-sdk-a60624a35074c840/9d6f2bb/src/module.rs:146:17
     |
144  |             wasm_runtime_set_wasi_addr_pool(
     |             ------------------------------- arguments to this function are incorrect
145  |                 self.get_inner_module(),
146  |                 addr_pool,
     |                 ^^^^^^^^^ expected `*mut *const u8`, found `*mut *const i8`
     |
     = note: expected raw pointer `*mut *const u8`
                found raw pointer `*mut *const i8`
note: function defined here
    --> /home/zelzahn/wamr/target/debug/build/wamr-sys-6076dfabf472a1d1/out/bindings.rs:1189:12
     |
1189 |     pub fn wasm_runtime_set_wasi_addr_pool(
     |   

This error doesn't appear when I compile for my Linux machine.

Edit: My code can be found here.

lum1n0us commented 8 months ago

thanks for reporting. please try #15

Zelzahn commented 8 months ago

Hey, thanks for the swift reply! #15 fixed it.