当前位置:   article > 正文

基于Ubuntu22.04交叉编译Arm Qt6.4_ubuntu16.04 arm linux 编译qt6.5

ubuntu16.04 arm linux 编译qt6.5

构建 ubuntu 22.04 arm64 根文件系统

参考:使用Ubuntu-base构建根文件系统_CoooStar的博客-CSDN博客

配置 toolchain 文件

  1. cmake_minimum_required(VERSION 3.18)
  2. include_guard(GLOBAL)
  3. set(CMAKE_SYSTEM_NAME Linux)
  4. set(CMAKE_SYSTEM_PROCESSOR arm)
  5. #set(TARGET_SYSROOT /home/mc/Projects/rk3588_linux/ubuntu/binary)
  6. set(TARGET_SYSROOT /home/mc/build_qt6_arm/rootfs)
  7. #set(CROSS_COMPILER /opt/toolchain/bin/aarch64-none-linux-gnu-)
  8. set(CROSS_COMPILER /usr/bin/aarch64-linux-gnu-)
  9. set(CMAKE_SYSROOT ${TARGET_SYSROOT})
  10. set(ENV{PKG_CONFIG_PATH} "")
  11. set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_SYSROOT}/usr/lib/pkgconfig:${CMAKE_SYSROOT}/usr/share/pkgconfig)
  12. set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})
  13. set(CMAKE_C_COMPILER ${CROSS_COMPILER}gcc)
  14. set(CMAKE_CXX_COMPILER ${CROSS_COMPILER}g++)
  15. set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  16. set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  17. set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  18. set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
  19. include(CMakeInitializeConfigs)
  20. function(cmake_initialize_per_config_variable _PREFIX _DOCSTRING)
  21. if (_PREFIX MATCHES "CMAKE_(C|CXX|ASM)_FLAGS")
  22. set(CMAKE_${CMAKE_MATCH_1}_FLAGS_INIT "${QT_COMPILER_FLAGS}")
  23. foreach (config DEBUG RELEASE MINSIZEREL RELWITHDEBINFO)
  24. if (DEFINED QT_COMPILER_FLAGS_${config})
  25. set(CMAKE_${CMAKE_MATCH_1}_FLAGS_${config}_INIT "${QT_COMPILER_FLAGS_${config}}")
  26. endif()
  27. endforeach()
  28. endif()
  29. if (_PREFIX MATCHES "CMAKE_(SHARED|MODULE|EXE)_LINKER_FLAGS")
  30. foreach (config SHARED MODULE EXE)
  31. set(CMAKE_${config}_LINKER_FLAGS_INIT "${QT_LINKER_FLAGS}")
  32. endforeach()
  33. endif()
  34. _cmake_initialize_per_config_variable(${ARGV})
  35. endfunction()

执行构建

  1. $HOME/build_qt6_arm/qt-everywhere-src-6.4.3/configure \
  2. -release -nomake examples -nomake tests -no-opengl \
  3. -qt-host-path /opt/Qt/6.4.3/gcc_64 \
  4. -prefix /opt/qt6-arm64 \
  5. -- -DCMAKE_TOOLCHAIN_FILE=$HOME/build_qt6_arm/toolchain.cmake
  6. cmake --build buildQt6 --parallel
  7. cmake --install buildQt6

参考资料

配置嵌入式 Linux 设备 |Qt 6.4

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/535415
推荐阅读
相关标签
  

闽ICP备14008679号