When will JOCL 0.2.0 be available in Maven?

There are lots of libraries in official maven repo released as libraryX-0.1.2-alpha1 and I think that even in sonatype’s maven book there is similar guidance for releasing alpha/beta versions, so you can even put it in the release repository.

*** Edit ***

Just a quick note - I’ve just tried the lib on linux with the existing code and it works without problems for fairly non-trivial examples.
IMPORTANT - the .so file must be renamed to contain _0_2_0, since make generated it without that.

OK, after “the usual hassle” with Maven, GitHub and Sonatype, version “0.2.0-RC00” should soon be available in the central.

Thank you, Marco.

I have asked a friend who owns a Mac Book Pro (Mid 2014) wih Intel Iris graphic card to build the OSX binary, but he failed. There were three basic problems:

  1. Makefile mentions GPU Computing folder. XCode is installed, so OpenCL should already be there, but we failed to find where it could be. Do you perhaps know what prerequisites should be there for the build to work? Is it (theoretically) possible at all to build JOCL 0.2.0 on OSX since the officially supported version is 1.2, and there is no possibility to install AMD’s drivers even if the AMD’s hardware is present?
  2. Makefile mentions /opt/AMDAPPSDK, which obviously won’t be there since you can’t control which hardware will be put in your Mac by Apple.
  3. The build that we tried actually complained about non-existing jni-.h, a platform specific file that should be there since the machine was fully configured for Java development with $JAVA_HOME set, etc…

I have to admit a few things:

  • The makefile was created by “adapting” one of the Makefiles of an NVIDIA OpenCL sample
  • It definitely has to be cleaned up.
  • I could never test it on MacOS (only Linux, but now not even that)
  • I only could try to “blindly” integrate details about Installation Paths of the OpenCL SDK on Mac that I heard from others…

When there is no CL 2.0 SDK on MacOS, I doubt that it will be possible to compile it. According to https://support.apple.com/de-de/HT202823 , the newest supported version if 1.2. - which is surprising, considering Apples role in OpenCL. Hopefully, CL 2.0 will be available on Mac soon. (In fact, Khronos is already at 2.1…)

However, regarding the build/makefiles: I know that this is not an acceptable situation. I’ll definitely try to create proper CMake files before the final 0.2.0 release. The relevant Find-Scripts, FindOpenCL — CMake 3.1.3 Documentation and FindJava — CMake 3.1.3 Documentation , should make this easy.

Sorry for the hassle with trying to build it. I hope that this will work more smoothly with CMake.

[QUOTE=Marco13]
When there is no CL 2.0 SDK on MacOS, I doubt that it will be possible to compile it. [/QUOTE]

That may have been wrong. In fact, it does not link against the OpenCL library. Due to the ICD and the way that the implementations are resolved, it should actually be possible to compile it, even when only the headers are available.

I have created a CMake file. Until now, I could only test it on Windows. If someone would like (or be so friendly :)) to test it on Linux as well before it replaces the current makefile: I have temporarily uploaded it to
http://jocl.org/JOCL%20build%20scripts.zip

And for the case that someone would like (or be so friendly :)) to test it on a Mac, where OpenCL 2.0 is not yet available, I have packed the CL 2.0 headers from Khronos into this archive for convenience:
http://jocl.org/OpenCL%202.0%20Headers.zip

I tested it on Fedora 21. Unfortunately the installed OpenCL Headers at Fedora are Version 1.2. So “find_package(OpenCL REQUIRED)” did not work. If I use “include_directories(…)” instead, with the headers you provide, it compiles fine. I don’t know if there is a better way.

(I don’t tested the resulting libJOCL-linux-x86_64.so)

Viele Grüße
Fancy

May I suggest then to add the appropriate OpenCL headers to the project itself, so the actual build does not depend on the external configuration of the OS at all?

It may also be a good thing if the official github repo (I believe it is GitHub - gpu/JOCL: Java bindings for OpenCL) figures prominently on the org.jocl page. the current situation is that the info on building the project is scattered and not clear, and that poses problems for people that might want to help and contribute builds, examples, fix bugs etc. If there was automatic build that just works, you would probably just get prepared patches for most stuff that you are bugged about now :slight_smile:

Did the find-script itself not work, or did it not find the right headers? (I’m not sure when „FindOpenCL“ was added to CMake, so it may depend on the version…)

I’ll probably do that, it may simplify things (maybe one doesn’t even need FindOpenCL any more)

Yes, that’s something I also considered recently. When I created the GitHub repo, I basically only created it because a public repo was necessary for Maven. The „primary distribution“ was still the website (and the GIT repo and my actual (development) SVN repo are still separated here locally :-o ). However, I agree that this can be improved.

BTW: The automatic build with Maven „just works“ … unless one sets up a new PC, where the whole toolchain, SSL and GPG keys etc. have to be renewed… But that’s done now, and a public repo, with working build scripts for the native part, and a proper POM (maybe, one day, even with this Native-Plugin thing…) are certainly desirable.

Here is the cmake output and yum info about the installed versions:

[spoiler][mschorn@cube JOCL-0.2.0-RC-src]$ yum info opencl-headers
Loaded plugins: langpacks
Installed Packages
Name : opencl-headers
Arch : noarch
Version : 1.2
Release : 6.fc21
Size : 404 k
Repo : installed
From repo : fedora
Summary : Khronos OpenCL development headers
URL : Khronos OpenCL Registry
License : MIT
Description : Khronos OpenCL development headers

