OpenCL in Android NDK r9

Hi all,

I cannot use OpenCL…I can compile my code with linking errors…

I have copied libOpenCL.so from my mobile (Android) to my PC folders:

C:\android-ndk\platforms\android-X\arch-arm\usr\lib, X = 18, 14, 9, 8, 5, 4, and 3

In Android.mk

If I use LOCAL_LDLIBS += -lOpenCL, it will say

non-system libraries in linker flags: -lOpenCL
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module

And, it will CRASH in the run time!!!

If I link it by LOCAL_SHARED_LIBRARIES += libOpenCL, it will cause errors like “undefined reference to `clGetPlatformIDs’.

Does anyone can help me??? How to use OpenCL? Your help would be greatly appreciated.

I don’t know exactly the issue you are running into, but I have some questions that might lead us there:

  • Do you know that OpenCL is officially supported on your device? Do you expect this to work, or are you just trying to see if it works?
  • When you run “objdump -x libOpenCL.so” on the library you copied from the device, do you see OpenCL entry points like clGetPlatformIDs?
  • What happens when you load libOpenCL.so dynamically in your Java code before your own native library using System.loadLibrary?
  • Do you know that OpenCL is officially supported on your device? Do you expect this to work, or are you just trying to see if it works?

I expect it should work.

  • When you run “objdump -x libOpenCL.so” on the library you copied from the device, do you see OpenCL entry points like clGetPlatformIDs?

I cannot check it now (I format all the device), but I think the answer is NO.

  • What happens when you load libOpenCL.so dynamically in your Java code before your own native library using System.loadLibrary?

[b]No, I did not use this way. I call it by my “.so” file.

Thank you for your reply, I just think my driver should have problem. But I don’t know how to update OpenCL driver of my Android device…[/b]