title: OpenGL error during Qt 6 corss compilation for Raspberry Pi 4
body: <br/>
    I am trying to cross compile Qt 6 for Raspberry Pi 4. Following are the steps I follwed.
  <ol>
  <li>installed crosstool-ng and related packages.</li>
  <li>took the rpi toolchain from <a href="https://github.com/ali1234/rpi-toolchain" rel="nofollow noreferrer">https://github.com/ali1234/rpi-toolchain</a> and build the same.</li>
  <li>downloaded the qt 6 source code by following the steps mentioned in <a href="https://wiki.qt.io/Building_Qt_6_from_Git" rel="nofollow noreferrer">https://wiki.qt.io/Building_Qt_6_from_Git</a>.</li>
  <li>Compiled qt 6 successfully for the host system (Ubuntu 20.04 LTS).</li>
  <li>created a toolchain.cmake:<br/>
  <strong>toolchain.cmake</strong></li>
  </ol>
  <pre><code>set(CMAKE_SYSTEM_NAME Linux)
  set(CMAKE_SYSTEM_PROCESSOR arm)
  
  set(tools $HOME/rpi-sdk/toolchain-raspbian--x86_64-arm-linux-gnueabihf)
  
  set(CMAKE_SYSROOT $HOME/rpi-sdk/sysroot)
  set(CMAKE_C_COMPILER ${tools}/bin/arm-linux-gnueabihf-gcc)
  set(CMAKE_CXX_COMPILER ${tools}/bin/arm-linux-gnueabihf-g++)
  
  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
  </code></pre>
  <ol>
  <li>using rsync -avz pi@rpi_ip:/lib rsync -avz pi@192.168.0.119:/usr copied the files from target device(rpi 4) to create the sysroot</li>
  <li>Got the qt source code and compiled the same for host system (ubunto 20.04) sucessfully.</li>
  <li>For rpi cross compilation added folder &quot;linux-arm-gnueabihf-g++&quot; under qtbase/mkspecs and made following changes to qmake.conf</li>
  </ol>
  <pre><code># qmake configuration for building with arm-linux-gnueabihf-g++
  #
  
  MAKEFILE_GENERATOR      = UNIX
  CONFIG                 += incremental
  QMAKE_INCREMENTAL_STYLE = sublib
  
  include(../common/linux.conf)
  include(../common/gcc-base-unix.conf)
  include(../common/g++-unix.conf)
  
  # modifications to g++.conf
  QMAKE_CC                = arm-linux-gnueabihf-gcc
  QMAKE_CXX               = arm-linux-gnueabihf-g++
  QMAKE_LINK              = arm-linux-gnueabihf-g++
  QMAKE_LINK_SHLIB        = arm-linux-gnueabihf-g++
  
  # modifications to linux.conf
  QMAKE_AR                = arm-linux-gnueabihf-ar cqs
  QMAKE_OBJCOPY           = arm-linux-gnueabihf-objcopy
  QMAKE_NM                = arm-linux-gnueabihf-nm -P
  QMAKE_STRIP             = arm-linux-gnueabihf-strip
  
  QMAKE_INCDIR_OPENGL     = $HOME/rpi-sdk/sysroot/usr/include
  QMAKE_LIBDIR_OPENGL     = $HOME/rpi-sdk/sysroot/usr/lib/arm-linux-gnueabihf
  QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_OPENGL
  QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_OPENGL
  QMAKE_LIBS_OPENGL       = -lGL
  QMAKE_LIBS_OPENGL_ES2   = -lGLESv2
  
  load(qt_config)
  </code></pre>
  <ol>
  <li>I can see the opengl libraries under rpi-sdk/sysroot/usr/lib/arm-linux-gnueabihf and rpi-sdk/sysroot/lib/arm-linux-gnueabihf. As per my understanding sysroot/lib is a link to sysroot/usr/lib</li>
  <li>Using following command to configure for cross compilation:<br/>
  <em>qtbase/configure -release -opengl es2 -nomake examples -nomake tests -qt-host-path $HOME/QT_COMPILATION/qt-host -extprefix $HOME/QT_COMPILATION/qt-rpi -prefix $HOME/QT_COMPILATION/qt-rpi -- -DCMAKE_TOOLCHAIN_FILE=$HOME/rpi-sdk/toolchain.cmake -DQT_BUILD_TOOLS_WHEN_CROSSCOMPILING=ON</em></li>
  </ol>
  <p>I am getting following errors:<br/></p>
  <pre><code>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.
  
  CMake Error at cmake/QtBuildInformation.cmake:72 (message):
    Check the configuration messages for an error that has occurred.
  Call Stack (most recent call first):
    cmake/QtBuildInformation.cmake:10 (qt_configure_print_summary)
    cmake/QtBuildInternals/QtBuildInternalsConfig.cmake:365 (qt_print_feature_summary)
    CMakeLists.txt:132 (qt_build_repo_end)
  </code></pre>
  <p>Please let me know if anything wrong I am doing here.</p>