Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cl.h not found? #156

Open
b-sumner opened this issue Oct 8, 2021 · 4 comments
Open

cl.h not found? #156

b-sumner opened this issue Oct 8, 2021 · 4 comments

Comments

@b-sumner
Copy link

b-sumner commented Oct 8, 2021

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?

@jenatali
Copy link
Contributor

jenatali commented Oct 8, 2021

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

@Kerilk
Copy link
Contributor

Kerilk commented Oct 8, 2021

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

@jenatali
Copy link
Contributor

jenatali commented Oct 8, 2021

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.

@b-sumner
Copy link
Author

b-sumner commented Oct 8, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants