I'm on OS X 10.7 Lion and have all the dev tools installed, but when I run GCC on a relatively simple program, just straight C with a few calls to openCL functions like clCreateProgramFromSource
and the like, I get the following list of errors:
Undefined symbols for architecture x86_64:
"_CreateContext", referenced from:
_build_kernel in ccFuZYMI.o
"_GetDevices", referenced from:
_build_kernel in ccFuZYMI.o
"_CreateCommandQueue", referenced from:
_build_kernel in ccFuZYMI.o
"_clCreateProgramWithSource", referenced from:
_build_kernel in ccFuZYMI.o
"_clBuildProgram", referenced from:
_build_kernel in ccFuZYMI.o
"_clCreateKernel", referenced from:
_build_kernel in ccFuZYMI.o
"_clCreateBuffer", referenced from:
_build_kernel in ccFuZYMI.o
"_clEnqueueWriteBuffer", referenced from:
_sync_run_kernel in ccFuZYMI.o
"_clSetKernelArg", referenced from:
_sync_run_kernel in ccFuZYMI.o
"_clEnqueueNDRangeKernel", referenced from:
_sync_run_kernel in ccFuZYMI.o
"_clEnqueueReadBuffer", referenced from:
_sync_run_kernel in ccFuZYMI.o
"_clReleaseContext", referenced from:
_destroy_kernel in ccFuZYMI.o
"_clReleaseCommandQueue", referenced from:
_destroy_kernel in ccFuZYMI.o
"_clReleaseMemObject", referenced from:
_destroy_kernel in ccFuZYMI.o
"_clReleaseProgram", referenced from:
_destroy_kernel in ccFuZYMI.o
"_clReleaseKernel", referenced from:
_destroy_kernel in ccFuZYMI.o
ld: symbol(s) not found for architecture x86_64
There are some other warnings, but no other errors at compulation stage. This is (in case not clear) a linker error. It seems to be able to see the definitions from the header file while creating the object file, because it gives me warnings about incompatible pointer types.
I have tried pasting into an xcode project, but I get exactly the same errors. I have tried the only other OS X Lion / OpenCL result's solution, and it didn't help.
Looks like you're missing the OpenCL framework - try:
$ gcc -Wall foo.c -framework OpenCL -o foo
It looks to me like you're not linking against the OpenCL libraries. Can you post the link command that you are trying to use? Without that information, simply shooting from the hip: add -framework OpenCL
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With