I am trying to run a JCuda example in Debian Linux (32bit). Since there is no binaries available on JCuda website for Linux x86, I've compliled the libraries. Now I'm trying yo run the DeviceQuery example but I get the following errors:
Error while loading native library "JCudaDriver-linux-x86" with base name "JCudaDriver"
Operating system name: Linux
Architecture : i386
Architecture bit size: 32
Stack trace from the attempt to load the library as a resource:
java.lang.NullPointerException: No resource found with name '/lib/libJCudaDriver-linux-x86.so'
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:144)
at jcuda.LibUtils.loadLibrary(LibUtils.java:80)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:192)
at jcudatest.JCudaTest.main(JCudaTest.java:29)
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError: /home/rui/Downloads/JCuda-All-0.4.0-beta1-src/JCudaDriverJNI/lib/libJCudaDriver-linux-x86.so: /home/rui/Downloads/JCuda-All-0.4.0-beta1-src/JCudaDriverJNI/lib/libJCudaDriver-linux-x86.so: undefined symbol: Pointer_buffer
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1732)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at jcuda.LibUtils.loadLibrary(LibUtils.java:90)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:192)
at jcudatest.JCudaTest.main(JCudaTest.java:29)
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load the native library
at jcuda.LibUtils.loadLibrary(LibUtils.java:122)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:192)
at jcudatest.JCudaTest.main(JCudaTest.java:29)
Java Result: 1
I belive the error here is related to that undefined symbol Pointer_buffer, since I created symbolic links on /lib and this folder is on PATH variables (I can see it resolving the symboling link to /home/rui/Downloads/JCuda-All-0.4.0-beta1-src/JCudaDriverJNI/lib/libJCudaDriver-linux-x86.so like it was supposed). Everything is working with Cuda as well, since I can compile and run Cuda examples. Cuda version is 4.0.17 and JCuda 0.4.0-beta1 (from JCuda website I can see Version 0.4.0-beta1. These libraries have been compiled for CUDA 4.0 (build 17) so I think I don't have any incompatibility here as well).
I am setting up my project on Netbeans, and I've included the source files present on JcudaJava folder. Do I need to include the cpp and hpp file from JCudaDriverJNI and JCudaRuntimeJNI folders (I never worked with JNI before, don't really know what I need to include).
Thanks in advance,
Rui
An "undefined symbol" means that a definition for the symbol (variable, function) was not found. JCuda defines Pointer_buffer in CommonJNI/PointerUtils.cpp so there must have been some problem including PointerUtils.o in the .so. Were there any errors when you compiled?
Related
I am working with R 4.2.1, 64bit, Windows 10.
while calling library rsubgroup, I get an error:
library(rsubgroup)
Loading required package: foreign
Error: package or namespace load failed for ‘rsubgroup’:
.onLoad failed in loadNamespace() for 'rsubgroup', details:
call: .jinit(parameters = parameters)
error: Unable to create a Java class loader.
rJava loads without problems.
I have installed Java 1.8.0_341 and JDK jdk-18.0.2
I have set-up manually JAVA_HOME and PATH variables.
Any hints what can go wrong with .jinit?
many thanks!
Solved, caused by my comp installation: R is installed in C:.../ProgramFiles that is write-protected (accessible only by "admin"); rJava and rsubgroup installed in the ...Users personal library. While moving all installation (core R, libraries) to writable disk, all starts to work. Apologies for this dumb question but I leave it here - perhaps could help somebody in future...
I am trying to run a test file InspectVM from libguestfs library inorder to have accesss to a disk image in windows. However, I have the following errors on my console
run:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no guestfs_jni in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at madjava.com.redhat.et.libguestfs.GuestFS.<clinit>(GuestFS.java:51)
at madjava.examples.InspectVM.main(InspectVM.java:30)
C:\Users\CyberSOFONET\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)#
I searched allover the internet and find that I should set java.libraly.path pointing to location of the guestfs_jni. my major problem is that I do not have any file with that name guestfs_jni. Do I need to make one myself or can I find it somewhere. any kind of help is appriciated. am a newbie in JNI so I dont have much imformation on it
You're looking for a file called guestfs_jni.dll. Usually the native library comes with the jar file.
From http://libguestfs.org/guestfs-java.3.html:
Libguestfs for Java is a Java Native Interface (JNI) extension, supplied in three parts: libguestfs.jar, libguestfs-VERSION.jar, libguestfs_jni.so, libguestfs.so
So the distribution comes with libguest_jni.so which ist for Linux and not for Windows. IIRC, there is no libguestfs for Windows. So you would first have to find out if it is even possible to compile libguestfs using Cygwin and if yes build it yourself.
If you're on Windows 10 you could try installing libguestfs and a Java runtime for the Linux subsystem and run inside the subsystem.
I am trying to setup mavenized JCUDA for a project that I am working on and am running into issues with telling java where to locate the library files.
Setting up and getting maven to build the .jar and .dll files has worked fine, I can see the correctly named .dll files in project\target\lib and I am setting my native library location to this folder.
The error I get when trying to run one of the programs from JCUDA JCublasSample.java (www.jcuda.org/samples/JCublasSample.java) is:
Creating input data... Performing Sgemm with Java... Performing Sgemm
with JCublas...
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not
load the native library.
Error while loading native library "JCublas-windows-x86_64" with base
name "JCublas" Operating system name: Windows 7 Architecture :
amd64 Architecture bit size: 64
Stack trace from the attempt to load the library as a resource:
java.lang.NullPointerException: No resource found with name
'/lib/JCublas-windows-x86_64.dll'
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:149) at
jcuda.LibUtils.loadLibrary(LibUtils.java:83) at
jcuda.jcublas.JCublas.initialize(JCublas.java:93) at
jcuda.jcublas.JCublas.(JCublas.java:81) at
JCublasSample.sgemmJCublas(JCublasSample.java:64) at
JCublasSample.testSgemm(JCublasSample.java:49) at
JCublasSample.main(JCublasSample.java:25)
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError:
C:\Users\kristoffer.bernhem\git\SMlocalizer\target\lib\JCublas-windows-x86_64.dll:
Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method) at
java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941) at
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857) at
java.lang.Runtime.loadLibrary0(Runtime.java:870) at
java.lang.System.loadLibrary(System.java:1122) at
jcuda.LibUtils.loadLibrary(LibUtils.java:94) at
jcuda.jcublas.JCublas.initialize(JCublas.java:93) at
jcuda.jcublas.JCublas.(JCublas.java:81) at
JCublasSample.sgemmJCublas(JCublasSample.java:64) at
JCublasSample.testSgemm(JCublasSample.java:49) at
JCublasSample.main(JCublasSample.java:25) at
jcuda.LibUtils.loadLibrary(LibUtils.java:128) at
jcuda.jcublas.JCublas.initialize(JCublas.java:93) at
jcuda.jcublas.JCublas.(JCublas.java:81) at
JCublasSample.sgemmJCublas(JCublasSample.java:64) at
JCublasSample.testSgemm(JCublasSample.java:49) at
JCublasSample.main(JCublasSample.java:25)
As explained by Guenther, the problem lies in supporting .dll files that are lacking. How would I go about sorting this error out?
This is being run in windows 7 (64bit) and run with JDK1.8.0_91.
Attempting to build sikuli-slides-1.5.0 with the command "mvn clean install", I am getting the above referenced stack trace. I am using Windows 7 and have attempted the instructions I have come across for various solutions proposed on here to no avail. My Path and CLASSPATH variables for both user and system defined variables include:
"C:\opencv\build\x64\vc10\bin"
and I have restarted my machine multiple times.
In addition, I have added javacv.jar, javacv.windows-x86.jar, javacv.windows-x86_64.jar to my project's build path and have javacv-0.9.jar in my pom.xml. I have also included javacpp-0.9.jar in my pom as well. I can visually see all of the above referenced jars on my build path and can import the jniopencv_core into any of my classes. Any assistance would be greatly appreciated. While executing the JUnit test AutomationExecutorExceptionTest.java, the test fails and creates an orphaned java.exe process that must be manually shut down.
The full stack trace is listed below.
Exception in thread "Thread-60" java.lang.UnsatisfiedLinkError: no jniopencv_core in >java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:535)
at org.bytedeco.javacpp.Loader.load(Loader.java:410)
at org.bytedeco.javacpp.Loader.load(Loader.java:353)
at org.bytedeco.javacpp.opencv_core.(opencv_core.java:10)
at org.bytedeco.javacpp.helper.opencv_core$AbstractIplImage.create(openc
v_core.java:909)
at org.bytedeco.javacpp.helper.opencv_core$AbstractIplImage.createFrom(o
pencv_core.java:999)
at org.bytedeco.javacpp.helper.opencv_core$AbstractIplImage.createFrom(o
pencv_core.java:971)
at org.bytedeco.javacpp.helper.opencv_core$AbstractIplImage.createFrom(o
pencv_core.java:968)
at org.sikuli.core.cv.ImagePreprocessor.createGrayscale(ImagePreprocesso
r.java:43)
at org.sikuli.core.search.TemplateMatcher.findMatchesByGrayscaleAtOrigin
alResolution(TemplateMatcher.java:71)
at org.sikuli.api.ImageTarget.getUnorderedMatches(ImageTarget.java:127)
at org.sikuli.api.DefaultTarget.doFindAll(DefaultTarget.java:128)
at org.sikuli.api.DefaultScreenRegion.findAll(DefaultScreenRegion.java:7
4)
at org.sikuli.slides.api.sikuli.CrossSearchStrategy.testHypotheses(Cross
SearchStrategy.java:85)
at org.sikuli.slides.api.sikuli.CrossSearchStrategy.perform(CrossSearchS
trategy.java:39)
at org.sikuli.slides.api.sikuli.ContextImageTarget.doFindAll(ContextImag
eTarget.java:122)
at org.sikuli.api.DefaultScreenRegion._find(DefaultScreenRegion.java:88)
at org.sikuli.api.DefaultScreenRegion.find(DefaultScreenRegion.java:80)
at org.sikuli.slides.api.actions.TargetAction.execute(TargetAction.java:
26)
at org.sikuli.slides.api.actions.RetryAction.execute(RetryAction.java:51
)
at org.sikuli.slides.api.actions.ParallelAction$Worker.run(ParallelActio
n.java:35)
at java.lang.Thread.run(Thread.java:745)
Your stack trace contains the following line:
Exception in thread "Thread-60" java.lang.UnsatisfiedLinkError: no jniopencv_cor e in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
Notice the space between jniopencv_cor and e?
One of your configuration files contain a space where it shouldn't.
The directions are highly confusing for the javacv files. The issue was that I had to actually explode the contents of the jar file and expose the DLLs in the directory. The instructions packaged with the jars of javacv instructed me to simply place the binaries on the classpath.
I had the same problem and I solved it by adding the following dependency in my Maven project for Sikuli Slides 1.5.1:
GroupId: org.bytedeco.javacpp-presets
AritfactId: opencv
Version: 2.4.9-0.9
Type: jar
Classifier: windows-x86_64
In my case I was using Windows 7 64-bit. After adding this dependency I was able to successfully build Sikuli Slides.
When using the Java Attach API, I'm getting the following link error on Linux (tried it on different machines) only:
Exception in thread "main" java.lang.UnsatisfiedLinkError: sun.tools.attach.WindowsAttachProvider.tempPath()Ljava/lang/String;
at sun.tools.attach.WindowsAttachProvider.tempPath(Native Method)
at sun.tools.attach.WindowsAttachProvider.isTempPathSecure(WindowsAttachProvider.java:74)
at sun.tools.attach.WindowsAttachProvider.listVirtualMachines(WindowsAttachProvider.java:58)
at com.sun.tools.attach.VirtualMachine.list(VirtualMachine.java:134)
at sun.tools.jconsole.LocalVirtualMachine.getAttachableVMs(LocalVirtualMachine.java:151)
at sun.tools.jconsole.LocalVirtualMachine.getAllVirtualMachines(LocalVirtualMachine.java:110)
...
Interestingly, on Solaris and Windows it's working out of the box.
I tried out several combinations of specifying java.library.path to point to the directory which contains the libattach.so but with no luck.
What's wrong here?
And as a bonus question: Is there a way to see which native library is actually bound to a java class?
Different AttachProvider are used on different platforms. On Linux, it shouldn't use sun.tools.attach.WindowsAttachProvider. It is for Windows.
[solaris] sun.tools.attach.SolarisAttachProvider
[windows] sun.tools.attach.WindowsAttachProvider
[linux] sun.tools.attach.LinuxAttachProvider
This is configured in a resource file META-INF\services\com.sun.tools.attach.spi.AttachProvider (typically this file exists in tools.jar). It will search CLASSPATH to get first occurrence of this resource file and read the AttachProvider implementation class from it.
So you can probably resolve this problem by search sun.tools.attach.WindowsAttachProvider in your CLASSPATH. Possibly you have included a tools.jar from Windows.