ComputeCpp supports pocl on ARM CPU board?


I am considering to build SYCL and OpenCL environment with the ComputeCpp and pocl by a-head-of-time compile and run them on ARM CPU board.

In theory, I think that is possible if ComputeCpp supports cross-compile. Could you tell me some comment or advice.

It’s possible to do this fairly easily using CMake and the correct toolchain file. There is an Arm toolchain file in the SDK located in computecpp-sdk/cmake/toolchains/arm-gcc-poky.cmake, you could use it in the following example command. You’ll need to replace each path with your own. Let me know if you don’t understand what needs to go where. With this command for example you could build the computecpp-sdk source code and the produced binaries will run on the target arm device. Using the file Linux command on the binary will validate if the binary that has been built is the correct binary type for your target.

cmake -DComputeCpp_DIR=/path/to/computecpp/folder \
  -DOpenCL_LIBRARY=path/to/ \
  -DOpenCL_INCLUDE_DIR=/path/to/opencl/include \
  -DCOMPUTECPP_RUNTIME_LIBRARY=/path/to/computecpp-aarch64-linux/lib/ \
  -DCMAKE_TOOLCHAIN_FILE=../computecpp-sdk/cmake/toolchains/gcc-generic.cmake \
1 Like

Just a couple of quick clarifications: the toolchain file you want is actually the gcc-generic.cmake toolchain, assuming that you’re not targeting a poky platform. Secondly you’ll need to make sure that the bitcode parameter matches the bitness of your platform, which I am assuming will be 64-bit and therefore should be spir64.

I’d be interested to know if this works for anything other than basic programs, pocl’s spir support has been varied over the years and the last time I tried personally I couldn’t get any builtins other than the absolute basics working. This made it difficult to run anything that wasn’t basically trivial.

I’ve just checked the release notes from last year - it sounds like they’ve put a lot of work into the things I ran into trouble with. We’d be very interested to know if you get any success with this!

Thanks @duncan I’ve updated the original response with your tips.

Hi all

Thank you for your reply. I will try it after completed pocl cross-compile setup and installation (I am struggling to do that).


I have a question.

-DCOMPUTECPP_RUNTIME_LIBRARY=/path/to/computecpp-aarch64-linux/lib/ \

I want to cross-compile sycl.cpp to ARM objects with ARM cross-compiler on Ubuntu intel x64 PC.

Did you answer assuming on Ubuntu ARM 64 PC (or platform)?

You are correct in that assumption, it’s the Ubuntu version you are pointing to, however we would recommend actually using a different variable to set the location of the ComputeCpp files.

With the computecpp-sdk project it uses the FindComputeCpp.cmake file to set up some variables and ensure the correct object files are used. You should use that in any other projects that you are building.

I’ve updated the command to make it clear which ComputeCpp versions you need to point to with the command:

cmake -DComputeCpp_DIR=/path/to/computecpp-ce-xyz-arm \
  -DComputeCpp_HOST_DIR=/path/to/computecpp-ce-xyz-x86 \ 
  -DOpenCL_LIBRARY=path/to/ \
  -DOpenCL_INCLUDE_DIR=/path/to/opencl/include \
  -DCMAKE_TOOLCHAIN_FILE=../computecpp-sdk/cmake/toolchains/gcc-generic.cmake \

thanks . I tried the way but i got error.

CMake Error at cmake/toolchains/gcc-generic.cmake:10 (message):
COMPUTECPP_TOOLCHAIN_DIR in the environment when crosscompiling.


COMPUTECPP_SYSROOT_DIR should be the folder <target>/libc. We could probably infer it but at the time this seemed simplest. It’s the folder where all the system libraries would live (/usr etc.).

I have completed cmake but make failed.

[ 1%] Building ComputeCpp integration header file /home/k-ojima/build/samples/vptr_vptr.cpp.sycl
In file included from /home/k-ojima/computecpp-sdk/samples/vptr.cpp:29:
In file included from /opt/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64/include/CL/sycl.hpp:1:
In file included from /opt/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64/include/CL/…/SYCL/sycl.hpp:20:
In file included from /opt/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64/include/SYCL/sycl_builtins.h:27:
In file included from /opt/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64/include/SYCL/cpp_to_cl_cast.h:12:
In file included from /opt/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64/include/SYCL/deduce.h:25:
In file included from /opt/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64/include/SYCL/cl_types.h:23:
In file included from /opt/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64/include/SYCL/common.h:19:
In file included from /opt/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64/include/SYCL/predefines.h:541:
/usr/lib/gcc-cross/aarch64-linux-gnu/5.4.0/…/…/…/…/include/c++/5.4.0/cmath:41:10: fatal error:
‘bits/c++config.h’ file not found
#include <bits/c++config.h>
1 error generated.
samples/CMakeFiles/vptr_vptr.cpp_0_ih.dir/build.make:62: recipe for target ‘samples/vptr_vptr.cpp.bc’ failed

c++config.h is located at /usr/aarch64-linux-gnu/include/c++/5/aarch64-linux-gnu/bits in my environment so I think include path have something wrong. I am looking for the source that set the path but I have not found it yet. Or there are another way to solve it?

I have seen problems when cross-compiling before that result in this sort of error. The first to check is the OpenCL headers being found in a “system” location, like /usr/include (most distributions I’ve seen will install them to /usr/include/CL). This can cause header search path problems, where the order they are used changes. To fix this, I normally use a separate directory with a known copy of the OpenCL headers, and specify them with a CMake cache variable like -DOpenCL_INCLUDE_DIR.

I hope this helps,


Thanks. I have solved the problem of include path but I got new error that seems to relate setting of ComputeCpp.

I specified path to computecpp but it seems to also need and so on. But pocl library is only Can I change computecpp setting to link only?

[ 1%] Built target vptr_vptr.cpp_0_ih
[ 2%] Linking CXX executable vptr
/usr/lib/gcc-cross/aarch64-linux-gnu/5/…/…/…/…/aarch64-linux-gnu/bin/ld: warning:, needed by /home/k-ojima/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64/lib/, not found (try using -rpath or -rpath-link)
/usr/lib/gcc-cross/aarch64-linux-gnu/5/…/…/…/…/aarch64-linux-gnu/bin/ld: warning:, needed by /home/k-ojima/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64/lib/, not found (try using -rpath or -rpath-link)
/usr/lib/gcc-cross/aarch64-linux-gnu/5/…/…/…/…/aarch64-linux-gnu/bin/ld: warning:, needed by /home/k-ojima/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64/lib/, not found (try using -rpath or -rpath-link)


Unfortunately you can’t do this out-of-the box. It is not a problem with ComputeCpp per se. Let me explain. When we build ComputeCpp, we use the upstream Khronos OpenCL ICD loader, in other words, we use the official as provided here. When you build that you get the following files -> ->

When you link your application/library against, the linker will actually use the library SONAME, which in this case will be

From what you’re saying it seems that pocl is not ICD compatible, since they provide their whole implementation in

With that said, I have two solutions that can work for you:

  1. The easiest solution for you would be to cp or create a symlink.
  2. Another, more complicated, but better solution would be to create a file in /etc/OpenCL/vendors called pocl.icd containing the full path to your By doing this, you will have installed pocl in an ICD compatible way.

Thank you for your reply.

Sorry, I misunderstood the library is only one because I don’t know the ICD spec well. After knowing that, I confirmed libraries of pocl again, there are 3 files like you said.

So I put the libraries and I tried to make again, but an another error outs.

[ 1%] Built target vptr_vptr.cpp_0_ih
[ 2%] Linking CXX executable vptr
/usr/lib/gcc-cross/aarch64-linux-gnu/5/…/…/…/…/aarch64-linux-gnu/bin/ld:/opt/pocl/ file format not recognized; treating as linker script
/usr/lib/gcc-cross/aarch64-linux-gnu/5/…/…/…/…/aarch64-linux-gnu/bin/ld:/opt/pocl/ syntax error
collect2: error: ld returned 1 exit status

May be it is not problem of ComputeCpp, can you tell me comment or advice if you have any idea.

It looks like you are trying to link the wrong version of pocl, by wrong I mean one that was not cross-compiled for ARM in your case. Can you double check your pocl library is the ARM version?

You can check this by running the command

file /opt/pocl/

You should see something like the following

ELF 64-bit LSB shared object, ARM aarch64, version 1 (GNU/Linux), dynamically linked

If you see x86_64 it means you are trying to link against the wrong version.


I had confirmed that the lib are correct with the file command. I just wonder why .so and .so2 say simply “data”.

/opt/pocl/ data
/opt/pocl/ data
/opt/pocl/ ELF 64-bit LSB shared object, ARM aarch64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=74136f9675d4262bda2c03fd6c3883fdd733ec53, not stripped

I have solved problems of link but another link error appears.

/usr/lib/gcc-cross/aarch64-linux-gnu/5/…/…/…/…/aarch64-linux-gnu/bin/ld: warning:, needed by /home/k-ojima/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64/lib/, not found (try using -rpath or -rpath-link)
/usr/lib/gcc-cross/aarch64-linux-gnu/5/…/…/…/…/aarch64-linux-gnu/bin/ld: warning:, needed by /home/k-ojima/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64/lib/, not found (try using -rpath or -rpath-link)
/usr/lib/gcc-cross/aarch64-linux-gnu/5/…/…/…/…/aarch64-linux-gnu/bin/ld: warning:, needed by /home/k-ojima/pocllib64/lib64/, not found (try using -rpath or -rpath-link)
/usr/lib/gcc-cross/aarch64-linux-gnu/5/…/…/…/…/aarch64-linux-gnu/bin/ld: warning:, needed by /home/k-ojima/pocllib64/lib64/, not found (try using -rpath or -rpath-link)
/usr/lib/gcc-cross/aarch64-linux-gnu/5/…/…/…/…/aarch64-linux-gnu/bin/ld: warning:, needed by /home/k-ojima/pocllib64/lib64/, not found (try using -rpath or -rpath-link

I want to link the libs by-rpath but I could not find cmake file where set -rpath in the computecpp sdk.

Can you update your post with the latest build command you are using please?

I use below.

cmake -DComputeCpp_DIR=…/ComputeCpp-CE-1.3.0-Ubuntu-16.04-ARM_64 -DComputeCpp_HOST_DIR=…/ComputeCpp-CE-1.3.0-Ubuntu-16.04-x86_64 -DOpenCL_LIBRARY=/home/k-ojima/pocllib64/lib64/ -DOpenCL_INCLUDE_DIR=/usr/include -DCMAKE_TOOLCHAIN_FILE=./cmake/toolchains/gcc-generic.cmake -DCOMPUTECPP_BITCODE=spir64 …

It looks like you are pointing to the wrong library file. Note that the actual pocl library you need, the ARM one, is located in /opt/pocl/, the one you are linking is located in /home/k-ojima/pocllib64/lib64/, I think that these files are different.