I'm trying to build a Qt6.4.0 cross compiler on Ubuntu 20.0.4 (Host PC) for Raspberry Pi3 B+ according to this tutorial. But this manual is designed for connection to Raspberry PI4. I need to get a toolchain.cmake file to build Qt for Raspberry Pi3. I am noob in CMake, I need sombody check my toolchain.cmake file and ./configure command below because I change it for Raspberry Pi3 without full understanding. I did everything according to the manual and my folders names correspond.
There is toolchain.cmake file from manual for Raspberry Pi4:
There is my toolchain.cmake file which I changed for Raspberry Pi3(please check it for correctness):
cmake_minimum_required(VERSION 3.18) include_guard(GLOBAL) set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR arm) set(TARGET_SYSROOT /) set(CMAKE_SYSROOT ${TARGET_SYSROOT}) set(ENV{PKG_CONFIG_PATH} $PKG_CONFIG_PATH:/usr/lib/arm-linux-gnueabihf/pkgconfig) set(ENV{PKG_CONFIG_LIBDIR} /usr/lib/pkgconfig:/usr/share/pkgconfig/:${TARGET_SYSROOT}/usr/lib/arm-linux-gnueabihf/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/arm-linux-gnueabihf-gcc-9) set(CMAKE_CXX_COMPILER /usr/bin/arm-linux-gnueabihf-g++-9) 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 "-march=armv7") 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/arm-linux-gnueabihf/:${TARGET_SYSROOT}/usr:${TARGET_SYSROOT}/usr/lib) set(EGL_INCLUDE_DIR ${GL_INC_DIR}) set(EGL_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/arm-linux-gnueabihf/libEGL.so) set(OPENGL_INCLUDE_DIR ${GL_INC_DIR}) set(OPENGL_opengl_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/arm-linux-gnueabihf/libOpenGL.so) set(GLESv2_INCLUDE_DIR ${GL_INC_DIR}) set(GLESv2_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/arm-linux-gnueabihf/libGLESv2.so) set(gbm_INCLUDE_DIR ${GL_INC_DIR}) set(gbm_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/arm-linux-gnueabihf/libgbm.so) set(Libdrm_INCLUDE_DIR ${GL_INC_DIR}) set(Libdrm_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/arm-linux-gnueabihf/libdrm.so) set(XCB_XCB_INCLUDE_DIR ${GL_INC_DIR}) set(XCB_XCB_LIBRARY ${XCB_PATH_VARIABLE}/usr/lib/arm-linux-gnueabihf/libxcb.so)I set set(TARGET_SYSROOT /) with root folder of my Host PC - is it correct? Because sysroot of Raspberry it is a folder rpi-sysroot on Host PC according to manual.
Compiler lib is: /usr/lib/arm-linux-gnueabihf
Installed compilers: /usr/bin/arm-linux-gnueabihf-gcc-9
/usr/bin/arm-linux-gnueabihf-g++-9
Sysroot folder: ~/rpi-sysroot
Arch of Raspberry Pi3 B+: armv7l
There is /configure command from manual for Raspberry Pi4:
../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=ONThere is my /configure command which I changed for Raspberry Pi3(please check it for correctness):
../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-pi3-g++ -device-option CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- -- -DCMAKE_TOOLCHAIN_FILE=$HOME/toolchain.cmake -DQT_FEATURE_xcb=ON -DFEATURE_xcb_xlib=ON -DQT_FEATURE_xlib=ONI don't know what this line -device linux-rasp-pi3-g++ is related to because I don't define it anywhere and I copy that from another manual. Is this a compiler? Where is it located? But I use this compiler for cross compilation arm-linux-gnueabihf-, isn't it?
There is errors appeared when I start ../qt5/configure :
freetype ........................... no libpci ............................. no Note: Disabling X11 Accessibility Bridge: D-Bus or AT-SPI is missing. Note: Hunspell in Qt Virtual Keyboard is not enabled. Spelling correction will not be available. Note: Due to CMAKE_STAGING_PREFIX usage and an unfixed CMake bug, to ensure correct build time rpaths, directory-level install rules like ninja src/gui/install will not work. Check QTBUG-102592 for further details. WARNING: No backend for low level audio found. WARNING: QtWebEngine won't be built. Build requires CMake 3.19 or higher. WARNING: QtPdf won't be built. Build requires CMake 3.19 or higher. WARNING: Using bfd linker requires at least 4096 open files limit ERROR: Feature "opengl": Forcing to "ON" breaks its condition: QT_FEATURE_opengl_desktop OR QT_FEATURE_opengl_dynamic OR QT_FEATURE_opengles2 Condition values dump: QT_FEATURE_opengl_desktop = "OFF" QT_FEATURE_opengl_dynamic = "OFF" QT_FEATURE_opengles2 = "OFF" ERROR: Feature "xcb_xlib": Forcing to "ON" breaks its condition: QT_FEATURE_xlib AND X11_XCB_FOUND Condition values dump: QT_FEATURE_xlib = "ON" X11_XCB_FOUND = "FALSE" ERROR: The OpenGL functionality tests failed! You might need to modify the OpenGL package search path by setting the OpenGL_DIR CMake variable to the OpenGL library's installation directory. CMake Error at qtbase/cmake/QtBuildInformation.cmake:181 (message): Check the configuration messages for an error that has occurred. Call Stack (most recent call first): qtbase/cmake/QtBuildInformation.cmake:21 (qt_configure_print_summary) CMakeLists.txt:111 (qt_print_feature_summary) -- Configuring incomplete, errors occurred! See also "/home/vboxuser/qtpi-build/CMakeFiles/CMakeOutput.log". See also "/home/vboxuser/qtpi-build/CMakeFiles/CMakeError.log". CMake Error at /home/vboxuser/qt5/qtbase/cmake/QtProcessConfigureArgs.cmake:965 (message): CMake exited with code 1.I'm not sure, maybe these errors appeared due to incorrect my toolchain.cmake file or wrong ./configure command?
Please help)