When specifying the include paths in the program build options, double quotes can't be used to escape special characters (for example spaces). It doesn't matter if the specified path is relative or absolute.
cl_device_id dev; // some device
cl_context context; // some context
cl_program prog = clCreateProgramWithSource(context, 1, &src, &len, &err)
const char* options = "-I\"/home/user/dir/\"";
const char* src = "#include <a_file.cl>\n";
cl_int err = clBuildProgram(prog, 1, &dev, options, nullptr, nullptr);
if(err != CL_SUCCESS)
size_t len = 0;
clGetProgramBuildInfo(prog, dev, CL_PROGRAM_BUILD_LOG, 0, nullptr, &len);
char* buf = new char[len];
clGetProgramBuildInfo(prog, dev, CL_PROGRAM_BUILD_LOG, len, log, nullptr);
Assume the file "/home/user/dir/a_file.cl" exists and is a valid OpenCL C source file. For reference, this example builds and runs on AMD's APP SDK implementation and NVidia's implementation, while interestingly it does not build on Beignet and Intel's proprietary OpenCL SDK.
Just to clarify, the failure message is a failure to find <a_file.cl>, not anything to do with passing bad flags. Removing the quotes allows the program to build and run as expected, but means I can't have any directories with spaces in them, and is just an unnecessary incompatibility with other OpenCL implementations.
If you are using release_v1.1.1, there will be a problem.
You can find something can fix the problem in patch below:
-- GitLab Migration Automatic Message --
This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/beignet/beignet/issues/71.