KhronosGroup / KhronosGroup/OpenCL-SDK

clGetPlatformIDs return -1001 for android emulator and real phone

Open
#89 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
777
Forks
163
Avg merge
6d 17h
Merged PRs (30d)
2

Description

I cross-compiled OpenCL-SDK as follows. However, when I run `clGetPlatformIDs` function, it returns -1001. What can I do to fix it?
```
#!/bin/bash

set -e

git clone --recurse-submodules https://github.com/KhronosGroup/OpenCL-SDK.git
mkdir OpenCL-SDK/build
cd OpenCL-SDK/build

# cross-compile for android
NDK_PATH=/Users/david/Library/Android/sdk/ndk/25.1.8937393/
TOOLCHAIN=${NDK_PATH}/toolchains/llvm/prebuilt/darwin-x86_64

cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_DOCS=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF \
-DBUILD_TESTS=OFF \
-DOPENCL_SDK_BUILD_SAMPLES=OFF \
-DOPENCL_SDK_TEST_SAMPLES=OFF \
-DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
-DCMAKE_C_COMPILER=${TOOLCHAIN}/bin/aarch64-linux-android33-clang \
-DCMAKE_CXX_COMPILER=${TOOLCHAIN}/bin/aarch64-linux-android-33-clang++ \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_STATIC_LIBS=ON \
-DANDROID_ABI=arm64-v8a \
-DANDROID_PLATFORM=android-33

cmake --build . --config Release
cmake --install . --prefix install_android
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the reported clGetPlatformIDs call and reproduce it using the Android NDK/CMake command shown in the issue. The payload names no repository files or tests, so trace the runtime platform discovery and determine whether the cross-compiled SDK can provide a platform on the emulator and phone; done means identifying and documenting the cause of error -1001.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, cmake, cpp
Domain
build-system, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.