When will JOCL 0.2.0 be available in Maven?

OK, I removed the suffixes.

To quote you: Cross compiling is fun for every day :wink: - it IS a hassle, but at least, CMake comes pretty close to being a real cross-platform build tool. I mean, look at the files that it generates (the makefiles, or the vcxproj files). This certainly is tremendously complex (and then there are still things that HAVE to be platform- and compiler dependent, after all).

I wonder what if (stranger.isValid(library, ... does. Does it indeed check whether this library can be loaded? I don’t have a clue about how all this works on Linux, but … isn’t there some configuration (ldconfig) that says which library should be loaded when „libOpenCL.so“ should be loaded? And can’t this, in doubt, be solved by manually creating a symlink to the actual „so.1“ file? However, the error message stems from an attempt to open „libOpenCL.so“ using dlopen, and if anybody has hints about how this can be improved or generalized, I’d be happy to hear them. (But I’ll also have to read the dlopen documentation again - it seems to contain some hints what this „.so.1“ and ldconfig stuff is all about…)

It compiles and run fine now. Excellent.

Build and run

[mschorn@cube ~]$ cd Downloads/
[mschorn@cube Downloads]$ mkdir Temp
[mschorn@cube Downloads]$ cd Temp
[mschorn@cube Temp]$ git clone https://github.com/gpu/JOCL.git
Cloning into 'JOCL'...
remote: Counting objects: 608, done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 608 (delta 17), reused 0 (delta 0), pack-reused 563
Receiving objects: 100% (608/608), 624.42 KiB | 446.00 KiB/s, done.
Resolving deltas: 100% (352/352), done.
Checking connectivity... done.
[mschorn@cube Temp]$ cmake JOCL/
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found JNI: /usr/lib/jvm/jre/lib/amd64/libjawt.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mschorn/Downloads/Temp
[mschorn@cube Temp]$ make
Scanning dependencies of target JOCL_0_2_0-linux-x86_64
[ 11%] Building CXX object CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main/native/JOCL.cpp.o
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp: In function ‘jint Java_org_jocl_CL_clEnqueueNativeKernelNative(JNIEnv*, jclass, jobject, jobject, jobject, jlong, jint, jobjectArray, jobjectArray, jint, jobjectArray, jobject)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:6112:20: warning: converting to non-pointer type ‘jint {aka int}’ from NULL [-Wconversion-null]
             return NULL;
                    ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:6123:20: warning: converting to non-pointer type ‘jint {aka int}’ from NULL [-Wconversion-null]
             return NULL;
                    ^
[ 22%] Building CXX object CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main/native/Logger.cpp.o
[ 33%] Building CXX object CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main/native/CLJNIUtils.cpp.o
[ 44%] Building CXX object CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main/native/CLFunctions.cpp.o
[ 55%] Building CXX object CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main/native/FunctionPointerUtils.cpp.o
[ 66%] Building CXX object CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main/native/FunctionPointerUtils_Linux.cpp.o
[ 77%] Building CXX object CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main/native/FunctionPointerUtils_Win.cpp.o
[ 88%] Building CXX object CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main/native/JNIUtils.cpp.o
[100%] Building CXX object CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main/native/PointerUtils.cpp.o
Linking CXX shared library JOCL/nativeLibs/libJOCL_0_2_0-linux-x86_64.so
[100%] Built target JOCL_0_2_0-linux-x86_64
[mschorn@cube Temp]$ ls
CMakeCache.txt  CMakeFiles  cmake_install.cmake  JOCL  Makefile
[mschorn@cube Temp]$ cd JOCL/
[mschorn@cube JOCL]$ ls
CMake_c_flag_overrides.cmake  CMake_cxx_flag_overrides.cmake  CMakeLists.txt  LICENSE.TXT  nativeLibs  pom.xml  Readme.txt  src
[mschorn@cube JOCL]$ mvn clean install
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building JOCL 0.2.0-RC01-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ jocl ---
[INFO] 
[INFO] --- maven-enforcer-plugin:1.2:enforce (enforce-maven) @ jocl ---
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ jocl ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/mschorn/Downloads/Temp/JOCL/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ jocl ---
[INFO] Compiling 33 source files to /home/mschorn/Downloads/Temp/JOCL/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ jocl ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/mschorn/Downloads/Temp/JOCL/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ jocl ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ jocl ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:copy-resources (copy-resources) @ jocl ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] skip non existing resourceDirectory /home/mschorn/Downloads/Temp/JOCL/../../nativeLibs
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ jocl ---
[INFO] Building jar: /home/mschorn/Downloads/Temp/JOCL/target/jocl-0.2.0-RC01-SNAPSHOT.jar
[INFO] 
[INFO] >>> maven-source-plugin:2.1.2:jar (attach-sources) > generate-sources @ jocl >>>
[INFO] 
[INFO] --- maven-enforcer-plugin:1.2:enforce (enforce-maven) @ jocl ---
[INFO] 
[INFO] <<< maven-source-plugin:2.1.2:jar (attach-sources) < generate-sources @ jocl <<<
[INFO] 
[INFO] --- maven-source-plugin:2.1.2:jar (attach-sources) @ jocl ---
[INFO] Building jar: /home/mschorn/Downloads/Temp/JOCL/target/jocl-0.2.0-RC01-SNAPSHOT-sources.jar
[INFO] 
[INFO] --- maven-javadoc-plugin:2.7:jar (attach-javadocs) @ jocl ---
[INFO] 
Loading source files for package org.jocl...
Constructing Javadoc information...
Standard Doclet version 1.8.0_45
Building tree for all the packages and classes...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/BuildProgramFunction.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/CL.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/cl_buffer_region.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/cl_command_queue.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/cl_context.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/cl_context_properties.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/cl_device_id.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/cl_device_partition_property.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/cl_event.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/cl_image_desc.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/cl_image_format.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/cl_kernel.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/cl_mem.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/cl_pipe_properties.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/cl_platform_id.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/cl_program.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/cl_queue_properties.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/cl_sampler.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/cl_sampler_properties.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/CL.LogLevel.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/CLException.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/CreateContextFunction.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/EnqueueNativeKernelFunction.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/EventCallbackFunction.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/MemObjectDestructorCallbackFunction.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/NativePointerObject.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/Pointer.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/PrintfCallbackFunction.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/Sizeof.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/SVMFreeFunction.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/package-frame.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/package-summary.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/package-tree.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/constant-values.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/serialized-form.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/cl_device_id.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/EnqueueNativeKernelFunction.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/NativePointerObject.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/MemObjectDestructorCallbackFunction.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/cl_pipe_properties.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/CLException.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/EventCallbackFunction.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/cl_context_properties.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/cl_device_partition_property.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/cl_image_format.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/cl_context.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/cl_kernel.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/cl_sampler.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/PrintfCallbackFunction.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/BuildProgramFunction.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/cl_mem.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/SVMFreeFunction.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/cl_sampler_properties.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/cl_image_desc.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/cl_buffer_region.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/cl_command_queue.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/cl_program.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/CreateContextFunction.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/Pointer.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/cl_queue_properties.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/Sizeof.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/CL.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/CL.LogLevel.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/cl_platform_id.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/class-use/cl_event.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/org/jocl/package-use.html...
Building index for all the packages and classes...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/overview-tree.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/index-all.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/deprecated-list.html...
Building index for all classes...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/allclasses-frame.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/allclasses-noframe.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/index.html...
Generating /home/mschorn/Downloads/Temp/JOCL/target/apidocs/help-doc.html...
[INFO] Building jar: /home/mschorn/Downloads/Temp/JOCL/target/jocl-0.2.0-RC01-SNAPSHOT-javadoc.jar
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ jocl ---
[INFO] Installing /home/mschorn/Downloads/Temp/JOCL/target/jocl-0.2.0-RC01-SNAPSHOT.jar to /home/mschorn/.m2/repository/org/jocl/jocl/0.2.0-RC01-SNAPSHOT/jocl-0.2.0-RC01-SNAPSHOT.jar
[INFO] Installing /home/mschorn/Downloads/Temp/JOCL/pom.xml to /home/mschorn/.m2/repository/org/jocl/jocl/0.2.0-RC01-SNAPSHOT/jocl-0.2.0-RC01-SNAPSHOT.pom
[INFO] Installing /home/mschorn/Downloads/Temp/JOCL/target/jocl-0.2.0-RC01-SNAPSHOT-sources.jar to /home/mschorn/.m2/repository/org/jocl/jocl/0.2.0-RC01-SNAPSHOT/jocl-0.2.0-RC01-SNAPSHOT-sources.jar
[INFO] Installing /home/mschorn/Downloads/Temp/JOCL/target/jocl-0.2.0-RC01-SNAPSHOT-javadoc.jar to /home/mschorn/.m2/repository/org/jocl/jocl/0.2.0-RC01-SNAPSHOT/jocl-0.2.0-RC01-SNAPSHOT-javadoc.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.628 s
[INFO] Finished at: 2015-06-04T12:08:10+02:00
[INFO] Final Memory: 18M/247M
[INFO] ------------------------------------------------------------------------
[mschorn@cube JOCL]$ cd ..
[mschorn@cube Temp]$ mkdir -p org/jocl/samples/
[mschorn@cube Temp]$ wget http://www.jocl.org/samples/JOCLSample.java
--2015-06-04 12:09:05--  http://www.jocl.org/samples/JOCLSample.java
Resolving www.jocl.org (www.jocl.org)... 81.169.145.94, 2a01:238:20a:202:1094::
Connecting to www.jocl.org (www.jocl.org)|81.169.145.94|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5827 (5,7K) [text/x-java-source]
Saving to: ‘JOCLSample.java’

JOCLSample.java                       100%[=========================================================================>]   5,69K  --.-KB/s   in 0,05s  

2015-06-04 12:09:05 (111 KB/s) - ‘JOCLSample.java’ saved [5827/5827]

[mschorn@cube Temp]$ mv JOCLSample.java org/jocl/samples/JOCLSample.java
[mschorn@cube Temp]$ javac -cp JOCL/target/jocl-0.2.0-RC01-SNAPSHOT.jar  org/jocl/samples/JOCLSample.java
Note: org/jocl/samples/JOCLSample.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
[mschorn@cube Temp]$ ln -s /lib64/libOpenCL.so.1.0.0 /lib64/libOpenCL.so
ln: failed to create symbolic link ‘/lib64/libOpenCL.so’: Permission denied
[mschorn@cube Temp]$ sudo ln -s /lib64/libOpenCL.so.1.0.0 /lib64/libOpenCL.so
[sudo] password for mschorn: 
[mschorn@cube Temp]$ java -cp JOCL/target/jocl-0.2.0-RC01-SNAPSHOT.jar:. org.jocl.samples.JOCLSample
Test PASSED
Result: [0.0, 1.0, 4.0, 9.0, 16.0, 25.0, 36.0, 49.0, 64.0, 81.0]
[mschorn@cube Temp]$ java -DuniqueLibraryNames=true -cp JOCL/target/jocl-0.2.0-RC01-SNAPSHOT.jar:. org.jocl.samples.JOCLSample
Test PASSED
Result: [0.0, 1.0, 4.0, 9.0, 16.0, 25.0, 36.0, 49.0, 64.0, 81.0]
[mschorn@cube Temp]$ ls /tmp/
[..] 
libJOCL_0_2_0-linux-x86_64.so
[..]
[mschorn@cube Temp]$ sudo rm /lib64/libOpenCL.so

Have you ever thought about placing JOCLSample as integration test to the maven lifecycle?

Yes, cmake is a big simplification. And not every build tool can have the elegancy of maven. :wink:

Yes, basically it calls dlopen/dlsym.

Yes, that would be a working solution. But manipulations of system folders is not to being known as best practice.

A closer look to my lib folder and the three common Open* libraries:

[mschorn@cube ~]$ ls -l /lib64/libOpenCL.* /lib64/libGL.* /lib64/libopenal.*
lrwxrwxrwx. 1 root root     14 23. Mär 17:21 /lib64/libGL.so -> libGL.so.1.2.0
lrwxrwxrwx. 1 root root     14 23. Mär 17:21 /lib64/libGL.so.1 -> libGL.so.1.2.0
-rwxr-xr-x. 1 root root 642096 23. Mär 17:22 /lib64/libGL.so.1.2.0
lrwxrwxrwx. 1 root root     19 25. Jan 11:47 /lib64/libopenal.so.1 -> libopenal.so.1.16.0
-rwxr-xr-x. 1 root root 457408 25. Jan 11:47 /lib64/libopenal.so.1.16.0
lrwxrwxrwx. 1 root root     18 18. Aug 2014  /lib64/libOpenCL.so.1 -> libOpenCL.so.1.0.0
-rwxr-xr-x. 1 root root 105576 18. Aug 2014  /lib64/libOpenCL.so.1.0.0

According to this document, libOpenCL.so.1.0.0 is the realname, libOpenCL.so.1 is the soname and libOpenCL.so should be the linker name. ldconfig set up only the soname, not the linker name.

A wider look over my lib folder shows that some libraries have a linker name and some doesn’t.

Another sentence from the document:

But I didn’t find a way to determine the “right” soname.

Viele Grüße
Fancy

[QUOTE=Fancy]It compiles and run fine now. Excellent.

...
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp: In function ‘jint Java_org_jocl_CL_clEnqueueNativeKernelNative(JNIEnv*, jclass, jobject, jobject, jobject, jlong, jint, jobjectArray, jobjectArray, jint, jobjectArray, jobject)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:6112:20: warning: converting to non-pointer type ‘jint {aka int}’ from NULL [-Wconversion-null]
             return NULL;
                    ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:6123:20: warning: converting to non-pointer type ‘jint {aka int}’ from NULL [-Wconversion-null]
             return NULL;
                    ^
[ 22%] Building CXX object CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main/native/Logger.cpp.o
...

[/quote]

That’s surprising. Due to Murphy’s laws, I thought I had overlooked exactly one place that caused a warning. Now it has been two. Fixed :wink:

Have you ever thought about placing JOCLSample as integration test to the maven lifecycle?

Sure. There’s a sticky note on my keyboard: „JOCL Unit-Tests“ (this already raised some eyebrows elsewhere…). Of course, I have a set of tests, but they are not written as (J)Unit-Tests right now. Some basic tests could trivially be converted to Unit-Tests (e.g. the JOCLSample). But others (as the GL interoperability) not. I’ll try to do the cleanup/merge of my local project (with local SVN repo) and the Maven/Git version today, maybe I can also start converting the Integration tests into Unit-Tests then.

Yes, cmake is a big simplification. And not every build tool can have the elegancy of maven. :wink:

Oh, the irony :wink: Sure, just having to add a simple is elegant. But this „elegance“ comes from a mix of constraining the user, and from the fact that creating a binary from the „usual“ target Language (Java) is trivial.

Yes, basically it calls dlopen/dlsym.

According to this document, libOpenCL.so.1.0.0 is the realname, libOpenCL.so.1 is the soname and libOpenCL.so should be the linker name. ldconfig set up only the soname, not the linker name.

Another sentence from the document:

First I thought one could simply use this pattern internally - basically, call

if (dlopen("libX.so")) return fine;
if (dlopen("libX.so.1")) return fine;

but this does not make sense: It should always try to load the latest available OpenCL implementation library. To my understanding, when you install an OpenCL 2.0 library, you might end up with a „libOpenCL.so.2“ (or „2.0“ or „2.0.0“ or whatever…), and JOCL should try to pick this one (and not any hard-coded „.so.1“ version).

I guess setting up the soname with ldconfig (to point to the latest linker-name-library) is technically not the worst solution here. But of course, people will run into this, and complain about an „UnsatisfiedLinkError“ when the link „libOpenCL.so → libOpenCL.so.1“ is not set up. (And sometimes when it IS set up - see java - Cannot load native libOpenCL.so library from Maven resource - Stack Overflow …)

I’m curious to the upcoming commits.

I believed it previously, but now I’m not sure. According to the Document referred in the previous post, the soname need only to change if the ABI is binary-incompatible with the old one. I believe this is not the case by OpenCL 1.2->2.0.

For comparison: my current OpenGL soname is libGL.so.1 (realname libGL.so.1.2.0). But this shared object file has OpenGL 3 capability.

I see no more reliably correlation between the API Version and the soname.

I think he placed it in the wrong folder. sudo ldconfig -v | grep / should list the relevant folders.

Viele Grüße
Fancy

Just added the first, basic Unit tests. I also started cleaning up the samples, so that they may become a GitHub project as well. And eventually, I want to create a project for the „Utils“ that are currently only a library hidden in the „Cloth Simulation“ sample (these really simplify things a lot…)

I believed it previously, but now I’m not sure. According to the Document referred in the previous post, the soname need only to change if the ABI is binary-incompatible with the old one. I believe this is not the case by OpenCL 1.2->2.0.

For comparison: my current OpenGL soname is libGL.so.1 (realname libGL.so.1.2.0). But this shared object file has OpenGL 3 capability.

I see no more reliably correlation between the API Version and the soname.

Well, maybe not a direct correlation between the API version and the „so.version.number“, but … if the „version number“ always was „.1“, then this was somehow useless - so there must be more behind that. Or do you think that simply trying to load „so.1“ will reliably resolve this issue? What prevents an ldconfig from not containing a „so.1“, but an „so.1.0“?

(omitting one more rant here)

Additionally, I’m not sure whether things are even a bit more special for OpenCL: Due to this „installable client driver“ thing, you never know what you get. I just ran into this: In the (to be updated) samples I wanted to avoid a function that was „deprecated“ in OpenCL 2.0. And I changed it to the NEW function. Suddenly, some samples crashed the JVM painfully - simply because the OpenCL.lib was version 2.0, and contained this function, but the underlying platform only supported OpenCL 1.1. I wrote this four years ago: Detecting which functions are available depending ... - AMD Community - and I still don’t understand how this should be managed: Theoretically, you would have to make a version check before EACH AND EVERY function call :suspect: (unless you’re sure it’s one that was available since 1.0).

I added something like this as a comment - consider your quoted text upvoted :smiley:

For my understanding, the soname version should stay the same, until the ABI breaks compatibility. The linked document shows when this is the case:

For OpenGL this is the case. You can use a libGL.so.1 with OpenGL 4 capabilities to perfectly drive an OpenGL 1 application. But with an libGL.so.2 file this would probably not possible.
I can not tell if that’s the same case for OpenCL.

At the moment yes (together with trying to load the .so). For the future, I don’t know. In my lib folder are lots of files with version >1.

.so.1.0 is a realname chosen by the developer. ldconfig set up the corresponding .so.1 link. So I believe there should always be a .so.1, if a library with this ABI compatible version is installed.

[ot][QUOTE=Marco13;118366]Additionally, I’m not sure whether things are even a bit more special for OpenCL: Due to this „installable client driver“ thing, you never know what you get. I just ran into this: In the (to be updated) samples I wanted to avoid a function that was „deprecated“ in OpenCL 2.0. And I changed it to the NEW function. Suddenly, some samples crashed the JVM painfully - simply because the OpenCL.lib was version 2.0, and contained this function, but the underlying platform only supported OpenCL 1.1. I wrote this four years ago: Detecting which functions are available depending ... - AMD Community - and I still don’t understand how this should be managed: Theoretically, you would have to make a version check before EACH AND EVERY function call :suspect: (unless you’re sure it’s one that was available since 1.0). [/quote]

I believe Vulkan get a similar system. Hopefully they provide a clean solution.[/ot]

lol :wink: With the comments he added, I would say he placed the file in a directory which is not watched by ldconfig. With the conf files in /etc/ld.so.conf.d/ you can add additional folders. A little like PATH on Windows.

I quickly build the current JOCL and the two test run fine without problems. Only one warning appears:

[WARNING] Some problems were encountered while building the effective model for org.jocl:jocl:jar:0.2.0-RC01-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 161, column 21

Viele Grüße
Fancy

Hi folks

I’m happy to help build this project on a Mac, but there needs to be very clear instructions on what commands to run, and which compilers, e.t.c. need to be installed. I had a go but wasn’t able to make it build correctly.

I’m not entirely sure about some details on Mac, but it should (!) be easy, and hardly any “commands” should be involved. Do you have CMake installed? In this case, you should be able to

  • Start cmake-gui
  • Point it to the directory where you unpacked the JOCL sources
  • Click “Configure” (it will then ask about some compiler - and that’s the point where I’m not sure which one to choose for Mac)
  • Click “Generate”
  • Compile using the resulting make files
    (Maybe some Mac User reads this, and give hints about which compiler to use?)