9

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 Answers1

5

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.

Chris Kitching
  • 2,559
  • 23
  • 37
  • 1
    It seems that this has changed since I posted the issue above (using version 3.0.0). Anyway, thanks for pointing this out - I did not think about disabling those options as well. I already got the option names from the CMakeLists due to the rather poor documentation on them, but it is very hard to deduce what dependencies there are exactly without digging very deep. – Andreas Unterweger Mar 07 '16 at 17:48