Forums - How to use AdrenoSDK 3.4 in Android NDK r9

7 posts / 0 new
Last post
How to use AdrenoSDK 3.4 in Android NDK r9
pvrtisrp
Join Date: 28 Sep 13
Posts: 47
Posted: Mon, 2013-10-07 00:44

Hi all, I want to use AdrenoSDK 3.4 in Android NDK r9, it cannot work.

Windows 8 (64bits) + Android NDK r9 (64bits)

I directly compile the sample but it failed....

C:\AdrenoSDK\Development\Samples\OpenCL\ImageMedianFilter\Android\jni>ndk-build
Android NDK: WARNING:C:/AdrenoSDK/Development/Samples/OpenCL/ImageMedianFilter/Android//jni/Android.mk:ImageMedianFilter: 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
SharedLibrary  : libImageMedianFilter.so
 
How should I do? 
 
Thank you!!!
Cathy
  • Up0
  • Down0
khawkins Moderator
Join Date: 29 Nov 12
Location: San Diego, CA
Posts: 62
Posted: Mon, 2013-10-07 08:44

Hi,

Did you download the libOpenCL.so off your device? It looks like the linker can't find it. We have a note about this in the Browser at the top of the Samples -> OpenCL tab: 

Note: To build these samples for Android, you must obtain the libOpenCL.so driver for your device and put it in a location that can be found by your build process (e.g. NDK/platforms/android-14/arch-arm/usr/lib).

Let me know if this is not the issue.

Kevin

 

  • Up0
  • Down0
pvrtisrp
Join Date: 28 Sep 13
Posts: 47
Posted: Mon, 2013-10-07 17:54

Dear Kevin,

I copy all the files under "C:\AdrenoSDK\Development\Inc"

to my "C:\android-ndk\platforms\android-14\arch-arm\usr\include"

and download libOpenCL.so (from my device) to "C:\android-ndk\platforms\android-14\arch-arm\usr\lib"

Now it works, but I have some questions:

1. I use the included files from Adreno SDK and download libOpenCL from a random device, it will occur problems?

2. If I want to let my app can run on any Android device (with OpenCL support originally). Do I need to use their libOpenCL to re-compile my app? Or, do I need to attach my libOpenCL.so?

I assume it should be a standard interface (header files), so I should not attach my libOpenCL.so or recompile my app by new driver....

3. I use LOCAL_SHARED_LIBRARIES := libOpenCL in my Android.mk, am I right?

Why I cannot use LOCAL_LDLIBS += -lOpenCL like samples?

4. Can Adreno SDK be compiled by Snapdragon LLVM Compiler?

Thank you so much!!!

Cathy

  • Up0
  • Down0
pvrtisrp
Join Date: 28 Sep 13
Posts: 47
Posted: Wed, 2013-10-09 06:11

Dear all,

So sad....I found I still cannot use OpenCL......

I just can compile my code, but I have linking errors......

As I mentioned before, I copied the following libraries (libOpenCL.so, libllvm-a3xx.so, libgsl.so, libstlport.so, and libcutils.so)

from my mobile (Android + Snapdragon) 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???? Please...

Cathy

 

 
  • Up0
  • Down0
pvrtisrp
Join Date: 28 Sep 13
Posts: 47
Posted: Thu, 2013-10-10 22:51

Does anyone help me??? How to link libOpenCL.so?

  • Up0
  • Down0
khawkins Moderator
Join Date: 29 Nov 12
Location: San Diego, CA
Posts: 62
Posted: Mon, 2013-10-14 15:01

Hi Cathy,

Everything appears to be correct from what you've listed, but obviously something is missing or not quite right with your build environment.

Do you have

APP_STL := gnustl_static

defined in your jni/Application.mk? I'm not sure if you're using one of the SDK samples or your own application, but if you don't have this then that may be the issue. Our OpenCL samples include this line and a couple others in the makefiles that may affect system library linkage.

If that doesn't help then I would probably have to see your project environment to figure out where the problem is happening.

Kevin

 

  • Up0
  • Down0
pvrtisrp
Join Date: 28 Sep 13
Posts: 47
Posted: Mon, 2013-10-14 18:17

Thank you Kevin,

Yes, I have added it.

My device has libOpenCL.so but it cannot run OpenCL well. And, I am waiting to take another device to try again.

Could I update my OpenCL driver of my device for myself?

Cathy

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.