<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Cross compile Qt6 on raspberry pi]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I tried to cross compile Qt v6.1.0 for my raspberry pi 4 vith 64bit raspbian on it.<br />
I follow this tutorial <a href="https://wiki.qt.io/Cross-Compile_Qt_6_for_Raspberry_Pi" target="_blank" rel="noopener noreferrer nofollow ugc">Cross-Compile Qt 6 for Raspberry Pi</a></p>
<p dir="auto">I am on a virtual box in a linux ubuntu jellyfish 22.0.4.</p>
<p dir="auto">I compiled only qt base for the beginning and the firt part of the operation (host compilation) was successfull</p>
<p dir="auto">I am stuck to the cross compiling configure. When I run cmake a get errors</p>
<pre><code>CMake Error at qtbase/src/corelib/Qt6CoreMacros.cmake:2061 (add_library):
  Target "Gui" links to target "GLESv2::GLESv2" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?
Call Stack (most recent call first):
  qtbase/cmake/QtModuleHelpers.cmake:130 (_qt_internal_add_library)
  qtbase/src/gui/CMakeLists.txt:53 (qt_internal_add_module)

</code></pre>
<p dir="auto">as I understand it seems that cmake cannot find GLESv2 library, but think my sysroot is correctly set and I can find the file <a href="http://libGLESv2.so" target="_blank" rel="noopener noreferrer nofollow ugc">libGLESv2.so</a> in sysroot/usr/lib nd also in /opt/vc.<br />
Although the sim links are correctly set</p>
<p dir="auto">I tried to find an answer on other forums but i did not found any post with a similar problem to mine.<br />
I used this command</p>
<pre><code>../qt5/configure -release -opengl es2 -nomake examples -nomake tests -qt-host-path $HOME/qt-host -extprefix $HOME/qt-raspi -prefix /usr/local/qt6 -device linux-rasp-pi4-aarch64 -device-option CROSS_COMPILE=aarch64-linux-gnu- -- -DCMAKE_TOOLCHAIN_FILE=$HOME/toolchain.cmake -DQT_FEATURE_xcb=ON -DFEATURE_xcb_xlib=ON -DQT_FEATURE_xlib=ON -DQT_FEATURE_opengles2=ON

</code></pre>
<p dir="auto">This is my toolchain file</p>
<pre><code>cmake_minimum_required(VERSION 3.18)
include_guard(GLOBAL)

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)

set(TARGET_SYSROOT /home/fangry/rpi-sysroot)
set(CMAKE_SYSROOT ${TARGET_SYSROOT})

set(ENV{PKG_CONFIG_PATH} $PKG_CONFIG_PATH:/usr/lib/aarch64-linux-gnu/pkgconfig)
set(ENV{PKG_CONFIG_LIBDIR} /usr/lib/pkgconfig:/usr/share/pkgconfig/:${TARGET_SYSROOT}/usr/lib/aarch64-linux-gnu/pkgconfig:${TARGET_SYSROOT}/usr/lib/pkgconfig)
set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})

# if you use other version of gcc and g++ than gcc/g++ 9, you must change the following variables
set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc-11)
set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++-11)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${TARGET_SYSROOT}/usr/include")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")

set(QT_COMPILER_FLAGS "-march=armv8-a")
set(QT_COMPILER_FLAGS_RELEASE "-O2 -pipe")
set(QT_LINKER_FLAGS "-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed")

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)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_BUILD_RPATH ${TARGET_SYSROOT})


include(CMakeInitializeConfigs)

function(cmake_initialize_per_config_variable _PREFIX _DOCSTRING)
  if (_PREFIX MATCHES "CMAKE_(C|CXX|ASM)_FLAGS")
    set(CMAKE_${CMAKE_MATCH_1}_FLAGS_INIT "${QT_COMPILER_FLAGS}")

    foreach (config DEBUG RELEASE MINSIZEREL RELWITHDEBINFO)
      if (DEFINED QT_COMPILER_FLAGS_${config})
        set(CMAKE_${CMAKE_MATCH_1}_FLAGS_${config}_INIT "${QT_COMPILER_FLAGS_${config}}")
      endif()
    endforeach()
  endif()


  if (_PREFIX MATCHES "CMAKE_(SHARED|MODULE|EXE)_LINKER_FLAGS")
    foreach (config SHARED MODULE EXE)
      set(CMAKE_${config}_LINKER_FLAGS_INIT "${QT_LINKER_FLAGS}")
    endforeach()
  endif()

  _cmake_initialize_per_config_variable(${ARGV})
