Thread overview
How DerelictCL works
Jul 21, 2020
bioinfornatics
Jul 21, 2020
aberba
Jul 22, 2020
Mike Parker
Jul 22, 2020
Guillaume Piolat
Jul 22, 2020
WebFreak001
July 21, 2020
Dear,

I would like to use OpenCL in D. Thus I try to use DerelictCL.
But I fail to use it I encounter this error message:
--------------
/opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/opencl/constants.di(835): Error: genCLVectorTypes cannot be interpreted at compile time, because it has no available source code
/opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/opencl/constants.di-mixin-835(835): Error: declaration expected, not <
--------------


The tiny D file is:
------test_opencl.d--------

import derelict.opencl.cl;

void main() {
    // Load the OpenCL library.
    DerelictCL.load();
}
---------------------------


The compile line is:

--------------
ldc2  -I /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/ \
      -L-L/usr/lib64 \
      -L-L/opt/jonathan/jonathan-dlang_ldc2092/root/usr/lib64 \
      -L-lOpenCL \
      -L-lDerelictUtil \
      -L-lDerelictCL \
      -of test \
      test_opencl.d
--------------

library are located at:
OpenL           /usr/lib64/libOpenCL.so
DerelictUtil    /opt/jonathan/jonathan-dlang_ldc2092/root/usr/lib64/libDerelictUtil.so
DerelictCL      /opt/jonathan/jonathan-dlang_ldc2092/root/usr/lib64/libDerelictCL.so

Derelict include files:= are located at:
 - /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/


Thanks for your help

Best regards




July 21, 2020
On Tuesday, 21 July 2020 at 12:00:03 UTC, bioinfornatics wrote:
> Dear,
>
> I would like to use OpenCL in D. Thus I try to use DerelictCL.
> But I fail to use it I encounter this error message:
> --------------
> /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/opencl/constants.di(835): Error: genCLVectorTypes cannot be interpreted at compile time, because it has no available source code
> /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/opencl/constants.di-mixin-835(835): Error: declaration expected, not <
> --------------
>
> [...]


Have you install the libopencl** dev dependencies?
July 22, 2020
On Tuesday, 21 July 2020 at 12:00:03 UTC, bioinfornatics wrote:
> Dear,
>
> I would like to use OpenCL in D. Thus I try to use DerelictCL.
> But I fail to use it I encounter this error message:
> --------------
> /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/opencl/constants.di(835): Error: genCLVectorTypes cannot be interpreted at compile time, because it has no available source code
> /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/opencl/constants.di-mixin-835(835): Error: declaration expected, not <
> --------------

Looks like an issue in a code gen function. It might be due to changes in LDC. I'll ping Guillaume.
July 22, 2020
On Tuesday, 21 July 2020 at 12:00:03 UTC, bioinfornatics wrote:
> Dear,
>
> I would like to use OpenCL in D. Thus I try to use DerelictCL.
> But I fail to use it I encounter this error message:

Hello,

I don't have time at all at the moment for maintaining DerelictCL, can you provide a fully working PR that fix your problem? I will then make a git tag.


Guillaume
July 22, 2020
On Tuesday, 21 July 2020 at 12:00:03 UTC, bioinfornatics wrote:
> Dear,
>
> I would like to use OpenCL in D. Thus I try to use DerelictCL.
> But I fail to use it I encounter this error message:
> --------------
> /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/opencl/constants.di(835): Error: genCLVectorTypes cannot be interpreted at compile time, because it has no available source code
> /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/opencl/constants.di-mixin-835(835): Error: declaration expected, not <
> --------------
>
>
> The tiny D file is:
> ------test_opencl.d--------
>
> import derelict.opencl.cl;
>
> void main() {
>     // Load the OpenCL library.
>     DerelictCL.load();
> }
> ---------------------------
>
>
> The compile line is:
>
> --------------
> ldc2  -I /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/ \
>       -L-L/usr/lib64 \
>       -L-L/opt/jonathan/jonathan-dlang_ldc2092/root/usr/lib64 \
>       -L-lOpenCL \
>       -L-lDerelictUtil \
>       -L-lDerelictCL \
>       -of test \
>       test_opencl.d
> --------------
>
> library are located at:
> OpenL           /usr/lib64/libOpenCL.so
> DerelictUtil    /opt/jonathan/jonathan-dlang_ldc2092/root/usr/lib64/libDerelictUtil.so
> DerelictCL      /opt/jonathan/jonathan-dlang_ldc2092/root/usr/lib64/libDerelictCL.so
>
> Derelict include files:= are located at:
>  - /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/
>
>
> Thanks for your help
>
> Best regards

where did you get these .di files from you have in your include directory?

I don't think these are officially produced by the derelict-cl library and are the reason why your compilation is breaking. (it wants to evaluate some function at compile time, probably some CTFE or manifest constant, which fails because it only has definitions inside the .di file and not the function implementation)