-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
[Bug]: Can't run JNA with glibc #61
Comments
Your problem is that you are using ~ $ jdk-20.0.2/bin/java --class-path jna-5.13.0.jar JnaTest.java
/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
8
~ $ If you want to install pacman -Syu
pacman -S gpkg-dev patchelf
grun --shell
# https://jdk.java.net/20/
wget https://download.java.net/java/GA/jdk20.0.2/6e380f22cbe7469fa75fb448bd903d8e/9/GPL/openjdk-20.0.2_linux-aarch64_bin.tar.gz
tar xf openjdk-20.0.2_linux-aarch64_bin.tar.gz
for i in jdk-20.0.2/bin/*; do
grun --set $i
done
cp jdk-20.0.2/lib/libjli.so $GLIBC_PREFIX/lib
# done
jdk-20.0.2/bin/java --version |
Thanks a lot! I had suspicious about to use original java and patch that but I had no idea how to do that correctly.
I found libjvm.so in jdk/server/lib but couldn't find the rest of libs. I installed termux-x11 and libxext packages but it doesn't help. Could you please take a look? Maybe you will have some thoughts about that. |
This error occurs because glibc-based graphics libraries were not found, and bionic-based graphics libraries will not work in this case. There are currently no graphics libraries in the |
I used X libs from debian bookworm distro and was able to start xterminal, but only with root rights and selinux disabled, I was able to connect to XSDL app |
Thanks for replies! |
Problem description
Hi!
I was trying to run JetBrains IDEs (IDEA, Clion) and got following error (it's not my post but I have exactly the same issue):
https://youtrack.jetbrains.com/issue/IDEA-280178
java.lang.UnsatisfiedLinkError: /data/data/com.termux/files/home/.cache/JetBrains/IdeaIC2021.2/tmp/jna11597614846036822681.tmp: dlopen failed: library "libc.so.6" not found at java.base/jdk.internal.loader.NativeLibraries.load(Native Method) at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:384) at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:228) at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:170) at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389) at java.base/java.lang.Runtime.load0(Runtime.java:751) at java.base/java.lang.System.load(System.java:1912) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1019) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:989) at com.sun.jna.Native.<clinit>(Native.java:195) at com.intellij.jna.JnaLoader.load(JnaLoader.java:18) at com.intellij.idea.StartupUtil.loadSystemLibraries(StartupUtil.java:844) at com.intellij.idea.StartupUtil.lambda$start$8(StartupUtil.java:226) at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
For my case it doesn't prevent the IDE running but it brakes some functions - eg debugging in Rust.
I created a minimal project to reproduce that issue:
jna_issue.zip
To run that need to install openjdk-17 and run:
java --class-path jna-5.13.0.jar JnaTest.java
And I installed glibc from pacman (this instruction https://wiki.termux.com/wiki/Switching_package_manager to use pacman, and
pkg install glibc
to install glibc)So, what I understood:
jna11597614846036822681.tmp - it's lib from jna.jar file, looks like this one (jar is a zip archive, you can open it as zip):
jna-5.13.0.jar!\com\sun\jna\linux-aarch64\libjnidispatch.so
Or you can run to keep tmp file:
java --class-path jna-5.13.0.jar -Djnidispatch.preserve=true JnaTest.java
So, when I run that and check ldd I see reasonable reason of the error:
~ $ ldd .cache/JNA/temp/jna15778412403556095583.tmp
libc.so.6 => not found
But after running in proot env:
proot-distro login archlinux
I see the same error:
[root@localhost home]# java --class-path jna-5.13.0.jar -Djnidispatch.preserve=true JnaTest.java /data/data/com.termux/files/usr/java/packages/lib:/data/data/com.termux/files/usr/lib Exception in thread "main" java.lang.UnsatisfiedLinkError: /data/data/com.termux/files/home/.cache/JNA/temp/jna15872201178952457224.tmp: dlopen failed: library "libc.so.6" not found: needed by /data/data/com.termux/files/home/.cache/JNA/temp/jna15872201178952457224.tmp in namespace (default) at java.base/jdk.internal.loader.NativeLibraries.load(Native Method) at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:384) at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:228) at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:170) at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389) at java.base/java.lang.Runtime.load0(Runtime.java:751) at java.base/java.lang.System.load(System.java:1912) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1045) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:1015) at com.sun.jna.Native.<clinit>(Native.java:221) at Main.main(JnaTest.java:7)
However ldd shows the lib:
[root@localhost home]# ldd /data/data/com.termux/files/home/.cache/JNA/temp/jna15872201178952457224.tmp ldd: warning: you do not have execution permission for
/data/data/com.termux/files/home/.cache/JNA/temp/jna15872201178952457224.tmp'libc.so.6 => /usr/lib/libc.so.6 (0x0000007156210000)
/usr/lib/ld-linux-aarch64.so.1 (0x0000003000000000)
/usr/lib/ld-linux-aarch64.so.1 (0x0000003000000000)`
Could you pls take a look? Maybe you have any idea how to fix that. It would be good to have ability to run JetBrains IDEs in Termux - they have a lot of good IDEs, not only for Java.
System information
termux-info:
The text was updated successfully, but these errors were encountered: