title: Integrate LibOpenCL in android project
body: <p>I would like to reuse a Android Eclipse project to use OpenCL library.
  I used to setup my eclipse project for my previous phone a Samsung Alpha.
  Now I get a moto Z and I would like to modify thgis project to reuse it.</p>
  
  <p>I get the libOpenCL.so file from my phone and I juts change the file on my project but the compilation send me that error:</p>
  
  <pre><code>    [x86_64] SharedLibrary  : libJNIProcessor.so
  /home/xxxx/NVPACK/android-sdk-linux/ndk-bundle/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld: error: jni/libs/libOpenCL.so: incompatible target
  jni/include/CL/cl.hpp:1090: error: undefined reference to 'clReleaseContext'
  jni/include/CL/cl.hpp:1099: error: undefined reference to 'clReleaseCommandQueue'
  jni/include/CL/cl.hpp:1135: error: undefined reference to 'clReleaseKernel'
  jni/processor.cpp:143: error: undefined reference to 'clRetainProgram'
  jni/processor.cpp:145: error: undefined reference to 'clGetProgramInfo'
  jni/processor.cpp:147: error: undefined reference to 'clGetProgramBuildInfo'
  jni/processor.cpp:152: error: undefined reference to 'clGetProgramBuildInfo'
  jni/processor.cpp:156: error: undefined reference to 'clGetProgramBuildInfo'
  jni/processor.cpp:159: error: undefined reference to 'clReleaseProgram'
  jni/include/CL/cl.hpp:2878: error: undefined reference to 'clEnqueueWriteBuffer'
  jni/include/CL/cl.hpp:1106: error: undefined reference to 'clRetainMemObject'
  jni/include/CL/cl.hpp:2548: error: undefined reference to 'clSetKernelArg'
  jni/include/CL/cl.hpp:1108: error: undefined reference to 'clReleaseMemObject'
  jni/include/CL/cl.hpp:1106: error: undefined reference to 'clRetainMemObject'
  jni/include/CL/cl.hpp:2548: error: undefined reference to 'clSetKernelArg'
  jni/include/CL/cl.hpp:1108: error: undefined reference to 'clReleaseMemObject'
  jni/include/CL/cl.hpp:2548: error: undefined reference to 'clSetKernelArg'
  jni/include/CL/cl.hpp:2548: error: undefined reference to 'clSetKernelArg'
  jni/include/CL/cl.hpp:1106: error: undefined reference to 'clRetainMemObject'
  jni/include/CL/cl.hpp:1108: error: undefined reference to 'clReleaseMemObject'
  jni/include/CL/cl.hpp:1106: error: undefined reference to 'clRetainMemObject'
  jni/include/CL/cl.hpp:1108: error: undefined reference to 'clReleaseMemObject'
  jni/include/CL/cl.hpp:3248: error: undefined reference to 'clEnqueueNDRangeKernel'
  jni/include/CL/cl.hpp:1144: error: undefined reference to 'clReleaseEvent'
  jni/include/CL/cl.hpp:1090: error: undefined reference to 'clReleaseContext'
  jni/include/CL/cl.hpp:1088: error: undefined reference to 'clRetainContext'
  jni/include/CL/cl.hpp:1090: error: undefined reference to 'clReleaseContext'
  jni/include/CL/cl.hpp:1045: error: undefined reference to 'clGetContextInfo'
  jni/include/CL/cl.hpp:1099: error: undefined reference to 'clReleaseCommandQueue'
  jni/include/CL/cl.hpp:1097: error: undefined reference to 'clRetainCommandQueue'
  jni/include/CL/cl.hpp:1099: error: undefined reference to 'clReleaseCommandQueue'
  jni/include/CL/cl.hpp:2668: error: undefined reference to 'clBuildProgram'
  jni/include/CL/cl.hpp:2769: error: undefined reference to 'clCreateKernel'
  jni/include/CL/cl.hpp:1135: error: undefined reference to 'clReleaseKernel'
  jni/include/CL/cl.hpp:1133: error: undefined reference to 'clRetainKernel'
  jni/include/CL/cl.hpp:1135: error: undefined reference to 'clReleaseKernel'
  jni/include/CL/cl.hpp:2769: error: undefined reference to 'clCreateKernel'
  jni/include/CL/cl.hpp:1135: error: undefined reference to 'clReleaseKernel'
  jni/include/CL/cl.hpp:1133: error: undefined reference to 'clRetainKernel'
  jni/include/CL/cl.hpp:2769: error: undefined reference to 'clCreateKernel'
  jni/include/CL/cl.hpp:1133: error: undefined reference to 'clRetainKernel'
  jni/include/CL/cl.hpp:1090: error: undefined reference to 'clReleaseContext'
  jni/include/CL/cl.hpp:1099: error: undefined reference to 'clReleaseCommandQueue'
  /home/xxx/NVPACK/android-sdk-linux/ndk-bundle/build/core/build-binary.mk:702 : la recette pour la cible « obj/local/x86_64/libJNIProcessor.so » a échouée
  jni/include/CL/cl.hpp:1473: error: undefined reference to 'clGetPlatformIDs'
  jni/include/CL/cl.hpp:1480: error: undefined reference to 'clGetPlatformIDs'
  jni/include/CL/cl.hpp:1534: error: undefined reference to 'clCreateContextFromType'
  jni/include/CL/cl.hpp:2791: error: undefined reference to 'clCreateCommandQueue'
  jni/include/CL/cl.hpp:2602: error: undefined reference to 'clCreateProgramWithSource'
  jni/include/CL/cl.hpp:1126: error: undefined reference to 'clReleaseProgram'
  jni/include/CL/cl.hpp:1037: error: undefined reference to 'clGetProgramBuildInfo'
  jni/include/CL/cl.hpp:1855: error: undefined reference to 'clCreateBuffer'
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>Edit:
  I remove all OpenCL program and I just set the OpenCL lib and I get that:</p>
  
  <pre><code>x86_64-linux-android/bin/ld: error: jni/libs/libOpenCL.so: incompatible target
  /home/xxxx/NVPACK/android-sdk-linux/ndk-bundle/build/core/build-binary.mk:702 : la recette pour la cible « obj/local/x86_64/libJNIProcessor.so » a échouée
  </code></pre>
  
  <p>Edit 2:</p>
  
  <p>I finally download the NDK10e (the one I used when I first compile this project) and the build works. But on the execution I get that error on log:</p>
  
  <pre><code>02-22 10:00:41.077  7302  7302 D AndroidRuntime: Shutting down VM
  02-22 10:00:41.078  7302  7302 E AndroidRuntime: FATAL EXCEPTION: main
  02-22 10:00:41.078  7302  7302 E AndroidRuntime: Process: com.example.subsamplecamera, PID: 7302
  02-22 10:00:41.078  7302  7302 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: library "libGLES_mali.so" not found
  02-22 10:00:41.078  7302  7302 E AndroidRuntime:    at java.lang.Runtime.loadLibrary0(Runtime.java:977)
  02-22 10:00:41.078  7302  7302 E AndroidRuntime:    at java.lang.System.loadLibrary(System.java:1530)
  02-22 10:00:41.078  7302  7302 E AndroidRuntime:    at com.example.subsamplecamera.MainActivity.&lt;clinit&gt;(MainActivity.java:30)
  02-22 10:00:41.078  7302  7302 E AndroidRuntime:    at java.lang.Class.newInstance(Native Method)
  02-22 10:00:41.078  7302  7302 E AndroidRuntime:    at android.app.Instrumentation.newActivity(Instrumentation.java:1100)
  02-22 10:00:41.078  7302  7302 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2551)
  02-22 10:00:41.078  7302  7302 E AndroidRuntime:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2724)
  02-22 10:00:41.078  7302  7302 E AndroidRuntime:    at android.app.ActivityThread.-wrap12(ActivityThread.java)
  02-22 10:00:41.078  7302  7302 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1473)
  02-22 10:00:41.078  7302  7302 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:102)
  02-22 10:00:41.078  7302  7302 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:154)
  02-22 10:00:41.078  7302  7302 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:6123)
  02-22 10:00:41.078  7302  7302 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
  02-22 10:00:41.078  7302  7302 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.ru
  </code></pre>
  
  <p>But I don't have mali GPU, why the project is calling mali library</p>
  
  <p>Edit 3:
  I finally made it, the program compile properly and the app run. 
  I change the standart NDK10e to the Snapdragon LLVM and it seems to works.
  Now I add a error during the executiong of the OpenCL kernel.:</p>
  
  <pre><code>gQueue.enqueueNDRangeKernel(gNV21Kernel,
                  cl::NullRange,
                  cl::NDRange( (int)ceil((float)w/16.0f)*16,(int)ceil((float)h/16.0f)*16),
                  cl::NDRange(4,1),
                  NULL,
                  NULL);
  </code></pre>
  
  <p>I don't understand that error. Can someone help me about that?
      CL:: error -36</p>