为 raspberry pi 4 交叉编译 qt6
Crosscompile qt6 for raspberry pi 4
我读过这个 qt6 doc,所以我开始玩这个,但也许文档泄露了一些信息并且配置步骤很快失败并出现此错误:
CMake Error at cmake/QtBaseConfigureTests.cmake:21 (message):
Failed to compile architecture detection file.
Call Stack (most recent call first):
cmake/QtBaseConfigureTests.cmake:120 (qt_run_config_test_architecture)
cmake/QtBaseConfigureTests.cmake:133 (qt_run_qtbase_config_tests)
CMakeLists.txt:68 (include)
我的 cmake 命令在这里:
'/usr/local/bin/cmake' '-DQT_HOST_PATH=/opt/qt6/6.0.1/gcc_64' '-DCMAKE_TOOLCHAIN_FILE=/home/mattia/raspi4-qt6/qt-cross/toolchain.cmake' '-DQT_BUILD_TOOLS_WHEN_CROSSCOMPILING=ON' '-DCMAKE_INSTALL_PREFIX=/usr/local/qt_v6.0.1' '-DCMAKE_STAGING_PREFIX=/home/mattia/raspi4-qt6/build/qt_v6.0.1' '-DQT_BUILD_EXAMPLES=FALSE' '-DQT_BUILD_TESTS=FALSE' '-DCMAKE_BUILD_TYPE=Release' '-DINPUT_opengl=es2' '-DINPUT_eglfs=ON' '-G' 'Ninja' '/home/mattia/raspi4-qt6/src/qtbase
虽然我的 toolchaine.cmake 在这里:
cmake_minimum_required(VERSION 3.18)
include_guard(GLOBAL)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR armv8)
set(TARGET_SYSROOT /home/mattia/raspi4-qt6/sysroot)
set(CROSS_COMPILER /home/mattia/raspi4-qt6/tools/cross-pi-gcc-10.2.0-2/bin)
set(CMAKE_SYSROOT ${TARGET_SYSROOT})
set(CMAKE_C_COMPILER ${CROSS_COMPILER}/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER ${CROSS_COMPILER}/arm-linux-gnueabihf-g++)
set(ENV{PKG_CONFIG_PATH} "")
set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_SYSROOT}/usr/lib/arm-gnueabihf/pkgconfig:${CMAKE_SYSROOT}/usr/share/pkgconfig)
set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})
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)
我想您正在使用 Cygwin。我对 cygwin 有同样的问题,因为 ARM 编译器不理解 cygwin 路径 /cygdrive/d/cygwin/home.....
要在 windows 主机上交叉编译 qt6,请使用 windows cmake 和 windows CMD。不需要 Cygwin..
您链接的文档对我来说工作正常。我在这里添加了更多注释:https://thebugfreeblog.blogspot.com/2021/09/qt-6-on-raspberry-pi-on-eglfs.html。也许您可以尝试使用我在文章中链接的工具链。
我读过这个 qt6 doc,所以我开始玩这个,但也许文档泄露了一些信息并且配置步骤很快失败并出现此错误:
CMake Error at cmake/QtBaseConfigureTests.cmake:21 (message):
Failed to compile architecture detection file.
Call Stack (most recent call first):
cmake/QtBaseConfigureTests.cmake:120 (qt_run_config_test_architecture)
cmake/QtBaseConfigureTests.cmake:133 (qt_run_qtbase_config_tests)
CMakeLists.txt:68 (include)
我的 cmake 命令在这里:
'/usr/local/bin/cmake' '-DQT_HOST_PATH=/opt/qt6/6.0.1/gcc_64' '-DCMAKE_TOOLCHAIN_FILE=/home/mattia/raspi4-qt6/qt-cross/toolchain.cmake' '-DQT_BUILD_TOOLS_WHEN_CROSSCOMPILING=ON' '-DCMAKE_INSTALL_PREFIX=/usr/local/qt_v6.0.1' '-DCMAKE_STAGING_PREFIX=/home/mattia/raspi4-qt6/build/qt_v6.0.1' '-DQT_BUILD_EXAMPLES=FALSE' '-DQT_BUILD_TESTS=FALSE' '-DCMAKE_BUILD_TYPE=Release' '-DINPUT_opengl=es2' '-DINPUT_eglfs=ON' '-G' 'Ninja' '/home/mattia/raspi4-qt6/src/qtbase
虽然我的 toolchaine.cmake 在这里:
cmake_minimum_required(VERSION 3.18)
include_guard(GLOBAL)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR armv8)
set(TARGET_SYSROOT /home/mattia/raspi4-qt6/sysroot)
set(CROSS_COMPILER /home/mattia/raspi4-qt6/tools/cross-pi-gcc-10.2.0-2/bin)
set(CMAKE_SYSROOT ${TARGET_SYSROOT})
set(CMAKE_C_COMPILER ${CROSS_COMPILER}/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER ${CROSS_COMPILER}/arm-linux-gnueabihf-g++)
set(ENV{PKG_CONFIG_PATH} "")
set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_SYSROOT}/usr/lib/arm-gnueabihf/pkgconfig:${CMAKE_SYSROOT}/usr/share/pkgconfig)
set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})
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)
我想您正在使用 Cygwin。我对 cygwin 有同样的问题,因为 ARM 编译器不理解 cygwin 路径 /cygdrive/d/cygwin/home.....
要在 windows 主机上交叉编译 qt6,请使用 windows cmake 和 windows CMD。不需要 Cygwin..
您链接的文档对我来说工作正常。我在这里添加了更多注释:https://thebugfreeblog.blogspot.com/2021/09/qt-6-on-raspberry-pi-on-eglfs.html。也许您可以尝试使用我在文章中链接的工具链。