OpenCL-ICD-Loader icon indicating copy to clipboard operation
OpenCL-ICD-Loader copied to clipboard

cl.h not found?

Open b-sumner opened this issue 3 years ago • 4 comments

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?

b-sumner avatar Oct 08 '21 21:10 b-sumner

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

jenatali avatar Oct 08 '21 21:10 jenatali

I think you can also override the CMake variable OPENCL_ICD_LOADER_HEADERS_DIR to specify an alternate location.

Kerilk avatar Oct 08 '21 21:10 Kerilk

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.

jenatali avatar Oct 08 '21 21:10 jenatali

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.

b-sumner avatar Oct 08 '21 21:10 b-sumner