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: Could not find jniopenblas_nolapack in class, module, and library paths #2203

Open
heshanthenura opened this issue Mar 10, 2024 · 15 comments

Comments

@heshanthenura
Copy link

heshanthenura commented Mar 10, 2024

anyone know how to fix this error?

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniopenblas_nolapack in java.library.path: E:\Coding\Java\JAVASDKs\JDK21\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;E:\Coding\Java\JAVASDKs\JDK21\bin;C:\Gradle\gradle-8.5\bin;E:\Programs\Git\cmd;E:\Windows Kits\10\Windows Performance Toolkit\;C:\Users\hesha\AppData\Local\Microsoft\WindowsApps;E:\Programs\VSCode\bin;C:\Users\hesha\AppData\Local\GitHubDesktop\bin;E:\Programs\IntelliJ IDEA 2023.3\bin;;E:\Programs\apache-maven-3.9.6\bin;E:\Programs\depot_tools;;E:\Programs\IntelliJ Com\IntelliJ IDEA Community Edition 2023.3.4\bin;;E:\Programs\nim-2.0.2_x64\nim-2.0.2\bin;C:\Users\hesha\.nimble\bin;.
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2458)
	at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:916)
	at java.base/java.lang.System.loadLibrary(System.java:2059)
	at org.bytedeco.javacpp/org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1832)
	at org.bytedeco.javacpp/org.bytedeco.javacpp.Loader.load(Loader.java:1423)
	at org.bytedeco.javacpp/org.bytedeco.javacpp.Loader.load(Loader.java:1234)
	at org.bytedeco.javacpp/org.bytedeco.javacpp.Loader.load(Loader.java:1210)
	at org.bytedeco.openblas/org.bytedeco.openblas.global.openblas_nolapack.<clinit>(openblas_nolapack.java:12)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:534)
	at java.base/java.lang.Class.forName(Class.java:513)
	at org.bytedeco.javacpp/org.bytedeco.javacpp.Loader.load(Loader.java:1289)
	at org.bytedeco.javacpp/org.bytedeco.javacpp.Loader.load(Loader.java:1234)
	at org.bytedeco.javacpp/org.bytedeco.javacpp.Loader.load(Loader.java:1210)
	at org.bytedeco.opencv/org.bytedeco.opencv.global.opencv_imgcodecs.<clinit>(opencv_imgcodecs.java:18)
	at com.heshanthenura.javafxcv@1.0-SNAPSHOT/com.heshanthenura.javafxcv.JavaFXCV.main(JavaFXCV.java:13)
Caused by: java.lang.UnsatisfiedLinkError: Could not find jniopenblas_nolapack in class, module, and library paths.
	at org.bytedeco.javacpp/org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1799)
	... 12 more

FAILURE: Build failed with an exception.
@saudet
Copy link
Member

saudet commented Mar 10, 2024

Please try again with version 1.5.10

@heshanthenura
Copy link
Author

Ill try and tell you.

@saudet
Copy link
Member

saudet commented Mar 16, 2024

@heshanthenura
Copy link
Author

Thank you, I'll try.

@codespearhead
Copy link

Did it work? If so, can you close this issue?

@steeveen
Copy link
Contributor

I met the same problem and searching for help……

@codespearhead
Copy link

Can you provide us with an MRE?

@steeveen
Copy link
Contributor

Just Call ‘Loader.load(opencv_java.class)’ under RHEL-7, Java 8 ,SpringBoot 2.7.2

@steeveen
Copy link
Contributor

with the dependency of javacv-platform 1.5.10, opencv-platform 1.5.10 , openblas-platform 1.5.10

@codespearhead
Copy link

codespearhead commented Mar 25, 2024

It's worth noting that Spring Boot 2.7 no longer has OSS support.

I just tried it with my current setup and everything worked as expected (Spring Boot 3.2.4, OpenJDK Temurin-17.0.10+7).

  1. Create a Spring Boot project:
mkdir mre &&
cd mre &&
curl https://start.spring.io/starter.tgz -d dependencies=web,devtools -d type=maven-project | tar -xzvf -
  1. Add JavaCV to it:
<dependency>
    <groupId>org.bytedeco</groupId>
    <artifactId>javacv-platform</artifactId>
    <version>1.5.10</version>
</dependency>
  1. Create an endpoint that invokes Loader.load(opencv_java.class):
package com.example.demo;

import org.bytedeco.javacpp.Loader;
import org.bytedeco.opencv.opencv_java;
import org.bytedeco.opencv.global.opencv_core;
import org.bytedeco.opencv.opencv_core.Mat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Demo {

    @GetMapping
    public String doGet(){
        Loader.load(opencv_java.class);
        Mat mat = Mat.eye(3, 3, opencv_core.CV_8UC1).asMat();
        return "mat = " + mat.toString() + "\n";
    }

}
  1. Call the endpoint:
curl localhost:8080
# mat = org.bytedeco.opencv.opencv_core.Mat[width=3,height=3,depth=8,channels=1]

@steeveen
Copy link
Contributor

Did you do your test on red hat OS? My code can run well on windows10 but meet problem just on redhat7.

@codespearhead
Copy link

codespearhead commented Mar 26, 2024

I am not in a position to directly experiment with the suggested setup at this time.

For anyone who is though, try creating a Dockerfile in the root directory of the MRE with the following content:

FROM registry.access.redhat.com/ubi8/openjdk-17:1.19-1

WORKDIR /app
COPY . .

RUN mvn clean package -DskipTests
EXPOSE 8080

CMD ["java", "-jar", "target/app-0.0.1-SNAPSHOT.jar"]

Then run:

docker build -t demo:tag . &&
docker run --rm -it demo:tag

@steeveen
Copy link
Contributor

I have a further problem. I found that problem is caused by that there is no CXXABI 1.3.8 in my environment. Does anyone have any idea on this?

@codespearhead
Copy link

I haven't used this library long enough to be able to troubleshoot problems, but I noticed it works out of the box in WSL (Ubuntu), but not in Git Bash (Windows), so I have a feeling strange errors might occur if you don't have GCC globally available in your environment when installing the dependencies. I haven't tested that theory though.

@steeveen
Copy link
Contributor

I got the libstdc.6.0.28.so, which can support CXXABI_1_3_8. I would have a try to replace libstdc.6.0.19.so with this file. I hope it can work.

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

No branches or pull requests

4 participants