Compiling OpenCL programs on Mac OS X Snow Leopard
September 28, 2009
I installed Snow Leopard on my laptop yesterday. I was very curious about OpenCL and installed the drivers and the GPU Computing SDK from NVIDIA.
I searched my hard disk after installation and found the following directory: /Developer/GPU Computing/OpenCL. Looks promising.
In the subdirectory src/oclDeviceQuery I found a basic test and I tried to compile it.
$ cd src/oclDeviceQuery
$ make
ld: library not found for-loclUtil
collect2: ld returned 1 exit status
make: ***[../../..//OpenCL//bin//darwin/release/oclDeviceQuery] Error 1
I googled for “-loclUtils”? I found nothing. “liboclUtils”? Nothing. So i found a brand new problem that is not known to mankind. Hurray. ;-)
But i remembered a similiar situation when i used the CUDA-SDK. So i searched the other directories. The solution is to create the library manually.
So -loclUtil should now be found. And i tried to compile again.
$ make
ld: library not found for-lshrutil
collect2: ld returned 1 exit status
make: ***[../../..//OpenCL//bin//darwin/release/oclDeviceQuery] Error 1
Aha, there’s another library missing. I tried the one in /Developer/GPU Computing/shared.
$ cd ../../../shared/
$ make
src/rendercheckGL.cpp: In member function ‘virtual bool CheckBackBuffer::readback(GLuint, GLuint, GLuint)’:
src/rendercheckGL.cpp:523: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘GLuint’
src/rendercheckGL.cpp:527: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘GLuint’
src/rendercheckGL.cpp: In member function ‘virtual bool CheckFBO::readback(GLuint, GLuint, GLuint)’:
src/rendercheckGL.cpp:1342: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘GLuint’
src/rendercheckGL.cpp:1346: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘GLuint’
a - obj/release/shrUtils.cpp.o
a - obj/release/rendercheckGL.cpp.o
a - obj/release/cmd_arg_reader.cpp.o
Back into the directory with the device query sources.
$ cd ../OpenCL/src/oclDeviceQuery/
$ make
The compilation succeeds, but where’s the executable? It is not in the current directory.
$ ls
Makefile obj/ oclDeviceQuery.cpp
I searched the directories again and its in a bin subfolder of /Developer/GPU Computing/OpenCL
I’ve written an article for JavaSpektrum 2/2025 about Structured Concurrency in Java 24. The article covers JEP 499, Java’s fourth preview of Structured Concurrency, which aims to make concurrent programming...
Concurrent and asynchronous applications can be written in Kotlin with coroutines in a precise and structured way. Unfortunately, concurrency often increases the complexity and it is difficult to create bug-free...