[mschorn@cube JOCL-0.2.0-RC-src]$ yum info cmake
Loaded plugins: langpacks
Installed Packages
Name : cmake
Arch : x86_64
Version : 3.0.2
Release : 2.fc21
Size : 19 M
Repo : installed
From repo : fedora
Summary : Cross-platform make system
URL : CMake
License : BSD and MIT and zlib
Description : CMake is used to control the software compilation process using simple
: platform and compiler independent configuration files. CMake generates
: native makefiles and workspaces that can be used in the compiler
: environment of your choice. CMake is quite sophisticated: it is possible
: to support complex environments requiring system configuration, preprocessor
: generation, code generation, and template instantiation.

[mschorn@cube JOCL-0.2.0-RC-src]$ cmake JOCLJNI/
– 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
CMake Error at CMakeLists.txt:17 (find_package):
By not providing “FindOpenCL.cmake” in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by “OpenCL”, but
CMake did not find one.

Could not find a package configuration file provided by “OpenCL” with any
of the following names:

OpenCLConfig.cmake
opencl-config.cmake

Add the installation prefix of “OpenCL” to CMAKE_PREFIX_PATH or set
“OpenCL_DIR” to a directory containing one of the above files. If “OpenCL”
provides a separate development package or SDK, be sure it has been
installed.

– Configuring incomplete, errors occurred!
[/spoiler]

Viele Grüße
Fancy

OK, I checked this: FindOpenCL was not available in CMake 3.0.x (but is available in CMake 3.1.x). I guess this will be resolved when I add the headers to the source code (otherwise, I would have to change the required CMake version to 3.1, but this should not be necessary then).

I just pushed the corresponding chages to https://github.com/gpu/JOCL

The CMake files now should cause the native libraries to be placed into the “nativeLibs” directory, where they can be collected during the Maven build. Additionally, I added the CL headers, so there should no longer be dependencies to any CL installation at compile time.

(However, the project structure, with my local repo and the git repo, definitely needs a cleanup. Maybe I can allocate a chunk of time for that, and have a look at the native Maven plugin)

There seems to be some case-sensitive problems on Linux:

[mschorn@cube Downloads]$ 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
[mschorn@cube Downloads]$ 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
In file included from /home/mschorn/Downloads/JOCL/src/main/native/JOCLCommon.hpp:44:0,
                 from /home/mschorn/Downloads/JOCL/src/main/native/JOCL.cpp:35:
/home/mschorn/Downloads/JOCL/src/main/include/cl/opencl.h:42:19: fatal error: CL/cl.h: No such file or directory
 #include <CL/cl.h>
                   ^
compilation terminated.
CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/build.make:54: recipe for target 'CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main/native/JOCL.cpp.o' failed
make[2]: *** [CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main/native/JOCL.cpp.o] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/all' failed
make[1]: *** [CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2

I rename the cl directory to CL, but got another error message:

[mschorn@cube Downloads]$ mv JOCL/src/main/include/cl/ JOCL/src/main/include/CL
[mschorn@cube Downloads]$ 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
In file included from /home/mschorn/Downloads/JOCL/src/main/native/JOCL.cpp:35:0:
/home/mschorn/Downloads/JOCL/src/main/native/JOCLCommon.hpp:44:27: fatal error: cl/opencl.h: No such file or directory
     #include <cl/opencl.h>
                           ^
compilation terminated.
CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/build.make:54: recipe for target 'CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main/native/JOCL.cpp.o' failed
make[2]: *** [CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main/native/JOCL.cpp.o] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/all' failed
make[1]: *** [CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2

Another problem is: If I had the system OpenCL headers installed, they would be preferred. Which result in lots of “‘clEnqueueSVMUnmapFP’ was not declared in this scope”.

Viele Grüße
Fancy

Aw carp :-/ I have updated the headers for case sensitive systems (I should have thought of that, embarassing). However, I’m not sure how to force him to pick up the right headers. I thought that when the directory is explicitly given (in the CMake files), then it should only find the headers there (although I’m not familiar with any resolution strategies that GCC might use there…)

Now it compiles fine - even with the opencl system headers installed. Maybe because he found now all files, he is working with these files only.

Full compile
[spoiler]

[mschorn@cube Temp]$ yum info opencl-headers
Loaded plugins: langpacks
Installed Packages
Name        : opencl-headers
Arch        : noarch
Version     : 1.2
Release     : 6.fc21
Size        : 404 k
Repo        : installed
From repo   : fedora
Summary     : Khronos OpenCL development headers
URL         : http://www.khronos.org/registry/cl/
License     : MIT
Description : Khronos OpenCL development headers

[mschorn@cube Temp]$ git clone https://github.com/gpu/JOCL.git
Cloning into 'JOCL'...
remote: Counting objects: 586, done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 586 (delta 6), reused 0 (delta 0), pack-reused 563
Receiving objects: 100% (586/586), 585.69 KiB | 400.00 KiB/s, done.
Resolving deltas: 100% (341/341), 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_clGetDeviceIDsNative(JNIEnv*, jclass, jobject, jlong, jint, jobjectArray, jintArray)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:717:40: warning: converting to non-pointer type ‘cl_device_type {aka long unsigned int}’ from NULL [-Wconversion-null]
     cl_device_type nativeDevice_type = NULL;
                                        ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:737: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: In function ‘jint Java_org_jocl_CL_clGetDeviceInfoNative(JNIEnv*, jclass, jobject, jint, jlong, jobject, jlongArray)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:793:39: warning: converting to non-pointer type ‘cl_device_info {aka unsigned int}’ from NULL [-Wconversion-null]
     cl_device_info nativeParam_name = NULL;
                                       ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp: In function ‘_jobject* Java_org_jocl_CL_clCreateContextFromTypeNative(JNIEnv*, jclass, jobject, jlong, jobject, jobject, jintArray)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:1093:40: warning: converting to non-pointer type ‘cl_device_type {aka long unsigned int}’ from NULL [-Wconversion-null]
     cl_device_type nativeDevice_type = NULL;
                                        ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp: In function ‘jint Java_org_jocl_CL_clGetContextInfoNative(JNIEnv*, jclass, jobject, jint, jlong, jobject, jlongArray)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:1222:40: warning: converting to non-pointer type ‘cl_context_info {aka unsigned int}’ from NULL [-Wconversion-null]
     cl_context_info nativeParam_name = NULL;
                                        ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp: In function ‘jint Java_org_jocl_CL_clGetCommandQueueInfoNative(JNIEnv*, jclass, jobject, jint, jlong, jobject, jlongArray)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:1448:46: warning: converting to non-pointer type ‘cl_command_queue_info {aka unsigned int}’ from NULL [-Wconversion-null]
     cl_command_queue_info nativeParam_name = NULL;
                                              ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp: In function ‘_jobject* Java_org_jocl_CL_clCreateBufferNative(JNIEnv*, jclass, jobject, jlong, jlong, jobject, jintArray)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:1545:32: warning: converting to non-pointer type ‘cl_mem_flags {aka long unsigned int}’ from NULL [-Wconversion-null]
     cl_mem_flags nativeFlags = NULL;
                                ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp: In function ‘_jobject* Java_org_jocl_CL_clCreateSubBufferNative(JNIEnv*, jclass, jobject, jlong, jint, jobject, jintArray)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:1617:32: warning: converting to non-pointer type ‘cl_mem_flags {aka long unsigned int}’ from NULL [-Wconversion-null]
     cl_mem_flags nativeFlags = NULL;
                                ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp: In function ‘_jobject* Java_org_jocl_CL_clCreateSubBuffer2Native(JNIEnv*, jclass, jobject, jlong, jint, jobject, jintArray)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:1684:32: warning: converting to non-pointer type ‘cl_mem_flags {aka long unsigned int}’ from NULL [-Wconversion-null]
     cl_mem_flags nativeFlags = NULL;
                                ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp: In function ‘_jobject* Java_org_jocl_CL_clCreateImageNative(JNIEnv*, jclass, jobject, jlong, jobject, jobject, jobject, jintArray)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:1751:32: warning: converting to non-pointer type ‘cl_mem_flags {aka long unsigned int}’ from NULL [-Wconversion-null]
     cl_mem_flags nativeFlags = NULL;
                                ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp: In function ‘_jobject* Java_org_jocl_CL_clCreateImage2DNative(JNIEnv*, jclass, jobject, jlong, jobjectArray, jlong, jlong, jlong, jobject, jintArray)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:1893:32: warning: converting to non-pointer type ‘cl_mem_flags {aka long unsigned int}’ from NULL [-Wconversion-null]
     cl_mem_flags nativeFlags = NULL;
                                ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp: In function ‘_jobject* Java_org_jocl_CL_clCreateImage3DNative(JNIEnv*, jclass, jobject, jlong, jobjectArray, jlong, jlong, jlong, jlong, jlong, jobject, jintArray)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:1983:32: warning: converting to non-pointer type ‘cl_mem_flags {aka long unsigned int}’ from NULL [-Wconversion-null]
     cl_mem_flags nativeFlags = NULL;
                                ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp: In function ‘jint Java_org_jocl_CL_clGetSupportedImageFormatsNative(JNIEnv*, jclass, jobject, jlong, jint, jint, jobjectArray, jintArray)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:2130:32: warning: converting to non-pointer type ‘cl_mem_flags {aka long unsigned int}’ from NULL [-Wconversion-null]
     cl_mem_flags nativeFlags = NULL;
                                ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp: In function ‘jint Java_org_jocl_CL_clSetMemObjectDestructorCallbackNative(JNIEnv*, jclass, jobject, jobject, jobject)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:2370: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: In function ‘_jobject* Java_org_jocl_CL_clSVMAllocNative(JNIEnv*, jclass, jobject, jlong, jlong, jint)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:2404:32: warning: converting to non-pointer type ‘cl_mem_flags {aka long unsigned int}’ from NULL [-Wconversion-null]
     cl_mem_flags nativeFlags = NULL;
                                ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp: In function ‘jint Java_org_jocl_CL_clBuildProgramNative(JNIEnv*, jclass, jobject, jint, jobjectArray, jstring, jobject, jobject)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:3079: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:3096: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: In function ‘jint Java_org_jocl_CL_clCreateKernelsInProgramNative(JNIEnv*, jclass, jobject, jint, jobjectArray, jintArray)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:3584: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: In function ‘jint Java_org_jocl_CL_clSetEventCallbackNative(JNIEnv*, jclass, jobject, jint, jobject, jobject)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:4228: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: In function ‘_jobject* Java_org_jocl_CL_clEnqueueMapBufferNative(JNIEnv*, jclass, jobject, jobject, jboolean, jlong, jlong, jlong, jint, jobjectArray, jobject, jintArray)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:5633:23: warning: converting to non-pointer type ‘size_t {aka long unsigned int}’ from NULL [-Wconversion-null]
     size_t nativeCb = NULL;
                       ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp: In function ‘jint Java_org_jocl_CL_clEnqueueMigrateMemObjectsNative(JNIEnv*, jclass, jobject, jint, jobjectArray, jlong, jint, jobjectArray, jobject)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:5890: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: 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;
                    ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp: In function ‘jint Java_org_jocl_CL_clEnqueueSVMFreeNative(JNIEnv*, jclass, jobject, jint, jobjectArray, jobject, jobject, jint, jobjectArray, jobject)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:6364: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:6374: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: In function ‘jint Java_org_jocl_CL_clEnqueueAcquireGLObjectsNative(JNIEnv*, jclass, jobject, jint, jobjectArray, jint, jobjectArray, jobject)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:7173: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: In function ‘jint Java_org_jocl_CL_clEnqueueReleaseGLObjectsNative(JNIEnv*, jclass, jobject, jint, jobjectArray, jint, jobjectArray, jobject)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/JOCL.cpp:7236: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
/home/mschorn/Downloads/Temp/JOCL/src/main/native/CLJNIUtils.cpp: In function ‘void getCl_image_format(JNIEnv*, jobject, cl_image_format&)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/CLJNIUtils.cpp:301:44: warning: converting to non-pointer type ‘cl_channel_order {aka unsigned int}’ from NULL [-Wconversion-null]
     nativeImage_format.image_channel_order = NULL;
                                            ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/CLJNIUtils.cpp:302:48: warning: converting to non-pointer type ‘cl_channel_type {aka unsigned int}’ from NULL [-Wconversion-null]
     nativeImage_format.image_channel_data_type = NULL;
                                                ^
[ 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
/home/mschorn/Downloads/Temp/JOCL/src/main/native/FunctionPointerUtils_Win.cpp:98:8: warning: extra tokens at end of #endif directive
 #endif _WIN32
        ^
[ 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
/home/mschorn/Downloads/Temp/JOCL/src/main/native/PointerUtils.cpp: In function ‘PointerData* initPointerData(JNIEnv*, jobject)’:
/home/mschorn/Downloads/Temp/JOCL/src/main/native/PointerUtils.cpp:126:31: warning: converting to non-pointer type ‘long int’ from NULL [-Wconversion-null]
     pointerData->startPointer = NULL;
                               ^
/home/mschorn/Downloads/Temp/JOCL/src/main/native/PointerUtils.cpp:127:26: warning: converting to non-pointer type ‘long int’ from NULL [-Wconversion-null]
     pointerData->pointer = NULL;
                          ^
Linking CXX shared library 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  libJOCL_0_2_0-linux-x86_64.so  Makefile
[mschorn@cube Temp]$ cd JOCL/
[mschorn@cube JOCL]$ ls
CMake_c_flag_overrides.cmake  CMake_cxx_flag_overrides.cmake  CMakeLists.txt  LICENSE.TXT  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] skip non existing resourceDirectory /home/mschorn/Downloads/Temp/JOCL/nativeLibs
[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: 6.504 s
[INFO] Finished at: 2015-06-03T12:25:29+02:00
[INFO] Final Memory: 21M/294M
[INFO] ------------------------------------------------------------------------
[mschorn@cube JOCL]$ 

[/spoiler]

But the jar does not contain the native files (maven-resources-plugin: skip non existing resourceDirectory). Cross compiling is fun for every day. :wink:

Viele Grüße
Fancy

OK, the most important thing for now is that the native compilation works (although I have to get rid of these warnings). Assembling this into a JAR is a different story.

He writes the “libJOCL_0_2_0-linux-x86_64.so” into the project root directory, is this right?

The so file is in the same directory as the JOCL directory (one above the pom.xml).

Full directory content
[spoiler]

[mschorn@cube Temp]$ pwd
/home/mschorn/Downloads/Temp
[mschorn@cube Temp]$ ls -R
.:
CMakeCache.txt  CMakeFiles  cmake_install.cmake  JOCL  libJOCL_0_2_0-linux-x86_64.so  Makefile

./CMakeFiles:
3.0.2              CMakeDirectoryInformation.cmake  CMakeTmp                     Makefile2       progress.marks
cmake.check_cache  CMakeOutput.log                  JOCL_0_2_0-linux-x86_64.dir  Makefile.cmake  TargetDirectories.txt

./CMakeFiles/3.0.2:
CMakeCCompiler.cmake    CMakeDetermineCompilerABI_C.bin    CMakeSystem.cmake  CompilerIdCXX
CMakeCXXCompiler.cmake  CMakeDetermineCompilerABI_CXX.bin  CompilerIdC

./CMakeFiles/3.0.2/CompilerIdC:
a.out  CMakeCCompilerId.c

./CMakeFiles/3.0.2/CompilerIdCXX:
a.out  CMakeCXXCompilerId.cpp

./CMakeFiles/CMakeTmp:

./CMakeFiles/JOCL_0_2_0-linux-x86_64.dir:
build.make  cmake_clean.cmake  CXX.includecache  DependInfo.cmake  depend.internal  depend.make  flags.make  link.txt  progress.make  src

./CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src:
main

./CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main:
native

./CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main/native:
CLFunctions.cpp.o  FunctionPointerUtils.cpp.o        FunctionPointerUtils_Win.cpp.o  JOCL.cpp.o    PointerUtils.cpp.o
CLJNIUtils.cpp.o   FunctionPointerUtils_Linux.cpp.o  JNIUtils.cpp.o                  Logger.cpp.o

./JOCL:
CMake_c_flag_overrides.cmake  CMake_cxx_flag_overrides.cmake  CMakeLists.txt  LICENSE.TXT  pom.xml  Readme.txt  src  target

./JOCL/src:
main

./JOCL/src/main:
include  java  native

./JOCL/src/main/include:
CL

./JOCL/src/main/include/CL:
cl_d3d10.h  cl_d3d11.h  cl_dx9_media_sharing.h  cl_egl.h  cl_ext.h  cl_gl_ext.h  cl_gl.h  cl.h  cl_platform.h  opencl.h

./JOCL/src/main/java:
org

./JOCL/src/main/java/org:
jocl

./JOCL/src/main/java/org/jocl:
BuildProgramFunction.java          CLException.java         cl_queue_properties.java          MemObjectDestructorCallbackFunction.java
cl_abstract_properties.java        cl_image_desc.java       cl_sampler.java                   NativePointerObject.java
cl_buffer_region.java              cl_image_format.java     cl_sampler_properties.java        Pointer.java
cl_command_queue.java              CL.java                  CreateContextFunction.java        PrintfCallbackFunction.java
cl_context.java                    cl_kernel.java           EnqueueNativeKernelFunction.java  Sizeof.java
cl_context_properties.java         cl_mem.java              EventCallbackFunction.java        SVMFreeFunction.java
cl_device_id.java                  cl_pipe_properties.java  LibInitializer.java
cl_device_partition_property.java  cl_platform_id.java      LibTracker.java
cl_event.java                      cl_program.java          LibUtils.java

./JOCL/src/main/native:
CLFunctions.cpp  CLJNIUtils.hpp            FunctionPointerUtils_Linux.cpp  JNIUtils.hpp    JOCL.hpp    PointerUtils.cpp
CLFunctions.hpp  FunctionPointerUtils.cpp  FunctionPointerUtils_Win.cpp    JOCLCommon.hpp  Logger.cpp  PointerUtils.hpp
CLJNIUtils.cpp   FunctionPointerUtils.hpp  JNIUtils.cpp                    JOCL.cpp        Logger.hpp

./JOCL/target:
apidocs  javadoc-bundle-options        jocl-0.2.0-RC01-SNAPSHOT-javadoc.jar  maven-archiver
classes  jocl-0.2.0-RC01-SNAPSHOT.jar  jocl-0.2.0-RC01-SNAPSHOT-sources.jar

./JOCL/target/apidocs:
allclasses-frame.html    constant-values.html  help-doc.html   index.html  overview-tree.html  script.js             stylesheet.css
allclasses-noframe.html  deprecated-list.html  index-all.html  org         package-list        serialized-form.html

./JOCL/target/apidocs/org:
jocl

./JOCL/target/apidocs/org/jocl:
BuildProgramFunction.html          CLException.html         cl_program.html                           package-frame.html
class-use                          CL.html                  cl_queue_properties.html                  package-summary.html
cl_buffer_region.html              cl_image_desc.html       cl_sampler.html                           package-tree.html
cl_command_queue.html              cl_image_format.html     cl_sampler_properties.html                package-use.html
cl_context.html                    cl_kernel.html           CreateContextFunction.html                Pointer.html
cl_context_properties.html         CL.LogLevel.html         EnqueueNativeKernelFunction.html          PrintfCallbackFunction.html
cl_device_id.html                  cl_mem.html              EventCallbackFunction.html                Sizeof.html
cl_device_partition_property.html  cl_pipe_properties.html  MemObjectDestructorCallbackFunction.html  SVMFreeFunction.html
cl_event.html                      cl_platform_id.html      NativePointerObject.html

./JOCL/target/apidocs/org/jocl/class-use:
BuildProgramFunction.html          CLException.html         cl_platform_id.html               MemObjectDestructorCallbackFunction.html
cl_buffer_region.html              CL.html                  cl_program.html                   NativePointerObject.html
cl_command_queue.html              cl_image_desc.html       cl_queue_properties.html          Pointer.html
cl_context.html                    cl_image_format.html     cl_sampler.html                   PrintfCallbackFunction.html
cl_context_properties.html         cl_kernel.html           cl_sampler_properties.html        Sizeof.html
cl_device_id.html                  CL.LogLevel.html         CreateContextFunction.html        SVMFreeFunction.html
cl_device_partition_property.html  cl_mem.html              EnqueueNativeKernelFunction.html
cl_event.html                      cl_pipe_properties.html  EventCallbackFunction.html

./JOCL/target/classes:
org

./JOCL/target/classes/org:
jocl

./JOCL/target/classes/org/jocl:
BuildProgramFunction.class    cl_device_partition_property.class  cl_queue_properties.class          LibUtils.class
CL$1.class                    cl_event.class                      cl_sampler.class                   LibUtils$OSType.class
CL$2.class                    CLException.class                   cl_sampler_properties.class        MemObjectDestructorCallbackFunction.class
CL$3.class                    cl_image_desc.class                 CreateContextFunction.class        NativePointerObject.class
cl_abstract_properties.class  cl_image_format.class               EnqueueNativeKernelFunction.class  Pointer.class
cl_buffer_region.class        cl_kernel.class                     EventCallbackFunction.class        PrintfCallbackFunction.class
CL.class                      CL$LogLevel.class                   LibInitializer.class               Sizeof.class
cl_command_queue.class        cl_mem.class                        LibTracker$1.class                 SVMFreeFunction.class
cl_context.class              cl_pipe_properties.class            LibTracker.class
cl_context_properties.class   cl_platform_id.class                LibUtils$1.class
cl_device_id.class            cl_program.class                    LibUtils$ARCHType.class

./JOCL/target/javadoc-bundle-options:
javadoc-options-javadoc-resources.xml

./JOCL/target/maven-archiver:
pom.properties

[/spoiler]

Viele Grüße
Fancy

That’s wierd. I just tried it again, and it places the native library into the „root/nativeLibs“ directory. That’s what it should to, according to the line

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/nativeLibs)

Any idea why it might not pick this up?

Meh, …
[spoiler]
… just copy the file manually. Who cares.
ducks and covers :wink:
[/spoiler]

I tried to fix the warnings, BTW. Also changed the Warning level for VS to „/Wall“, and it spilled out hundreds of signed/unsigned-mismatch warnings, but not the conversion warnings that the GCC (rightfully!) complained about.

I herewith publicly question the sanity of everybody who thinks that the type system in C/C++, and particularly these implicit conversions, even **remotely** make sense.

further provocations (particularly targeting pretentiously geeky C++ programmers, who should use JavaScript if they don’t want type safety) are omitted here (well, most of them ;-))

Okay, I played a little and added set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/nativeLibs) to the CMakeLists.txt.

The .so file is now placed at JOCL/nativeLibs and collected by maven.

Full build
[spoiler]

[mschorn@cube Temp2]$ git clone https://github.com/gpu/JOCL.git
Cloning into 'JOCL'...
remote: Counting objects: 599, done.
remote: Compressing objects: 100% (31/31), done.
remote: Total 599 (delta 10), reused 0 (delta 0), pack-reused 563
Receiving objects: 100% (599/599), 623.73 KiB | 498.00 KiB/s, done.
Resolving deltas: 100% (345/345), done.
Checking connectivity... done.
[mschorn@cube Temp2]$ cp ../CMakeLists.txt JOCL/CMakeLists.txt 
[mschorn@cube Temp2]$ cat JOCL/CMakeLists.txt 
cmake_minimum_required(VERSION 2.8)

# Overriding the CMake flags to use static runtime libraries
# See http://www.cmake.org/Wiki/CMake_FAQ#
#     How_can_I_build_my_MSVC_application_with_a_static_runtime.3F
set(CMAKE_USER_MAKE_RULES_OVERRIDE
   ${CMAKE_CURRENT_SOURCE_DIR}/CMake_c_flag_overrides.cmake)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
   ${CMAKE_CURRENT_SOURCE_DIR}/CMake_cxx_flag_overrides.cmake)
   
