OpenCL-ICD-Loader
OpenCL-ICD-Loader copied to clipboard
cl.h not found?
After a fresh clone, if I cd into OpenCL-ICD-Loader, and run
mkdir build cd build cmake ..
No problems. But if I then
make
it stops immediately with
Scanning dependencies of target OpenCL [ 3%] Building C object CMakeFiles/OpenCL.dir/loader/icd.c.o In file included from /khronos/github/OpenCL-ICD-Loader/loader/icd.c:19: /khronos/github/OpenCL-ICD-Loader/loader/icd.h:36:10: fatal error: CL/cl.h: No such file or directory 36 | #include <CL/cl.h> | ^~~~~~~~~ compilation terminated. make[2]: *** [CMakeFiles/OpenCL.dir/build.make:82: CMakeFiles/OpenCL.dir/loader/icd.c.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:764: CMakeFiles/OpenCL.dir/all] Error 2 make: *** [Makefile:160: all] Error 2
Shouldn't I have to tell the build where the OpenCL headers are?
See https://github.com/KhronosGroup/OpenCL-ICD-Loader/blob/master/inc/README.txt:
Copy or symlink OpenCL headers here, inside a CL directory, so that the structure of the inc directory looks something like this:
inc/CL/cl_d3d10.h inc/CL/cl_d3d11.h inc/CL/cl_dx9_media_sharing.h inc/CL/cl_egl.h inc/CL/cl_ext.h inc/CL/cl_gl.h inc/CL/cl.h inc/CL/cl.hpp inc/CL/cl_platform.h inc/CL/opencl.h
I think you can also override the CMake variable OPENCL_ICD_LOADER_HEADERS_DIR
to specify an alternate location.
This would be an excellent place to make use of CMake FetchContent
, by the way, if the headers aren't present or an override specified, they can be downloaded on-demand rather than erroring out.
It just seems strange that the CTS build looks for, and tells me when it can't find the OpenCL headers, but this build doesn't.