Open mengpengfei opened 1 year ago
From the above picture, it can be seen that the jar package already contains the so file.
Except for the file libopencv_world.so.3.4, the other two .so files were successfully extracted to the path /root/.javacpp/cache/yolo-api-1.0-jar-with-dependencies.jar/*/***//linux-x86_64.
You should ask the author of that YoloApi project. I don't know anything about it.
Please set the "org.bytedeco.javacpp.logger.debug" system property to "true" to get more information on the console.
Does it have anything to do with the caching function of javacpp? Some .so files will not be cached.
Debug: Loading class org.bytedeco.javacpp.presets.javacpp Debug: Loading class org.bytedeco.javacpp.Loader Debug: Loading /root/.javacpp/cache/yolo-api-1.0-jar-with-dependencies.jar/org/bytedeco/javacpp/linux-x86_64/libjnijavacpp.so Debug: Loading class org.bytedeco.javacpp.presets.javacpp Debug: Loading class org.bytedeco.javacpp.Pointer Debug: Loading class top..yolo.YoloApi Debug: Loading /root/.javacpp/cache/yolo-api-1.0-jar-with-dependencies.jar/top//yolo/linux-x86_64/libdarknet.so Debug: Failed to load /root/.javacpp/cache/yolo-api-1.0-jar-with-dependencies.jar/top//yolo/linux-x86_64/libdarknet.so: java.lang.UnsatisfiedLinkError: /root/.javacpp/cache/yolo-api-1.0-jar-with-dependencies.jar/top//yolo/linux-x86_64/libdarknet.so: libopencv_world.so.3.4: cannot open shared object file: No such file or directory
Please set the "org.bytedeco.javacpp.logger.debug" system property to "true" to get more information on the console.
Debug: Loading library darknet Debug: Failed to load for darknet: java.lang.UnsatisfiedLinkError: no darknet in java.library.path Debug: Loading /root/.javacpp/cache/yolo-api-1.0-jar-with-dependencies.jar/top//yolo/linux-x86_64/libjniYoloApi.so Debug: Failed to load /root/.javacpp/cache/yolo-api-1.0-jar-with-dependencies.jar/top//yolo/linux-x86_64/libjniYoloApi.so: java.lang.UnsatisfiedLinkError: /root/.javacpp/cache/yolo-api-1.0-jar-with-dependencies.jar/top/**/yolo/linux-x86_64/libjniYoloApi.so: libopencv_world.so.3.4: cannot open shared object file: No such file or directory Debug: Loading library jniYoloApi Debug: Failed to load for jniYoloApi: java.lang.UnsatisfiedLinkError: no jniYoloApi in java.library.path
It doesn't look like that YoloApi was designed to extract that library. Please report downstream.
These codes were written by me alone, and the jar package was generated using a Maven plugin. Below is the configuration file information for Maven.
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.so*</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass></mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
I write code independently without any upstream or downstream.
So, try to add "opencv_world@.3.4" to the @Platform(link=...
annotation value as shown here:
https://github.com/bytedeco/javacpp-presets/wiki/Create-New-Presets
Still printed the same error.
So, try to add "opencv_world@.3.4" to the
@Platform(link=...
annotation value as shown here: https://github.com/bytedeco/javacpp-presets/wiki/Create-New-Presets
Please set the "org.bytedeco.javacpp.logger.debug" system property to "true" to get more information on the console.
Debug: Loading class org.bytedeco.javacpp.presets.javacpp
Debug: Loading class org.bytedeco.javacpp.Loader
Debug: Loading /root/.javacpp/cache/yolo-api-1.0-jar-with-dependencies.jar/org/bytedeco/javacpp/linux-x86_64/libjnijavacpp.so
Debug: Loading class org.bytedeco.javacpp.presets.javacpp
Debug: Loading class org.bytedeco.javacpp.Pointer
Debug: Loading class top.dg.yolo.YoloApi
Debug: Loading library opencv_world.so.3.4
Debug: Failed to load for opencv_world.so.3.4: java.lang.UnsatisfiedLinkError: no opencv_world.so.3.4 in java.library.path
Debug: Loading /root/.javacpp/cache/yolo-api-1.0-jar-with-dependencies.jar/top/dg/yolo/linux-x86_64/libdarknet.so
Debug: Failed to load /root/.javacpp/cache/yolo-api-1.0-jar-with-dependencies.jar/top/dg/yolo/linux-x86_64/libdarknet.so: java.lang.UnsatisfiedLinkError: /root/.javacpp/cache/yolo-api-1.0-jar-with-dependencies.jar/top/dg/yolo/linux-x86_64/libdarknet.so: libopencv_world.so.3.4: cannot open shared object file: No such file or directory
Debug: Loading library darknet
Debug: Failed to load for darknet: java.lang.UnsatisfiedLinkError: no darknet in java.library.path
Debug: Loading /root/.javacpp/cache/yolo-api-1.0-jar-with-dependencies.jar/top/dg/yolo/linux-x86_64/libjniYoloApi.so
Debug: Failed to load /root/.javacpp/cache/yolo-api-1.0-jar-with-dependencies.jar/top/dg/yolo/linux-x86_64/libjniYoloApi.so: java.lang.UnsatisfiedLinkError: /root/.javacpp/cache/yolo-api-1.0-jar-with-dependencies.jar/top/dg/yolo/linux-x86_64/libjniYoloApi.so: libopencv_world.so.3.4: cannot open shared object file: No such file or directory
Debug: Loading library jniYoloApi
Debug: Failed to load for jniYoloApi: java.lang.UnsatisfiedLinkError: no jniYoloApi in java.library.path
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniYoloApi in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:871)
at java.lang.System.loadLibrary(System.java:1122)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1832)
at org.bytedeco.javacpp.Loader.load(Loader.java:1423)
at org.bytedeco.javacpp.Loader.load(Loader.java:1234)
at org.bytedeco.javacpp.Loader.load(Loader.java:1210)
at top.dg.yolo.YoloApi.
Please set the "org.bytedeco.javacpp.logger.debug" system property to "true" to get more information on the console.
Debug: Failed to load for opencv_world.so.3.4: java.lang.UnsatisfiedLinkError: no opencv_world.so.3.4 in java.library.path
This means "opencv_world@.3.4" isn't in the @Platform(link=...
annotation value
Please add "opencv_world@.3.4" to the @Platform(link=...
annotation value.
It is ok now! thanks very much! I'm curious about the principle behind this setting. Is there any documentation available?
The @Platform
annotation? Sure, there's a bit here:
http://bytedeco.org/javacpp/apidocs/org/bytedeco/javacpp/annotation/Platform.html
The error message can be seen in one image.
After I manually copied the libopencv_world.so.3.4 file over, the program ran normally.
However, the libopencv_world.so.3.4 file is already included in the jar package. Why wasn't the libopencv_world.so.3.4 file extracted to that directory, causing me to manually copy the file over when running the program?
I have tested all versions of javacpp, but this issue still remains unsolved. Is there any way to solve this problem?