ERROR: Feature 'opengles2' was enabled, but the pre-condition 'config.win32 || (!config.watchos && !features.opengl-desktop && libs.opengl_es2)' failed.

  • Trying to compile qt 5.9 for my raspberry pi 3 compute module and I have been following mainly the online guide here ( So, I have set the pi system roots to the mount point /mnt/pi-rootfs.
    Please note I m using Raspbian Stretch.

    The qtbase configuration was called with the following argument:
    ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi

    This configures qt but no openGL and I have the message:
    ERROR: Feature 'opengles2' was enabled, but the pre-condition 'config.win32 || (!config.watchos && !features.opengl-desktop && libs.opengl_es2)' failed.

    ERROR: The OpenGL functionality tests failed!
    You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2],
    QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform.

    In addition, I also tried to add these 'QMAKE_INCDIR_OPENGL QMAKE_INCDIR_OPENGL QMAKE_INCDIR_OPENGL' to qmake.conf in linux-rasp-pi-g++ but still no sucess.

    Please advise how to fix these issues.

  • Moderators

    @MAKK Add -v parameter to configure call and see what exactly is wrong with opengles2

  • @jsulm please find he below link containing logs.

  • Moderators

    @MAKK You're missing the libs:

    > /home/minhaj/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lGLESv2
    > /home/minhaj/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lEGL

  • @jsulm how can I fix it and get these libs... please advise em newbie..

  • Moderators

    @MAKK Well, you need these libs in your sysroot: /mnt/rasp-pi-rootfs. If your sysroot is a copy of the RaspPi root file system then install the libs there (apt-get on RaspPi).

  • @jsulm This means I have to put raspbian-stretch.img to SDCard & update it. After that convert it back to image & mount it... Then run again configure command...

  • Moderators

    @MAKK Or just put the SDCard into your laptop/PC after updating :-)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.