project(JOCL)

set(JOCL_VERSION "0_2_0")

set(CMAKE_MODULE_PATH 
  "${CMAKE_SOURCE_DIR}/CMake"
  ${CMAKE_MODULE_PATH})

find_package(JNI REQUIRED)

if(CMAKE_HOST_WIN32)
  set(CMAKE_HOST "windows")
elseif(CMAKE_HOST_APPLE)
  set(CMAKE_HOST "apple")
  set(CMAKE_SKIP_RPATH FALSE)
elseif(CMAKE_HOST_UNIX)
  set(CMAKE_HOST "linux")
endif()

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
  set(CMAKE_ARCH "x86_64")
else()
  set(CMAKE_ARCH "x86")
endif()

if(MSVC)
    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall /wd4514 /wd4820 /wd4710 /wd4711 /wd4350 /wd4668")
endif()

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG   ${PROJECT_SOURCE_DIR}/nativeLibs/Debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/nativeLibs)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/nativeLibs)

set(BUILD_SHARED_LIBS ON)

include_directories(
  src/main/native
  src/main/include/
  ${JNI_INCLUDE_DIRS}
)
  
add_library(JOCL_${JOCL_VERSION}-${CMAKE_HOST}-${CMAKE_ARCH}
  src/main/native/JOCL.cpp 
  src/main/native/Logger.cpp 
  src/main/native/CLJNIUtils.cpp 
  src/main/native/CLFunctions.cpp 
  src/main/native/FunctionPointerUtils.cpp 
  src/main/native/FunctionPointerUtils_Linux.cpp 
  src/main/native/FunctionPointerUtils_Win.cpp 
  src/main/native/JNIUtils.cpp 
  src/main/native/PointerUtils.cpp
)
[mschorn@cube Temp2]$ 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/Temp2
[mschorn@cube Temp2]$ 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/Temp2/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/Temp2/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/Temp2/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 Temp2]$ ls
CMakeCache.txt  CMakeFiles  cmake_install.cmake  JOCL  Makefile
[mschorn@cube Temp2]$ 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/Temp2/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/Temp2/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/Temp2/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/Temp2/JOCL/../../nativeLibs
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ jocl ---
[INFO] Building jar: /home/mschorn/Downloads/Temp2/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/Temp2/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/Temp2/JOCL/target/apidocs/org/jocl/BuildProgramFunction.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/CL.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/cl_buffer_region.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/cl_command_queue.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/cl_context.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/cl_context_properties.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/cl_device_id.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/cl_device_partition_property.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/cl_event.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/cl_image_desc.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/cl_image_format.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/cl_kernel.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/cl_mem.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/cl_pipe_properties.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/cl_platform_id.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/cl_program.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/cl_queue_properties.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/cl_sampler.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/cl_sampler_properties.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/CL.LogLevel.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/CLException.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/CreateContextFunction.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/EnqueueNativeKernelFunction.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/EventCallbackFunction.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/MemObjectDestructorCallbackFunction.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/NativePointerObject.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/Pointer.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/PrintfCallbackFunction.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/Sizeof.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/SVMFreeFunction.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/package-frame.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/package-summary.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/package-tree.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/constant-values.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/serialized-form.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/cl_device_id.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/EnqueueNativeKernelFunction.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/NativePointerObject.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/MemObjectDestructorCallbackFunction.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/cl_pipe_properties.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/CLException.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/EventCallbackFunction.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/cl_context_properties.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/cl_device_partition_property.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/cl_image_format.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/cl_context.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/cl_kernel.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/cl_sampler.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/PrintfCallbackFunction.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/BuildProgramFunction.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/cl_mem.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/SVMFreeFunction.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/cl_sampler_properties.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/cl_image_desc.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/cl_buffer_region.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/cl_command_queue.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/cl_program.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/CreateContextFunction.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/Pointer.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/cl_queue_properties.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/Sizeof.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/CL.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/CL.LogLevel.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/cl_platform_id.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/class-use/cl_event.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/org/jocl/package-use.html...
Building index for all the packages and classes...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/overview-tree.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/index-all.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/deprecated-list.html...
Building index for all classes...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/allclasses-frame.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/allclasses-noframe.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/index.html...
Generating /home/mschorn/Downloads/Temp2/JOCL/target/apidocs/help-doc.html...
[INFO] Building jar: /home/mschorn/Downloads/Temp2/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/Temp2/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/Temp2/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/Temp2/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/Temp2/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: 9.194 s
[INFO] Finished at: 2015-06-03T20:06:53+02:00
[INFO] Final Memory: 21M/293M
[INFO] ------------------------------------------------------------------------
[mschorn@cube JOCL]$ cd ..

