Skip to content

Not wasm compatible #53

Closed
Closed
@ziyak97

Description

@ziyak97

When trying to build for wasm i get the following errors

(base) ziyak@PP-C5GQTT2HQK rust-exp % wasm-pack build                         
[INFO]: 🎯  Checking for the Wasm target...
[INFO]: 🌀  Compiling to Wasm...
   Compiling j4rs v0.15.3
error[E0432]: unresolved import `libc::c_char`
  --> /Users/ziyak/.cargo/registry/src/github.com-1ecc6299db9ec823/j4rs-0.15.3/src/api/mod.rs:47:5
   |
47 | use libc::c_char;
   |     ^^^^^^^^^^^^ no `c_char` in the root
   |
help: consider importing one of these items instead
   |
47 | use core::ffi::c_char;
   |     ~~~~~~~~~~~~~~~~~~
47 | use std::ffi::c_char;
   |     ~~~~~~~~~~~~~~~~~
47 | use std::os::raw::c_char;
   |     ~~~~~~~~~~~~~~~~~~~~~

error[E0432]: unresolved import `libc::c_char`
  --> /Users/ziyak/.cargo/registry/src/github.com-1ecc6299db9ec823/j4rs-0.15.3/src/utils.rs:22:18
   |
22 | use libc::{self, c_char};
   |                  ^^^^^^ no `c_char` in the root
   |
help: consider importing one of these items instead
   |
22 | use libc::{self, core::ffi::c_char;
   |                  ~~~~~~~~~~~~~~~~~~
22 | use libc::{self, crate::utils::std::ffi::c_char;
   |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 | use libc::{self, crate::utils::std::os::raw::c_char;
   |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 | use libc::{self, std::ffi::c_char;
   |                  ~~~~~~~~~~~~~~~~~
     and 1 other candidate

error[E0432]: unresolved import `libc::c_char`
  --> /Users/ziyak/.cargo/registry/src/github.com-1ecc6299db9ec823/j4rs-0.15.3/src/cache.rs:20:5
   |
20 | use libc::c_char;
   |     ^^^^^^^^^^^^ no `c_char` in the root
   |
help: consider importing one of these items instead
   |
20 | use core::ffi::c_char;
   |     ~~~~~~~~~~~~~~~~~~
20 | use std::ffi::c_char;
   |     ~~~~~~~~~~~~~~~~~
20 | use std::os::raw::c_char;
   |     ~~~~~~~~~~~~~~~~~~~~~

error[E0433]: failed to resolve: could not find `Library` in `libloading`
  --> /Users/ziyak/.cargo/registry/src/github.com-1ecc6299db9ec823/j4rs-0.15.3/src/api_tweaks/generic.rs:46:25
   |
46 |             libloading::Library::new(full_path).expect("Could not load the jvm dynamic library")
   |                         ^^^^^^^ could not find `Library` in `libloading`

error[E0412]: cannot find type `Library` in crate `libloading`
  --> /Users/ziyak/.cargo/registry/src/github.com-1ecc6299db9ec823/j4rs-0.15.3/src/api_tweaks/generic.rs:39:37
   |
39 |     static ref JVM_LIB: libloading::Library = {
   |                                     ^^^^^^^ not found in `libloading`

error[E0412]: cannot find type `Symbol` in crate `libloading`
  --> /Users/ziyak/.cargo/registry/src/github.com-1ecc6299db9ec823/j4rs-0.15.3/src/api_tweaks/generic.rs:50:46
   |
50 |     static ref GET_CREATED_JVMS: libloading::Symbol<'static, JNIGetCreatedJavaVMs> = unsafe {
   |                                              ^^^^^^ not found in `libloading`

error[E0412]: cannot find type `Symbol` in crate `libloading`
  --> /Users/ziyak/.cargo/registry/src/github.com-1ecc6299db9ec823/j4rs-0.15.3/src/api_tweaks/generic.rs:54:40
   |
54 |     static ref CREATE_JVM: libloading::Symbol<'static, JNICreateJavaVM> = unsafe {
   |                                        ^^^^^^ not found in `libloading`

error[E0599]: no method named `get` found for struct `JVM_LIB` in the current scope
  --> /Users/ziyak/.cargo/registry/src/github.com-1ecc6299db9ec823/j4rs-0.15.3/src/api_tweaks/generic.rs:51:17
   |
38 | / lazy_static! {
39 | |     static ref JVM_LIB: libloading::Library = {
40 | |         let full_path = format!("{}{}{}",
41 | |             locate_jvm_dyn_library().expect("Could find the jvm dynamic library"),
...  |
51 | |         JVM_LIB.get(b"JNI_GetCreatedJavaVMs").expect("Could not find symbol: JNI_GetCreatedJavaVMs")
   | |                 ^^^ method not found in `JVM_LIB`
...  |
56 | |     };
57 | | }
   | |_- method `get` not found for this struct
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following trait defines an item `get`, perhaps you need to implement it:
           candidate #1: `SliceIndex`

error[E0599]: no method named `get` found for struct `JVM_LIB` in the current scope
  --> /Users/ziyak/.cargo/registry/src/github.com-1ecc6299db9ec823/j4rs-0.15.3/src/api_tweaks/generic.rs:55:17
   |
38 | / lazy_static! {
39 | |     static ref JVM_LIB: libloading::Library = {
40 | |         let full_path = format!("{}{}{}",
41 | |             locate_jvm_dyn_library().expect("Could find the jvm dynamic library"),
...  |
55 | |         JVM_LIB.get(b"JNI_CreateJavaVM").expect("Could not find symbol: JNI_CreateJavaVM")
   | |                 ^^^ method not found in `JVM_LIB`
56 | |     };
57 | | }
   | |_- method `get` not found for this struct
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following trait defines an item `get`, perhaps you need to implement it:
           candidate #1: `SliceIndex`

error[E0618]: expected function, found `GET_CREATED_JVMS`
  --> /Users/ziyak/.cargo/registry/src/github.com-1ecc6299db9ec823/j4rs-0.15.3/src/api_tweaks/generic.rs:61:9
   |
38 | / lazy_static! {
39 | |     static ref JVM_LIB: libloading::Library = {
40 | |         let full_path = format!("{}{}{}",
41 | |             locate_jvm_dyn_library().expect("Could find the jvm dynamic library"),
...  |
56 | |     };
57 | | }
   | |_- `GET_CREATED_JVMS` defined here
...
61 |           GET_CREATED_JVMS(vm_buf.as_mut_ptr(), buf_len, n_vms)
   |           ^^^^^^^^^^^^^^^^-------------------------------------
   |           |
   |           call expression requires function

error[E0618]: expected function, found `CREATE_JVM`
  --> /Users/ziyak/.cargo/registry/src/github.com-1ecc6299db9ec823/j4rs-0.15.3/src/api_tweaks/generic.rs:71:9
   |
38 | / lazy_static! {
39 | |     static ref JVM_LIB: libloading::Library = {
40 | |         let full_path = format!("{}{}{}",
41 | |             locate_jvm_dyn_library().expect("Could find the jvm dynamic library"),
...  |
56 | |     };
57 | | }
   | |_- `CREATE_JVM` defined here
...
71 |           CREATE_JVM(jvm, penv, args)
   |           ^^^^^^^^^^-----------------
   |           |
   |           call expression requires function

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions