[Solved]OpenCL[LWJGL] Failed to load a library; Missing JAR file

Started by Evan407, May 24, 2017, 17:07:25

Previous topic - Next topic

Evan407

java -cp Dependencies/lwjgl/*:. com.evanstools.opencl.demo.Demo
[LWJGL] Failed to load a library. Possible solutions:
	a) Set -Djava.library.path or -Dorg.lwjgl.librarypath to the directory that contains the shared libraries.
	b) Add the JAR(s) containing the shared libraries to the classpath.
[LWJGL] Enable debug mode with -Dorg.lwjgl.util.Debug=true for better diagnostics.
[LWJGL] Enable the SharedLibraryLoader debug mode with -Dorg.lwjgl.util.DebugLoader=true for better diagnostics.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to locate library: libOpenCL.so
	at org.lwjgl.system.Library.loadNative(Library.java:207)
	at org.lwjgl.system.Library.loadNative(Library.java:251)
	at org.lwjgl.opencl.CL.create(CL.java:54)
	at org.lwjgl.opencl.CL.<clinit>(CL.java:43)
	at org.lwjgl.opencl.CL10.nclGetPlatformIDs(CL10.java:394)
	at org.lwjgl.opencl.CL10.clGetPlatformIDs(CL10.java:417)
	at com.evanstools.opencl.demo.Demo.main(Demo.java:10)


I was under the impression in this version of lwjgl that everything was somehow packaged inside of the jar files. I'm not sure where are the files/libraries?
Quotea) Set -Djava.library.path or -Dorg.lwjgl.librarypath to the directory that contains the shared libraries.


package com.evanstools.opencl.demo;
import static org.lwjgl.opencl.CL10.*;
import org.lwjgl.*;
import java.nio.*;
import static org.lwjgl.BufferUtils.*;
class Demo{
  public static void main(String[] args){
    PointerBuffer platforms = null;
    IntBuffer num_platforms = null;
    clGetPlatformIDs(platforms,num_platforms);
    /*PointerBuffer devices = null;
    IntBuffer numberOfDevices = null;
    clGetDeviceIDs(,
                   CL_DEVICE_TYPE_ALL,
                   devices,
                   numberOfDevices);*/
  }
}


[LWJGL] Loading library: OpenCL
[LWJGL] 	libOpenCL.so not found in org.lwjgl.librarypath=/tmp/lwjglevan/3.1.1-build-16
[LWJGL] 	libOpenCL.so not found in java.library.path=/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
[LWJGL] 	libOpenCL.so not found in system paths
[LWJGL] Failed to load a library. Possible solutions:

Missing lwjgl-opencl-natives...jar files with libOpenCL.so!

lwjgl/stable/bin/lwjgl-opencl/
ââ,¬Â¦
khronos_license.txt
https://build.lwjgl.org/stable/bin/lwjgl-opencl/khronos_license.txt   Download
lwjgl-opencl-javadoc.jar
https://build.lwjgl.org/stable/bin/lwjgl-opencl/lwjgl-opencl-javadoc.jar   Download
lwjgl-opencl-sources.jar
https://build.lwjgl.org/stable/bin/lwjgl-opencl/lwjgl-opencl-sources.jar   Download
lwjgl-opencl.jar
https://build.lwjgl.org/stable/bin/lwjgl-opencl/lwjgl-opencl.jar   Download

spasi

LWJGL does not provide libOpenCL.so, just like it doesn't provide an OpenGL implementation. OpenCL must be installed on your system separately, usually with your GPU drivers. You could also have multiple OpenCL platforms (e.g. the Intel OpenCL runtime with a CPU device and the Nvidia OpenCL implementation with a GPU device), in which case libOpenCL.so is the ICD loader (ICD = Installable Client Drivers) that can be used to choose one or the other (or both).

Evan407

Okay I
apt install ocl-icd-opencl-dev

Quote./usr/lib/x86_64-linux-gnu/libOpenCL.so
It works!
java -Dorg.lwjgl.util.Debug=true -Dorg.lwjgl.util.DebugLoader=true -cp Dependencies/lwjgl/*:. com.evanstools.opencl.demo.Demo

Quote[LWJGL] Version: 3.1.1 build 16
[LWJGL]     OS: Linux v4.8.0-52-generic
[LWJGL]    JRE: 1.8.0_131 amd64
[LWJGL]    JVM: OpenJDK 64-Bit Server VM v25.131-b11 by Oracle Corporation
[LWJGL] Loading library (system): lwjgl
[LWJGL]    Using SharedLibraryLoader...
[LWJGL]    Found at: /tmp/lwjglevan/3.1.1-build-16/liblwjgl.so
[LWJGL]    Loaded from org.lwjgl.librarypath: /tmp/lwjglevan/3.1.1-build-16/liblwjgl.so
[LWJGL] MemoryUtil accessor: MemoryAccessorUnsafe
[LWJGL] Loading library: OpenCL
[LWJGL]    libOpenCL.so not found in org.lwjgl.librarypath=/tmp/lwjglevan/3.1.1-build-16
[LWJGL]    Loaded from java.library.path: /usr/lib/x86_64-linux-gnu/libOpenCL.so