endfunction()

set(XCB_PATH_VARIABLE ${TARGET_SYSROOT})

set(GL_INC_DIR ${TARGET_SYSROOT}/usr/include)
set(GL_LIB_DIR ${TARGET_SYSROOT}:${TARGET_SYSROOT}/usr/lib/aarch64-linux-gnu/:${TARGET_SYSROOT}/usr:${TARGET_SYSROOT}/usr/lib)

set(EGL_INCLUDE_DIR ${GL_INC_DIR})
set(EGL_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/aarch64-linux-gnu/libEGL.so)

set(OPENGL_INCLUDE_DIR ${GL_INC_DIR})
set(OPENGL_opengl_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/aarch64-linux-gnu/libOpenGL.so)

set(GLESv2_INCLUDE_DIR ${GL_INC_DIR})
set(GLIB_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/aarch64-linux-gnu/libGLESv2.so)

set(GLESv2_INCLUDE_DIR ${GL_INC_DIR})
set(GLESv2_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/aarch64-linux-gnu/libGLESv2.so)

set(gbm_INCLUDE_DIR ${GL_INC_DIR})
set(gbm_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/aarch64-linux-gnu/libgbm.so)

set(Libdrm_INCLUDE_DIR ${GL_INC_DIR})
set(Libdrm_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/aarch64-linux-gnu/libdrm.so)

set(XCB_XCB_INCLUDE_DIR ${GL_INC_DIR})
set(XCB_XCB_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/aarch64-linux-gnu/libxcb.so)
</code></pre>
<p dir="auto">Could you help me to understand what happened and help me to achieve this cross compile.</p>
<p dir="auto">Thank you</p>
]]></description><link>https://forum.qt.io/topic/141317/cross-compile-qt6-on-raspberry-pi</link><generator>RSS for Node</generator><lastBuildDate>Thu, 02 Jul 2026 09:47:34 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/141317.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 Dec 2022 14:56:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Cross compile Qt6 on raspberry pi on Thu, 08 Dec 2022 10:32:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fangry">@<bdi>Fangry</bdi></a> said in <a href="/post/739440">Cross compile Qt6 on raspberry pi</a>:</p>
<blockquote>
<p dir="auto">Hi,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> said in <a href="/post/739437">Cross compile Qt6 on raspberry pi</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fangry">@<bdi>Fangry</bdi></a> said in <a href="/post/739352">Cross compile Qt6 on raspberry pi</a>:</p>
<blockquote>
<p dir="auto">and I can find the file <a href="http://libGLESv2.so" target="_blank" rel="noopener noreferrer nofollow ugc">libGLESv2.so</a> in sysroot/usr/lib</p>
</blockquote>
<p dir="auto">Can you also find its header files? For building library itself is not enough.</p>
</blockquote>
<p dir="auto">I will check that immediately.</p>
<p dir="auto">I also make more search and I find an start of an answer by reading this <a href="https://forum.qt.io/topic/140134/qt-6-0-build-for-raspberry-pi-4-opengl-functionality-tests-failed">post</a></p>
<p dir="auto">When I check the result of the tests have EGL and have GLES I found that errors occurs with the link with glibc<br />
more precisely i have an undifined reference to function@glibc_private</p>
</blockquote>
<p dir="auto">So I check my include sysroot and I have the include files correctly set.</p>
<p dir="auto">I Check again the cmake error log and i found some error before have EGL.<br />
More precisely from building files with ld.</p>
<pre><code>Performing C++ SOURCE FILE Test TEST_use_lld_linker failed with the following output:
Change Dir: /home/fangry/qtpi-build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/ninja cmTC_a7ba6 &amp;&amp; [1/2] Building CXX object CMakeFiles/cmTC_a7ba6.dir/src.cxx.o
[2/2] Linking CXX executable cmTC_a7ba6
FAILED: cmTC_a7ba6 
: &amp;&amp; /usr/bin/aarch64-linux-gnu-g++-11 --sysroot=/home/fangry/rpi-sysroot -I/home/fangry/rpi-sysroot/usr/include -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed    -fuse-ld=lld CMakeFiles/cmTC_a7ba6.dir/src.cxx.o -o cmTC_a7ba6  -Wl,-rpath,/home/fangry/rpi-sysroot &amp;&amp; :
collect2: fatal error: cannot find ‘ld’
compilation terminated.
ninja: build stopped: subcommand failed.


