Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why cannot find <CL\opencl.h> when using Android NDK Building? #186

Open
FdyCN opened this issue Nov 22, 2021 · 2 comments
Open

Why cannot find <CL\opencl.h> when using Android NDK Building? #186

FdyCN opened this issue Nov 22, 2021 · 2 comments

Comments

@FdyCN
Copy link

FdyCN commented Nov 22, 2021

Hi guys, i got a problem. when I include opencl.hpp in my project. BUT, when i build executable for android 64 os using NDK. Here comes a compiling error, happened at this line:
image

my ndk version is : r22b
/Users/admin/Desktop/Demo/third_party/CL/opencl.hpp:530:10: fatal error: 'CL/opencl.h' file not found #include <CL/opencl.h>
i wonder why it's wrong? is there no matched head in target platform? and how can i fix it?

Please help me and thanks a lot!

@jansol
Copy link

jansol commented Jan 25, 2024

AFAIK Android officially does not support OpenCL so that header probably is not part of the NDK.

@ahorek
Copy link

ahorek commented Nov 7, 2024

OpenCL support is not part of the NDK, but it's doable:

1/ clone this repository and include include CL/opencl.h to your project like this
CXXFLAGS += -I./OpenCL-Headers/include
2/ copy libOpenCL.so from your phone (usual location are /system/vendor/lib64 or /system/vendor/lib) and link it
LDFLAGS += -lOpenCL -L./OpenCL_redist/lib

now it should compile fine and you can test it via Termux

export LD_LIBRARY_PATH="/system/vendor/lib64"
./run_your_binary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants