Bug 94159 - Can't use double quotes specifying compile include directory flag
Summary: Can't use double quotes specifying compile include directory flag
Alias: None
Product: Beignet
Classification: Unclassified
Component: Beignet (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium normal
Assignee: Xiuli Pan
QA Contact:
Depends on:
Reported: 2016-02-15 13:28 UTC by Andrew
Modified: 2018-10-12 21:27 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Description Andrew 2016-02-15 13:28:03 UTC
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.

Example snippet:

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.
Comment 1 Andrew 2016-02-15 13:33:19 UTC
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.
Comment 2 Xiuli Pan 2016-04-28 07:32:39 UTC
Hi Andrew,

If you are using release_v1.1.1, there will be a problem.
You can find something can fix the problem in patch below:

Comment 3 GitLab Migration User 2018-10-12 21:27:10 UTC
-- 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.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.