[/spoiler]

Then I tested the JOCLSample. Unfortunately I run into a Could not load libOpenCL.so, error libOpenCL.so: cannot open shared object file: No such file or directory. I have only the open source mesa driver installed and my lib folder contains only a libOpenCL.so.1. But, a quick and very dirty hack brings it to life.

Full test
[spoiler]

[mschorn@cube Temp2]$ mkdir -p org/jocl/samples/
[mschorn@cube Temp2]$ wget http://www.jocl.org/samples/JOCLSample.java
--2015-06-03 20:16:44--  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-03 20:16:44 (114 KB/s) - ‘JOCLSample.java’ saved [5827/5827]

[mschorn@cube Temp2]$ mv JOCLSample.java org/jocl/samples/JOCLSample.java
[mschorn@cube Temp2]$ 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 Temp2]$ java -cp JOCL/target/jocl-0.2.0-RC01-SNAPSHOT.jar:. org.jocl.samples.JOCLSample
Could not load libOpenCL.so, error libOpenCL.so: cannot open shared object file: No such file or directory
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not initialize native library. Implementation library 'libOpenCL.so' could not be loaded
	at org.jocl.LibInitializer.initNativeLibrary(LibInitializer.java:51)
	at org.jocl.CL.<clinit>(CL.java:51)
	at org.jocl.samples.JOCLSample.main(JOCLSample.java:60)