Source file was:
int main() { return 0; }
Performing C++ SOURCE FILE Test TEST_gdb_index failed with the following output:
Change Dir: /home/fangry/qtpi-build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/ninja cmTC_88e8c &amp;&amp; [1/2] Building CXX object CMakeFiles/cmTC_88e8c.dir/src.cxx.o
[2/2] Linking CXX executable cmTC_88e8c
FAILED: cmTC_88e8c 
: &amp;&amp; /usr/bin/aarch64-linux-gnu-g++-11 --sysroot=/home/fangry/rpi-sysroot -I/home/fangry/rpi-sysroot/usr/include -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed    -Wl,--gdb-index CMakeFiles/cmTC_88e8c.dir/src.cxx.o -o cmTC_88e8c  -Wl,-rpath,/home/fangry/rpi-sysroot &amp;&amp; :
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: unrecognized option '--gdb-index'
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

</code></pre>
<p dir="auto">It seems that aarch64  gnu ld in version 11 does not take --gdb-index in option. how can i remove it frome build ?</p>
]]></description><link>https://forum.qt.io/post/739463</link><guid isPermaLink="true">https://forum.qt.io/post/739463</guid><dc:creator><![CDATA[Fangry]]></dc:creator><pubDate>Thu, 08 Dec 2022 10:32:46 GMT</pubDate></item><item><title><![CDATA[Reply to Cross compile Qt6 on raspberry pi on Thu, 08 Dec 2022 07:41:09 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> said in <a href="/post/739437">Cross compile Qt6 on raspberry pi</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fangry">@<bdi>Fangry</bdi></a> said in <a href="/post/739352">Cross compile Qt6 on raspberry pi</a>:</p>
<blockquote>
<p dir="auto">and I can find the file <a href="http://libGLESv2.so" target="_blank" rel="noopener noreferrer nofollow ugc">libGLESv2.so</a> in sysroot/usr/lib</p>
</blockquote>
<p dir="auto">Can you also find its header files? For building library itself is not enough.</p>
</blockquote>
<p dir="auto">I will check that immediately.</p>
<p dir="auto">I also make more search and I find an start of an answer by reading this <a href="https://forum.qt.io/topic/140134/qt-6-0-build-for-raspberry-pi-4-opengl-functionality-tests-failed">post</a></p>
<p dir="auto">When I check the result of the tests have EGL and have GLES I found that errors occurs with the link with glibc<br />
more precisely i have an undifined reference to function@glibc_private</p>
]]></description><link>https://forum.qt.io/post/739440</link><guid isPermaLink="true">https://forum.qt.io/post/739440</guid><dc:creator><![CDATA[Fangry]]></dc:creator><pubDate>Thu, 08 Dec 2022 07:41:09 GMT</pubDate></item><item><title><![CDATA[Reply to Cross compile Qt6 on raspberry pi on Thu, 08 Dec 2022 06:50:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fangry">@<bdi>Fangry</bdi></a> said in <a href="/post/739352">Cross compile Qt6 on raspberry pi</a>:</p>
<blockquote>
<p dir="auto">and I can find the file <a href="http://libGLESv2.so" target="_blank" rel="noopener noreferrer nofollow ugc">libGLESv2.so</a> in sysroot/usr/lib</p>
</blockquote>
<p dir="auto">Can you also find its header files? For building library itself is not enough.</p>
]]></description><link>https://forum.qt.io/post/739437</link><guid isPermaLink="true">https://forum.qt.io/post/739437</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Thu, 08 Dec 2022 06:50:46 GMT</pubDate></item></channel></rss>