https://linen.dev logo
Why does cargo-shuttle need JNI?
# help
s
Hi, I often do light development work on my phone, most stuff works fairly seamlessly. Unfortunately, cargo-shuttle installation fails while compiling one (so far) of the dependencies, namely, JNI. I understand that my use-case is quite niche and that the JNI crate is not Shuttle team's responsibility. Here, I mostly want to understand why JNI is needed for Shuttle at all, where is Java involved in the process? Here is the error, by the way:
Copy code
text
; AR=llvm-ar cargo install cargo-shuttle
--snip--
Compiling jni v0.19.0
error[E0425]: cannot find value `EXPECTED_JVM_FILENAME` in this scope
   --> /data/data/com.termux/files/home/.cargo/registry/src/github.com-1ecc6299db9ec823/jni-0.19.0/build.rs:102:25
    |
102 |         if file_name == EXPECTED_JVM_FILENAME {
s
We don't use Java at all so this is a bit weird. When I inspect our dependency tree with
cargo tree
I also can't find JNI... I'm wondering if some dependency is turning it on on the mobile device. Are you trying to develop on an Android phone? Using something like termux?
s
> Are you trying to develop on an Android phone? Using something like termux? Yes, exactly that 🙂
s
I'll have to set some time aside to get back to this 😄
Alternatively, can you clone the repo on your phone and post the output of
cargo tree
here?
s
Decided to dive in myself (I did not remember about
cargo tree
before your comment here). And I've found the culprit. The dependency path is
cargo-shuttle
→
webbrowser
→
jni
. The
jni
crate devs fixed the issue in their latest version and the latest version of
webbrowser
was also updated to use it. In fact, crashes on Termux are even mentioned in `webbrowser`'s release notes. Fortunately,
cargo-shuttle
has recently been switched to the latest version of
webbrowser
, so the issue is gone. Yay! 🎉
3 Views