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

java.lang.UnsatisfiedLinkError: Native library #117

Closed
nmanhong opened this issue Jan 20, 2022 · 10 comments
Closed

java.lang.UnsatisfiedLinkError: Native library #117

nmanhong opened this issue Jan 20, 2022 · 10 comments

Comments

@nmanhong
Copy link

The computer my school gave us is loongarch, but I am used to using clion, but using clion on loongarch cannot debug, which makes me very distressed, every time I debug, it will prompt "java.lang.UnsatisfiedLinkError: Native library (com /sun/jna/linux-loongarch64/libjnidispatch.so)" I searched the Internet and the problem is in pty4j, but I don't know how to do it, do you tell me, or you coud add loongarch support

@nmanhong
Copy link
Author

@segrey @t6

@nmanhong
Copy link
Author

@DmPanov @Traff

@segrey
Copy link
Collaborator

segrey commented Jan 20, 2022

@nmanhong Please reproduce the problem in CLion and share your idea.log (Help | Show Log in ...). Looks like JNA doesn't support Loongarch yet.

@nmanhong
Copy link
Author

@segrey
Every time I debug, it will prompt the following error, but loongarch supports jna, but the architecture is different, and it cannot support the jna brought by clion, it seems like this, I don't understand it very well

/usr/bin/g++ Test.cpp -o Test
java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native

@segrey
Copy link
Collaborator

segrey commented Jan 21, 2022

@nmanhong Maybe JNA version bundled with CLion doesn't support Loongarch, or maybe some other problem causes Could not initialize class com.sun.jna.Native. If you restart IDE, reproduce the problem and attach idea.log, it will be possible to find the cause. As I can see, recently a PR to JNA has been opened that adds support for Loongarch (java-native-access/jna#1406).

@nmanhong
Copy link
Author

@segrey
I found that file, but the content in it is too long, I don't know how to find the cause of the error, can you help me?

@segrey
Copy link
Collaborator

segrey commented Jan 25, 2022

@nmanhong You can shutdown IDE, delete your idea.log. Then, start IDE and reproduce the issue. Now idea.log will have a smaller size, so it can be attached here.

@nmanhong
Copy link
Author

@segrey
I tried to do this, but there are still a lot, and I can't understand it, can you help me to find out the problem?
https://github.com/nmanhong/idea_log/blob/main/idea.log

@nmanhong
Copy link
Author

@segrey
Copy link
Collaborator

segrey commented Jan 26, 2022

@nmanhong Thanks for the log. Unfortunately, it says that JNA doesn't support your OS. You can find a list of pre-built platforms here.

2022-01-25 20:59:58,214 [    799]   WARN -        #com.intellij.idea.Main - Unable to load JNA library (OS: Linux 4.19.0-13-loongson-3) 
java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/linux-loongarch64/libjnidispatch.so) not found in resource path (/home/nmh/downloads/clion-2021.3.2/lib/util.jar:/home/nmh/downloads/clion-2021.3.2/lib/bootstrap.jar)
	at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1033)
	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:836)
	at com.intellij.idea.StartupUtil.lambda$start$8(StartupUtil.java:229)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

Looks like there are two ways: build JNA for your platform by yourself (according to https://github.com/java-native-access/jna#supported-platforms) or wait until JNA supports LoongArch.

@segrey segrey closed this as completed Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants