I'm trying to install PyOpenCL on Ubuntu 16.04, but getting the following error:
/usr/bin/ld: cannot find -lOpenCL
collect2: error: ld returned 1 exit status
error: command 'c++' failed with exit status 1
How can I solve this issue?
Thanks.
You need to install: ocl-icd-opencl-dev
apt-get install ocl-icd-opencl-dev
You can check what was actually installed with that package running:
$ dpkg -L ocl-icd-opencl-dev
which should return something along these lines:
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/ocl-icd-opencl-dev
/usr/share/doc/ocl-icd-opencl-dev/copyright
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/OpenCL.pc
/usr/share/doc/ocl-icd-opencl-dev/changelog.Debian.gz
/usr/lib/x86_64-linux-gnu/libOpenCL.so # <--- this is the important bit
If you get a complaint about missing headers, e.g CL/cl.h, then you should install:
apt-get install opencl-headers.
Don't forget to install specific OpenCL drivers for your platform. You could be running against an Intel CPU/GPU, an AMD or NVidia graphics card or even an FPGA.
A good way of checking everything is well setup, is to run clinfo which will show useful information about available platforms (apt-get install clinfo).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With