[mschorn@cube Temp2]$ ls /lib64/libOpenC
libOpenCL.so.1                           libOpenCOLLADABaseUtils.so.0.2           libOpenCOLLADASaxFrameworkLoader.so.0.2
libOpenCL.so.1.0.0                       libOpenCOLLADAFramework.so.0.2           libOpenCOLLADAStreamWriter.so.0.2
[mschorn@cube Temp2]$ sudo cp /lib64/libOpenCL.so.1 /lib64/libOpenCL.so
[mschorn@cube Temp2]$ 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 Temp2]$ sudo rm /lib64/libOpenCL.so

[/spoiler]

Maybe this is an issue with my pc, or mesa, or room for improvement. I don’t know.

Viele Grüße
Fancy

Great, I’ll add the corresponding lines (debug/release).

One would have to read loooots of CMake docu before being able to figure something like this. And that’s no fun:

Executables are always treated as runtime targets. Static libraries are always treated as archive targets. Module libraries are always treated as library targets. For non-DLL platforms shared libraries are treated as library targets. For DLL platforms the DLL part of a shared library is treated as a runtime target and the corresponding import library is treated as an archive target. All Windows-based systems including Cygwin are DLL platforms.

:verzweifel: sure

However: What is this „quick hack“ that you talked about?

I think, he doesn’t like the debug/release (.so is again in the wrong place):

