I'm having trouble compiling opencv 2.4.7 with cmake, I get a Failed to find "GLESv2" error:

(hal)pi@raspberrypi ~/OpenCV/opencv-2.4.7/build $ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON ..
-- Detected version of GNU GCC: 46 (406)

-- Found OpenEXR: /usr/lib/libIlmImf.so
CMake Error at /usr/lib/arm-linux-gnueabihf/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:31 (message):
  Failed to find "GLESv2" in "/opt/vc/lib".
Call Stack (most recent call first):
  /usr/lib/arm-linux-gnueabihf/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:64 (_qt5gui_find_extra_libs)
  /usr/lib/arm-linux-gnueabihf/cmake/Qt5Gui/Qt5GuiConfig.cmake:137 (include)
  cmake/OpenCVFindLibsGUI.cmake:19 (find_package)
  CMakeLists.txt:421 (include)

-- Configuring incomplete, errors occurred!

However, I see libGLESv2.so in the /opt/vc/lib directory:

(hal)pi@raspberrypi ~/OpenCV/opencv-2.4.7/build $ cd /opt/vc/lib
(hal)pi@raspberrypi /opt/vc/lib $ ls
libbcm_host.so   libEGL.so        libGLESv1_CM.so  libGLESv2_static.a  libkhrn_static.a  libmmal.so       libmmal_vc_client.so  libOpenVG.so        libvchiq_arm.so  libvcos.so            libwayland-egl.so
libdebug_sym.so  libEGL_static.a  libGLESv2.so     libkhrn_client.a    libmmal_core.so   libmmal_util.so  libopenmaxil.so       libvcfiled_check.a  libvchostif.a    libvmcs_rpc_client.a  libWFC.so

I'm not sure what's going on if the GLESv2 library file seems to be there.

1 Answer 1


I was able to run the Cmake command by editing the /usr/lib/arm-linux-gnueabihf/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake file and adding

set(CMAKE_LIBRARY_PATH /opt/vc/lib)
set(_qt5gui_OPENGL_INCLUDE_DIR /opt/vc/include)

at the start of the file.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.