clBuildProgram failed without printing build log

Discussion created by akhal on Oct 21, 2011
Latest reply on Oct 25, 2011 by akhal

I have worked little bit in OpenCL now but recently "clBuildProgram" failed in one of my program. My code excerpt is below:

    cl_program program;
    program = clCreateProgramWithSource(context, 1, (const char**) &kernel_string, NULL, &err);
    if(err != CL_SUCCESS)
    cout<<"Unable to create Program Object. Error code = "<<err<<endl;
    if(clBuildProgram(program, 0, NULL, NULL, NULL, NULL) != CL_SUCCESS)
    cout<<"Program Build failed\n";
    size_t length;
    char buffer[2048];
    clGetProgramBuildInfo(program, device_id[0], CL_PROGRAM_BUILD_LOG, sizeof(buffer), buffer, &length);
    cout<<"--- Build log ---\n "<<buffer<<endl;

Normally earlier I got syntax or other errors inside kernel file here with the help of "clGetProgramBuildInfo()" function whenever "clBuildProgram" Failed but when this program runs, on console it only prints:

Program Build failed
--- Build log ---
<Nothing here>

And when I tried to print the error code returned by "clBuildProgram"; it is "-11"......
What can be the problem with my kernel file that I dont get any build fail information ?