Build
[spoiler]

[mschorn@cube ~]$ cd Downloads/
[mschorn@cube Downloads]$ mkdir Temp3
[mschorn@cube Downloads]$ cd Temp3
[mschorn@cube Temp3]$ git clone https://github.com/gpu/JOCL.git
Cloning into 'JOCL'...
remote: Counting objects: 602, done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 602 (delta 12), reused 0 (delta 0), pack-reused 563
Receiving objects: 100% (602/602), 623.98 KiB | 430.00 KiB/s, done.
Resolving deltas: 100% (347/347), done.
Checking connectivity... done.
[mschorn@cube Temp3]$ 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/Temp3
[mschorn@cube Temp3]$ 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/Temp3/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/Temp3/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/Temp3/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 libJOCL_0_2_0-linux-x86_64.so
[100%] Built target JOCL_0_2_0-linux-x86_64
[mschorn@cube Temp3]$ ls
CMakeCache.txt  CMakeFiles  cmake_install.cmake  JOCL  libJOCL_0_2_0-linux-x86_64.so  Makefile
[mschorn@cube Temp3]$ ls -R
.:
CMakeCache.txt  CMakeFiles  cmake_install.cmake  JOCL  libJOCL_0_2_0-linux-x86_64.so  Makefile

./CMakeFiles:
3.0.2              CMakeDirectoryInformation.cmake  CMakeTmp                     Makefile2       progress.marks
cmake.check_cache  CMakeOutput.log                  JOCL_0_2_0-linux-x86_64.dir  Makefile.cmake  TargetDirectories.txt

./CMakeFiles/3.0.2:
CMakeCCompiler.cmake    CMakeDetermineCompilerABI_C.bin    CMakeSystem.cmake  CompilerIdCXX
CMakeCXXCompiler.cmake  CMakeDetermineCompilerABI_CXX.bin  CompilerIdC

./CMakeFiles/3.0.2/CompilerIdC:
a.out  CMakeCCompilerId.c

./CMakeFiles/3.0.2/CompilerIdCXX:
a.out  CMakeCXXCompilerId.cpp

./CMakeFiles/CMakeTmp:

./CMakeFiles/JOCL_0_2_0-linux-x86_64.dir:
build.make  cmake_clean.cmake  CXX.includecache  DependInfo.cmake  depend.internal  depend.make  flags.make  link.txt  progress.make  src

./CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src:
main

./CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main:
native

./CMakeFiles/JOCL_0_2_0-linux-x86_64.dir/src/main/native:
CLFunctions.cpp.o  FunctionPointerUtils.cpp.o        FunctionPointerUtils_Win.cpp.o  JOCL.cpp.o    PointerUtils.cpp.o
CLJNIUtils.cpp.o   FunctionPointerUtils_Linux.cpp.o  JNIUtils.cpp.o                  Logger.cpp.o

./JOCL:
CMake_c_flag_overrides.cmake  CMake_cxx_flag_overrides.cmake  CMakeLists.txt  LICENSE.TXT  pom.xml  Readme.txt  src

./JOCL/src:
main

./JOCL/src/main:
include  java  native

./JOCL/src/main/include:
CL

./JOCL/src/main/include/CL:
cl_d3d10.h  cl_d3d11.h  cl_dx9_media_sharing.h  cl_egl.h  cl_ext.h  cl_gl_ext.h  cl_gl.h  cl.h  cl_platform.h  opencl.h

./JOCL/src/main/java:
org

./JOCL/src/main/java/org:
jocl

./JOCL/src/main/java/org/jocl:
BuildProgramFunction.java          CLException.java         cl_queue_properties.java          MemObjectDestructorCallbackFunction.java
cl_abstract_properties.java        cl_image_desc.java       cl_sampler.java                   NativePointerObject.java
cl_buffer_region.java              cl_image_format.java     cl_sampler_properties.java        Pointer.java
cl_command_queue.java              CL.java                  CreateContextFunction.java        PrintfCallbackFunction.java
cl_context.java                    cl_kernel.java           EnqueueNativeKernelFunction.java  Sizeof.java
cl_context_properties.java         cl_mem.java              EventCallbackFunction.java        SVMFreeFunction.java
cl_device_id.java                  cl_pipe_properties.java  LibInitializer.java
cl_device_partition_property.java  cl_platform_id.java      LibTracker.java
cl_event.java                      cl_program.java          LibUtils.java

./JOCL/src/main/native:
CLFunctions.cpp  CLJNIUtils.hpp            FunctionPointerUtils_Linux.cpp  JNIUtils.hpp    JOCL.hpp    PointerUtils.cpp
CLFunctions.hpp  FunctionPointerUtils.cpp  FunctionPointerUtils_Win.cpp    JOCLCommon.hpp  Logger.cpp  PointerUtils.hpp
CLJNIUtils.cpp   FunctionPointerUtils.hpp  JNIUtils.cpp                    JOCL.cpp        Logger.hpp

[/spoiler]

It seems that cmake has a perfect platform independent behavior. :wink:

The quick hack was simply to (temporary) copy the libOpenCL.so.1 to libOpenCL.so. Resolves JOCL the name by itself or comes it from somewhere else? I had the same issue in my Wrappers and use something like this:

1/2 OT
[spoiler]``` case LINUX_X86_32:
case LINUX_X86_64:

            library = "libopenal.so." + major;
            if (stranger.isValid(library, "alcCreateContext"))
                break;

            library = "libopenal.so";
            if (stranger.isValid(library, "alcCreateContext"))
                break;

            throw new AlException(logger, AlException.LOAD_EXCEPTION);


But I do not know if that's a valid solution.

Viele Grüße
Fancy