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

Errors when targeting webassembly #1951

Open
mihai-dinculescu opened this issue Feb 11, 2021 · 4 comments
Open

Errors when targeting webassembly #1951

mihai-dinculescu opened this issue Feb 11, 2021 · 4 comments

Comments

@mihai-dinculescu
Copy link

I get the following errors when targeting wasm32-unknown-unknown.

Am I doing something wrong or is wasm not supported, yet?

$ cargo build --lib --target wasm32-unknown-unknown
   Compiling secp256k1-sys v0.4.0
   Compiling js-sys v0.3.47
   Compiling exonum_libsodium-sys v0.0.23
error[E0432]: unresolved imports `libc::c_char`, `libc::c_int`, `libc::c_ulonglong`, `libc::c_void`, `libc::size_t` --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\lib.rs:3:12        
  |
3 | use libc::{c_char, c_int, c_ulonglong, c_void, size_t};
  |            ^^^^^^  ^^^^^  ^^^^^^^^^^^  ^^^^^^  ^^^^^^ no `size_t` in the root
  |            |       |      |            |
  |            |       |      |            no `c_void` in the root
  |            |       |      no `c_ulonglong` in the root
  |            |       no `c_int` in the root
  |            no `c_char` in the root

error[E0412]: cannot find type `c_uchar` in crate `libc`
 --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:8:44
  |
8 |     pub fn crypto_kdf_keygen(k: *mut libc::c_uchar);
  |                                            ^^^^^^^ not found in `libc`
  |
help: consider importing this type alias
  |
3 | use std::os::raw::c_uchar;
  |

error[E0412]: cannot find type `c_char` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:23:50
   |
23 |     pub fn crypto_kx_primitive() -> *const libc::c_char;
   |                                                  ^^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_char;
   |

error[E0412]: cannot find type `c_uchar` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:27:24
   |
27 |         pk: *mut libc::c_uchar,
   |                        ^^^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_uchar;
   |

error[E0412]: cannot find type `c_uchar` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:28:24
   |
28 |         sk: *mut libc::c_uchar,
   |                        ^^^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_uchar;
   |

error[E0412]: cannot find type `c_uchar` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:29:28
   |
29 |         seed: *const libc::c_uchar,
   |                            ^^^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_uchar;
   |

error[E0412]: cannot find type `c_int` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:30:16
   |
30 |     ) -> libc::c_int;
   |                ^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_uchar` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:33:45
   |
33 |     pub fn crypto_kx_keypair(pk: *mut libc::c_uchar, sk: *mut libc::c_uchar) -> libc::c_int;
   |                                             ^^^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_uchar;
   |

error[E0412]: cannot find type `c_uchar` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:33:69
   |
33 |     pub fn crypto_kx_keypair(pk: *mut libc::c_uchar, sk: *mut libc::c_uchar) -> libc::c_int;
   |                                                                     ^^^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_uchar;
   |

error[E0412]: cannot find type `c_int` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:33:87
   |
33 |     pub fn crypto_kx_keypair(pk: *mut libc::c_uchar, sk: *mut libc::c_uchar) -> libc::c_int;
   |                                                                                       ^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_uchar` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:37:24
   |
37 |         rx: *mut libc::c_uchar,
   |                        ^^^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_uchar;
   |

error[E0412]: cannot find type `c_uchar` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:38:24
   |
38 |         tx: *mut libc::c_uchar,
   |                        ^^^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_uchar;
   |

error[E0412]: cannot find type `c_uchar` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:39:33
   |
39 |         client_pk: *const libc::c_uchar,
   |                                 ^^^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_uchar;
   |

error[E0412]: cannot find type `c_uchar` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:40:33
   |
40 |         client_sk: *const libc::c_uchar,
   |                                 ^^^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_uchar;
   |

error[E0412]: cannot find type `c_uchar` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:41:33
   |
41 |         server_pk: *const libc::c_uchar,
   |                                 ^^^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_uchar;
   |

error[E0412]: cannot find type `c_int` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:42:16
   |
