Disable OpenCL in OpenCV completely

8.4k views Asked by At

I want to build a static version of OpenCV (3) with OpenCL disabled. To do so, I am using

cmake -D WITH_OPENCL=OFF -D BUILD_SHARED_LIBS=OFF

when compiling OpenCV, among other parameters (which disable other modules that I don't need). The output of the cmake call includes the following line

-- Use OpenCL: NO

which, if I understand it correctly, means that OpenCL is disabled.

Now, when linking against the compiled version of OpenCV, I get the following message (I redacted the path):

[Redacted]/lib/libopencv_core.a(ocl.cpp.o): In function `initOpenCLAndLoad': ocl.cpp:(.text.initOpenCLAndLoad+0x2b): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

I am aware of what the message means, but I am confused by its source - why is there OpenCL-invoking code in the compiled OpenCV library? Is there any other option that I need to set so that OpenCL is disabled completely?

Thank you and best regards

1

There are 1 answers

1
Chris Kitching On BEST ANSWER

OpenCV isn't very good at documenting its build options, but we can see them fairly well from their CMakeLists.txt:

https://github.com/Itseez/opencv/blob/master/CMakeLists.txt#L208

I would suggest turning off WITH_OPENCLAMDFFT, WITH_OPENCLAMDBLAS, and WITH_VA_INTEL as well.