Search code examples
macosopenclosx-mavericks

OpenCL headers missing from the OpenCL framework in OS X Mavericks?


I'm trying to compile cpyrit_opencl in Mac and I'm getting this error:

_cpyrit_opencl.c:40:10 fatal error: 'cl.h' file not found
     #include <cl.h>
              ^

I navigated to the /System/Library/Frameworks/OpenCL.framework directory, and behold, there is no "Headers" folder in there.

I am currently running OS X 10.9.2 (Build 13C64), and have also tried with 10.9.1.

To see if this is an error specific to the python script that used to build cpyrit_opencl, I ran:

clang -framework OpenCL -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 _cpyrit_opencl.c

to compile the file manually, this also produced the exact same error as above.

I tried googling to see if anyone else wrote about no OpenCL headers, and found nothing relating to Mac.

Also, I checked and the headers were missing on both of my Macs, both running 10.9.2.


Solution

  • On macs, I find that I always need to use the framework name when including a framework header. Thus,

    #include <OpenCL/OpenCL.h>
    or
    #include <OpenCL/cl.h>
    

    I can't seem to find it at the moment either, though. You still always need the "-framework OpenCL" option you've already got, too.