42 |     ) -> libc::c_int;
   |                ^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_uchar` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:46:24
   |
46 |         rx: *mut libc::c_uchar,
   |                        ^^^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_uchar;
   |

error[E0412]: cannot find type `c_uchar` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:47:24
   |
47 |         tx: *mut libc::c_uchar,
   |                        ^^^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_uchar;
   |

error[E0412]: cannot find type `c_uchar` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:48:33
   |
48 |         server_pk: *const libc::c_uchar,
   |                                 ^^^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_uchar;
   |

error[E0412]: cannot find type `c_uchar` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:49:33
   |
49 |         server_sk: *const libc::c_uchar,
   |                                 ^^^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_uchar;
   |

error[E0412]: cannot find type `c_uchar` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:50:33
   |
50 |         client_pk: *const libc::c_uchar,
   |                                 ^^^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_uchar;
   |

error[E0412]: cannot find type `c_int` in crate `libc`
  --> C:\Users\mihai\.cargo\registry\src\github.com-1ecc6299db9ec823\exonum_libsodium-sys-0.0.23\src/crypto_kx.rs:51:16
   |
51 |     ) -> libc::c_int;
   |                ^^^^^ not found in `libc`
   |
help: consider importing this type alias
   |
3  | use std::os::raw::c_int;
   |

error: aborting due to 22 previous errors

Some errors have detailed explanations: E0412, E0432.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `exonum_libsodium-sys`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
The following warnings were emitted during compilation:

warning: In file included from depend/secp256k1/src/secp256k1.c:10:
warning: In file included from depend/secp256k1/src/assumptions.h:12:
warning: In file included from depend/secp256k1/src/util.h:16:
warning: wasm-sysroot\stdio.h:4:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_INT_SIZE = sizeof(int);
warning:                            ^
warning: wasm-sysroot\stdio.h:5:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_INT_ALIGN = alignof(int);
warning:                            ^
warning: wasm-sysroot\stdio.h:7:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_UNSIGNED_INT_SIZE = sizeof(unsigned int);
warning:                            ^
warning: wasm-sysroot\stdio.h:8:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_UNSIGNED_INT_ALIGN = alignof(unsigned int);
warning:                            ^
warning: wasm-sysroot\stdio.h:10:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_SIZE_T_SIZE = sizeof(size_t);
warning:                            ^
warning: wasm-sysroot\stdio.h:11:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_SIZE_T_ALIGN = alignof(size_t);
warning:                            ^
warning: wasm-sysroot\stdio.h:13:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_UNSIGNED_CHAR_SIZE = sizeof(unsigned char);
warning:                            ^
warning: wasm-sysroot\stdio.h:14:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_UNSIGNED_CHAR_ALIGN = alignof(unsigned char);
warning:                            ^
warning: wasm-sysroot\stdio.h:16:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_PTR_SIZE = sizeof(void*);
warning:                            ^
warning: wasm-sysroot\stdio.h:17:28: warning: 'extern' variable has an initializer [-Wextern-initializer]
warning: extern const unsigned char WASM32_PTR_ALIGN = alignof(void*);
warning:                            ^
warning: In file included from depend/secp256k1/src/secp256k1.c:13:
warning: depend/secp256k1/src/field_impl.h:266:13: warning: unused function 'rustsecp256k1_v0_4_0_fe_inv_all_var' [-Wunused-function]
warning: static void rustsecp256k1_v0_4_0_fe_inv_all_var(rustsecp256k1_v0_4_0_fe *r, const rustsecp256k1_v0_4_0_fe 
*a, size_t len) {
warning:             ^
warning: In file included from depend/secp256k1/src/secp256k1.c:15:
warning: depend/secp256k1/src/group_impl.h:191:13: warning: unused function 'rustsecp256k1_v0_4_0_ge_set_infinity' 
[-Wunused-function]
warning: static void rustsecp256k1_v0_4_0_ge_set_infinity(rustsecp256k1_v0_4_0_ge *r) {
warning:             ^
warning: depend/secp256k1/src/group_impl.h:658:12: warning: unused function 'rustsecp256k1_v0_4_0_gej_has_quad_y_var' [-Wunused-function]
warning: static int rustsecp256k1_v0_4_0_gej_has_quad_y_var(const rustsecp256k1_v0_4_0_gej *a) {
warning:            ^
warning: In file included from depend/secp256k1/src/secp256k1.c:16:
warning: In file included from depend/secp256k1/src/ecmult_impl.h:16:
warning: In file included from depend/secp256k1/src/ecmult.h:13:
warning: depend/secp256k1/src/scratch.h:24:38: warning: unused function 'rustsecp256k1_v0_4_0_scratch_create' [-Wunused-function]
warning: static rustsecp256k1_v0_4_0_scratch* rustsecp256k1_v0_4_0_scratch_create(const rustsecp256k1_v0_4_0_callback* error_callback, size_t max_size);
warning:                                      ^
warning: depend/secp256k1/src/scratch.h:26:13: warning: unused function 'rustsecp256k1_v0_4_0_scratch_destroy' [-Wunused-function]
warning: static void rustsecp256k1_v0_4_0_scratch_destroy(const rustsecp256k1_v0_4_0_callback* error_callback, rustsecp256k1_v0_4_0_scratch* scratch);
warning:             ^
warning: In file included from depend/secp256k1/src/secp256k1.c:16:
warning: depend/secp256k1/src/ecmult_impl.h:1035:12: warning: unused function 'rustsecp256k1_v0_4_0_ecmult_multi_var' [-Wunused-function]
warning: static int rustsecp256k1_v0_4_0_ecmult_multi_var(const rustsecp256k1_v0_4_0_callback* error_callback, const rustsecp256k1_v0_4_0_ecmult_context *ctx, rustsecp256k1_v0_4_0_scratch *scratch, rustsecp256k1_v0_4_0_gej *r, const rustsecp256k1_v0_4_0_scalar *inp_g_sc, rustsecp256k1_v0_4_0_ecmult_multi_callback cb, void *cbdata, size_t n) { 
warning:            ^
warning: depend/secp256k1/src/ecmult_impl.h:621:12: warning: unused function 'rustsecp256k1_v0_4_0_ecmult_strauss_batch_single' [-Wunused-function]
warning: static int rustsecp256k1_v0_4_0_ecmult_strauss_batch_single(const rustsecp256k1_v0_4_0_callback* error_callback, const rustsecp256k1_v0_4_0_ecmult_context *actx, rustsecp256k1_v0_4_0_scratch *scratch, rustsecp256k1_v0_4_0_gej *r, const rustsecp256k1_v0_4_0_scalar *inp_g_sc, rustsecp256k1_v0_4_0_ecmult_multi_callback cb, void *cbdata, 
size_t n) {
warning:            ^
warning: depend/secp256k1/src/ecmult_impl.h:863:15: warning: unused function 'rustsecp256k1_v0_4_0_pippenger_scratch_size' [-Wunused-function]
warning: static size_t rustsecp256k1_v0_4_0_pippenger_scratch_size(size_t n_points, int bucket_window) {
warning:               ^
warning: depend/secp256k1/src/ecmult_impl.h:944:12: warning: unused function 'rustsecp256k1_v0_4_0_ecmult_pippenger_batch_single' [-Wunused-function]
warning: static int rustsecp256k1_v0_4_0_ecmult_pippenger_batch_single(const rustsecp256k1_v0_4_0_callback* error_callback, const rustsecp256k1_v0_4_0_ecmult_context *actx, rustsecp256k1_v0_4_0_scratch *scratch, rustsecp256k1_v0_4_0_gej *r, const rustsecp256k1_v0_4_0_scalar *inp_g_sc, rustsecp256k1_v0_4_0_ecmult_multi_callback cb, void *cbdata, size_t n) {
warning:            ^
warning: 19 warnings generated.

error: build failed
@aleksuss
Copy link
Contributor

Actually, wasm isn't supported 🙂

@mihai-dinculescu
Copy link
Author

Are there any plans to support it?

@aleksuss
Copy link
Contributor

Not yet.

@okpatil4u
Copy link

Has there been any change in this strategy ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants