cannot find -lOpenCL on Mac OS X OpenCL is not working on Mac OS as it cannot find the library


This is my first post on this forum and hopefully I will get the answer. I have installed latest CUDA SDK on my Macbook pro with NVIDIA Geforce 320M and CUDA works fine but there is problem with OpenCL. It is with OpenCL library as it says “ld: library not found for -lOpenCL”

I have compiled and run OpenCL SDK samples and they run correctly which means that library is there but I have tried finding “” but could not. I have tried to include all possible library paths as shown below:

g++ -I/Developer/GPU\ Computing/OpenCL/common/inc -I/Developer/GPU\ Computing/shared/inc -L/usr/lib/ -L/Developer/GPU\ Computing/OpenCL/common/lib -L/Developer/GPU\ Computing/shared/lib/ -L/Developer/GPU\ Computing/shared/lib/darwin -lOpenCL test.cpp -o test

Please help me as I cannot find the problem.

Thanks in advance!


AFAIK, on Mac OS X you should pass “-framework OpenCL” to the compiler / linker instead.

Thankyou very much. That solved the problem :smile: