CL_BUILD_PROGRAM_FAILURE with valid kernel code?

#1

I have started to learn OpenCL, I was thinking if it was possible to parse the file content using a opencl device (R9 Fury) but when clBuildProgram is being called the function return -11 to the status

so i decided to look into clGetProgramBuildInfo and the output is gist .github . com/PontiacGTX/624500139263e69a54b11fb708967b47

C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:1:41: error: expected ')'
__kernel void Readf(__global const char*& pathFile,__global unsigned char*& content,__global cl_ulong& charArrSize)
                                        ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:1:20: note: to match this '('
__kernel void Readf(__global const char*& pathFile,__global unsigned char*& content,__global cl_ulong& charArrSize)
                   ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:1:41: error: parameter name omitted
__kernel void Readf(__global const char*& pathFile,__global unsigned char*& content,__global cl_ulong& charArrSize)
                                        ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:3:6: error: expected expression
        std::fstream* file = new std::fstream(pathFile, std::ios::binary);
            ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:4:2: error: use of undeclared identifier 'file'
        file.open(pathFile);
        ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:4:12: error: use of undeclared identifier 'pathFile'
        file.open(pathFile);
                  ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:5:5: error: use of undeclared identifier 'file'; did you mean 'while'?
        if(file->is_open())
           ^~~~
           while
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:5:5: error: expected expression
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:7:3: error: use of undeclared identifier 'file'
                file->seekg(0,std::ios::end);
                ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:7:17: error: use of undeclared identifier 'std'
                file->seekg(0,std::ios::end);
                              ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:8:3: error: use of undeclared identifier 'charArrSize'
                charArrSize=file->tellg();
                ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:8:15: error: use of undeclared identifier 'file'; did you mean 'while'?
                charArrSize=file->tellg();
                            ^~~~
                            while
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:8:15: error: expected expression
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:9:3: error: use of undeclared identifier 'file'
                file->seekg(0,std::ios::beg);
                ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:9:17: error: use of undeclared identifier 'std'
                file->seekg(0,std::ios::beg);
                              ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:11:3: error: use of undeclared identifier 'content'
                content = new unsigned char[charArrSize+1];
                ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:11:13: error: use of undeclared identifier 'new'
                content = new unsigned char[charArrSize+1];
                          ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:14:11: error: use of undeclared identifier 'size'
                while(i<size)
                        ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:16:11: error: use of undeclared identifier 'file'; did you mean 'while'?
                        buffer=file->get();
                               ^~~~
                               while
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:16:11: error: expected expression
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:17:4: error: use of undeclared identifier 'content'
                        content[i]=(unsigned char)buffer;
                        ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:19:3: error: use of undeclared identifier 'content'
                content[charArrSize]='\0';
                ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:19:11: error: use of undeclared identifier 'charArrSize'
                content[charArrSize]='\0';
                        ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:21:2: error: use of undeclared identifier 'file'
        file->close();
        ^
C:\Users\PONTIA~1\AppData\Local\Temp\\OCL15568T1.cl:22:2: error: use of undeclared identifier 'delete'
        delete file;
        ^
24 errors generated.

error: Clang front-end compilation failed!
Frontend phase failed compilation.
Error: Compiling CL to IR
#2

Looks like you didn’t post the correct link for the output. You provided the same link for it as for the method code just below it.

Also, please prefer posting the output and code snippets inline in the thread so that it makes sense to readers (now but especially in the future). Just put 3 back-ticks (```) before and after those lines, like this:

#include <stdio.h>

int main()
{
    exit(1);
}
#3

edit found the problem the kernel has to be written in C instead C++ solved the issue