Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

OpenCL library/function missing

I have Snow Leopard (10.6.8) and running Xcode 3.2.6 with (I hope!) version 1.1 for OpenCL. I am running a program that requires the function clEnqueueReadBufferRect() which I can see it's present in the cl.h header in my /System/Library/Frameworks/OpenCL.framework/ location. I do not understand why clEnqueueReadBuffer() is found by the compiler and clEnqueueReadBufferRect() is not, since they both belong to cl.h and I'm compiling with the "-framework OpenCL" flag. please help! any partial hint/trick is welcome 🙂

Posted on May 2, 2012 3:50 PM

Reply
15 replies

May 2, 2012 5:36 PM in response to etresoft

ah! I should have done that the first time. lesson learned 🙂


#include <OpenCL/opencl.h>


int main(int argc, char** argv) {


int height, width, size;

float* input;

cl_platform_id platform;

cl_device_id device;

cl_context context;

cl_command_queue queue;

cl_mem memBuffer;

size_t buff[0];

// this one fails

clEnqueueWriteBufferRect(queue, memBuffer, CL_TRUE, buff, buff, buff,

width*sizeof(float), 0, width*sizeof(float), 0, input, 0, NULL, NULL);

// this one works

//clEnqueueWriteBuffer(queue, memBuffer, CL_TRUE, 0, size, input, 0, NULL, NULL);

return 0;

}


I compile using this line:


g++ demo.cpp -framework OpenCL


and the error I get is:


Undefined symbols:

"_clEnqueueWriteBufferRect", referenced from:

_main in ccpln4aL.o

ld: symbol(s) not found

collect2: ld returned 1 exit status


but if I comment that function and instead use clEnqueueWriteBuffer() there is no error whatsoever!


why would that be?

May 3, 2012 7:30 AM in response to etresoft

fooled you? 🙂 that was not in my intention. and I am not using any custom setup. Xcode is installed with all the developer kit, it's just I'm not using it. I rather like using g++ from a command line.


Isn't any way I could import the OpenCL 1.1 libraries (found the headers, but not the libraries) from Lion or some other place on the web and just use those instead?

May 3, 2012 7:34 AM in response to studUS

studUS wrote:


fooled you? 🙂 that was not in my intention. and I am not using any custom setup. Xcode is installed with all the developer kit, it's just I'm not using it. I rather like using g++ from a command line.


That might be OK, might not.


Isn't any way I could import the OpenCL 1.1 libraries (found the headers, but not the libraries) from Lion or some other place on the web and just use those instead?


How did you even know that new function was there? On my Snow Leopard machine it doesn't even exist. This is a system library on Lion. If you are targeting Lion, you need to use Lion and Xcode4 to build. Plus you can use clang instead of g++. If there aren't any other Lion dependencies in OpenCL, you might be able to copy it to Snow Leopard. You could never distribute it.


It just seems you are getting further and further out on the branch and are actively sawing.

May 3, 2012 7:53 AM in response to etresoft

How did you even know that new function was there? On my Snow Leopard machine it doesn't even exist. This is a system library on Lion. If you are targeting Lion, you need to use Lion and Xcode4 to build.


I knew because there are several locations where cl.h can be found in Spotlight. one location was Nvidia's GPU computing SDK. while looking inside that one I noticed this function and I hate I cannot use it because it optimizes the previous function from 1.0 which is slower in execution. I just installed Xcode 4.2 but that didn't update the libraries in /System/Library/Frameworks/OpenCL.framework/Libraries so I'm kind of at a loss here 😟

OpenCL library/function missing

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.