顯示具有 Qt 標籤的文章。 顯示所有文章
顯示具有 Qt 標籤的文章。 顯示所有文章

2025年5月14日 星期三

Cross-compile for QT6

先說結論…一定要先編一次x86,才能再cross compiler...= ="
環境:
1. x86 PC
2. 準備STM32MP2 for QT6
3. QT6 version 6.5.3, 下載
4. 因為一直卡在OpenGL的問題
    本來在build_x86編好後,再一個build_aarch64,
    aarch64一直出現OpenGL的問題,MP2的環境應該都有準備好,但還是解不掉
    突然想回頭再試一次x86,也出現一樣的問題@@
    後來砍掉,再解壓一次6.5.3.tar.xz,全部重來,aarch64就可以了 = ="
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:194 (message):
  Check the configuration messages for an error that has occurred.

Call Stack (most recent call first):
  qtbase/cmake/QtBuildInformation.cmake:24 (qt_configure_print_summary)
  CMakeLists.txt:127 (qt_print_feature_summary)
5. 不像QT5,交叉編譯後的qmake,就能幫qt code編成arm平台使用
    QT6的qmake編出來後只能給x86, 但是aarch64用起來就有問題...
    不管是buildroot編出來的
    還是整個6.5.3編出來的...
1. cd output/target/usr/bin
$ file qmake
qmake: POSIX shell script, ASCII text executable
$ file qmake6
qmake6: POSIX shell script, ASCII text executable

aarch64平台
$ ./qmake
./qmake: 7: /home/ubuntu/STMicroelectronics/buildroot_qt653/output/host/bin/qmake6: not found
$ ./qmake6
./qmake6: 7: /home/ubuntu/STMicroelectronics/buildroot_qt653/output/host/bin/qmake6: not found
$ ile /home/ubuntu/STMicroelectronics/buildroot_qt653/output/host/bin/qmake6
/home/ubuntu/STMicroelectronics/buildroot_qt653/output/host/bin/qmake6: ELF 64-bit LSB shared object, x86-64...
為什麼會連到x86...??
試著把此連結用aarch64的qmake6代替,qmake後,就會停在那,不會動
6. 可以用qt-cmake來編專案,只是要寫CmakeLists.txt

======================================================

STM32MP2環境:
1. buildroot-external-st, remotes/origin/st/2024.02.9
2. buildroot, remotes/origin/st/2024.02.9, 6ea7024a34d4e7f994a7d9ded573c340c8adba1e
3. 此版buildroot是6.8.1, 需自行手動更改成6.5.3
4. target config: st_stm32mp257f_dk_defconfig

======================================================

Build QT6.5.3 on x86 PC
$ mkdir build_x86; cd build_x86
$ cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DINPUT_opengl=es2 -DQT_BUILD_EXAMPLES=OFF -DQT_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/home/ubuntu/STMicroelectronics/QT6_Source/qt6Host_x86 ..

compile
//build code
//build_x86 folder
$ cmake --build . --parallel 2

//install
cmake --install .

x86 output

Building for: linux-g++ (x86_64, CPU features: mmx sse sse2)
Compiler: gcc 11.4.0
Build options:
  Mode ................................... release (with debug info)
  Optimize release build for size ........ no
  Fully optimize release builds (-O3) .... no
  Building shared libraries .............. yes
  Using C standard ....................... C11
  Using C++ standard ..................... C++17
  Using ccache ........................... no
  Unity Build ............................ no
  Using new DTAGS ........................ yes
  Generating GDB index ................... no
  Relocatable ............................ yes
  Using precompiled headers .............. yes
  Using Link Time Optimization (LTCG) .... no
  Using Intel CET ........................ yes
  Target compiler supports:
    x86 Intrinsics ....................... Basic VAES AVX512VBMI2
  Sanitizers:
    Addresses ............................ no
    Threads .............................. no
    Memory ............................... no
    Fuzzer (instrumentation only) ........ no
    Undefined ............................ no
  Build parts ............................ libs tools
Qt modules and options:
  Qt Concurrent .......................... yes
  Qt D-Bus ............................... yes
  Qt D-Bus directly linked to libdbus .... yes
  Qt Gui ................................. yes
  Qt Network ............................. yes
  Qt PrintSupport ........................ yes
  Qt Sql ................................. yes
  Qt Testlib ............................. yes
  Qt Widgets ............................. yes
  Qt Xml ................................. yes
Support enabled for:
  Using pkg-config ....................... yes
  udev ................................... yes
  OpenSSL ................................ yes
    Qt directly linked to OpenSSL ........ no
  OpenSSL 1.1 ............................ no
  OpenSSL 3.0 ............................ yes
  Using system zlib ...................... yes
  Zstandard support ...................... yes
  Thread support ......................... yes
Common build options:
  Linker can resolve circular dependencies  yes
Qt Core:
  backtrace .............................. yes
  DoubleConversion ....................... yes
    Using system DoubleConversion ........ no
  GLib ................................... yes
  ICU .................................... yes
  Using system libb2 ..................... no
  Built-in copy of the MIME database ..... yes
  cpp/winrt base ......................... no
  Tracing backend ........................ <none>
  Logging backends:
    journald ............................. no
    syslog ............................... no
    slog2 ................................ no
  PCRE2 .................................. yes
    Using system PCRE2 ................... yes
  CLONE_PIDFD support in forkfd .......... yes
  Application permissions ................ no
Qt Sql:
  SQL item models ........................ yes
Qt Network:
  getifaddrs() ........................... yes
  IPv6 ifname ............................ yes
  libproxy ............................... no
  Linux AF_NETLINK ....................... yes
  DTLS ................................... yes
  OCSP-stapling .......................... yes
  SCTP ................................... no
  Use system proxies ..................... yes
  GSSAPI ................................. no
  Brotli Decompression Support ........... yes
  qIsEffectiveTLD() ...................... yes
    Built-in publicsuffix database ....... yes
    System publicsuffix database ......... yes
Core tools:
  Android deployment tool ................ yes
  macOS deployment tool .................. no
  Windows deployment tool ................ no
  qmake .................................. yes
Qt Gui:
  Accessibility .......................... yes
  FreeType ............................... yes
    Using system FreeType ................ yes
  HarfBuzz ............................... yes
    Using system HarfBuzz ................ yes
  Fontconfig ............................. yes
  Image formats:
    GIF .................................. yes
    ICO .................................. yes
    JPEG ................................. yes
      Using system libjpeg ............... yes
    PNG .................................. yes
      Using system libpng ................ yes
  Text formats:
    HtmlParser ........................... yes
    CssParser ............................ yes
    OdfWriter ............................ yes
    MarkdownReader ....................... yes
      Using system libmd4c ............... no
    MarkdownWriter ....................... yes
  EGL .................................... yes
  OpenVG ................................. no
  OpenGL:
    Desktop OpenGL ....................... no
    OpenGL ES 2.0 ........................ yes
    OpenGL ES 3.0 ........................ yes
    OpenGL ES 3.1 ........................ yes
    OpenGL ES 3.2 ........................ yes
  Vulkan ................................. yes
  Session Management ..................... yes
Features used by QPA backends:
  evdev .................................. yes
  libinput ............................... no
  HiRes wheel support in libinput ........ no
  INTEGRITY HID .......................... no
  mtdev .................................. no
  tslib .................................. no
  xkbcommon .............................. yes
  X11 specific:
    XLib ................................. yes
    XCB Xlib ............................. no
    EGL on X11 ........................... yes
    xkbcommon-x11 ........................ no
    xcb-sm ............................... no
QPA backends:
  DirectFB ............................... no
  EGLFS .................................. yes
  EGLFS details:
    EGLFS OpenWFD ........................ no
    EGLFS i.Mx6 .......................... no
    EGLFS i.Mx6 Wayland .................. no
    EGLFS RCAR ........................... no
    EGLFS EGLDevice ...................... yes
    EGLFS GBM ............................ yes
    EGLFS VSP2 ........................... no
    EGLFS Mali ........................... no
    EGLFS Raspberry Pi ................... no
    EGLFS X11 ............................ no
  LinuxFB ................................ yes
  VNC .................................... yes
  VK_KHR_display ......................... yes
  QNX:
    lgmon ................................ no
    IMF .................................. no
  XCB:
    Using system-provided xcb-xinput ..... no
    GL integrations:
      GLX Plugin ......................... no
        XCB GLX .......................... no
      EGL-X11 Plugin ..................... no
  Windows:
    Direct 2D ............................ no
    Direct 2D 1.1 ........................ no
    DirectWrite .......................... no
    DirectWrite 3 ........................ no
Qt Widgets:
  GTK+ ................................... no
  Styles ................................. Fusion Windows
Qt Testlib:
  Tester for item models ................. yes
  Batch tests ............................ no
Qt PrintSupport:
  CUPS ................................... no
Qt Sql Drivers:
  DB2 (IBM) .............................. no
  InterBase .............................. no
  MySql .................................. no
  OCI (Oracle) ........................... no
  ODBC ................................... no
  PostgreSQL ............................. no
  SQLite ................................. yes
    Using system provided SQLite ......... no
Further Image Formats:
  JasPer ................................. no
  MNG .................................... no
  TIFF ................................... yes
    Using system libtiff ................. yes
  WEBP ................................... yes
    Using system libwebp ................. no
Qt QML:
  QML network support .................... yes
  QML debugging and profiling support .... yes
  QML just-in-time compiler .............. yes
  QML XML http request ................... yes
  QML Locale ............................. yes
Qt QML Models:
  QML list model ......................... yes
  QML delegate model ..................... yes
Qt Quick:
  AnimatedImage item ..................... yes
  Canvas item ............................ yes
  Support for Qt Quick Designer .......... yes
  Flipable item .......................... yes
  GridView item .......................... yes
  ListView item .......................... yes
  TableView item ......................... yes
  TreeView item .......................... yes
  Path support ........................... yes
  PathView item .......................... yes
  Positioner items ....................... yes
  Repeater item .......................... yes
  ShaderEffect item ...................... yes
  Sprite item ............................ yes
Qt Quick Templates 2:
  Hover support .......................... yes
  Multi-touch support .................... yes
  Calendar support ....................... yes
Qt Quick Controls 2:
  Styles ................................. Basic Fusion Imagine iOS Material Universal macOS Windows
QtQuick3D:
  Assimp ................................. yes
  System Assimp .......................... no
Qt Multimedia:
  Spatial Audio .......................... yes
  Spatial Audio (Quick3D) ................ yes
  Low level Audio Backend:
    ALSA (experimental) .................. no
    PulseAudio ........................... yes
    MMRenderer ........................... no
    CoreAudio ............................ no
    Windows Media SDK .................... no
    Open SLES (Android) .................. no
    Web Assembly ......................... no
  Plugin:
    GStreamer 1.0 ........................ no
    FFmpeg ............................... no
    MMRenderer ........................... no
    AVFoundation ......................... no
    Windows Media Foundation ............. no
  Hardware acceleration and features:
    Video for Linux ...................... yes
    VAAPI support ........................ no
    Linux DMA buffer support ............. yes
    VideoToolbox ......................... no
Qt 3D:
  Assimp ................................. yes
  System Assimp .......................... no
  Use SSE2 instructions .................. yes
  Use AVX2 instructions .................. no
  Aspects:
    Render aspect ........................ yes
    Input aspect ......................... yes
    Logic aspect ......................... yes
    Animation aspect ..................... yes
    Extras aspect ........................ yes
Qt 3D APIs:
  Vulkan ................................. yes
Qt 3D Renderers:
  OpenGL Renderer ........................ yes
  RHI Renderer ........................... yes
Qt3D Geometry Loaders:
  Autodesk FBX ........................... no
Qt 5 Compatibility Libraries:
  iconv .................................. no
Qt Charts Types:
  Area Chart ............................. yes
  Line Chart ............................. yes
  Spline Chart ........................... yes
  Scatter Chart .......................... yes
  Bar Chart .............................. yes
  Pie Chart .............................. yes
  Boxplot Chart .......................... yes
  Candlestick Chart ...................... yes
Qt Axis Types:
  DateTime Axis .......................... yes
Qt Bluetooth:
  BlueZ .................................. no
  BlueZ Low Energy ....................... no
  Linux Crypto API ....................... no
  WinRT Bluetooth API .................... no
Qt Tools:
  Qt Assistant ........................... yes
  QDoc ................................... yes
  Clang-based lupdate parser ............. yes
  Qt Designer ............................ yes
  Qt Distance Field Generator ............ yes
  Qt Linguist ............................ yes
  pixeltool .............................. yes
  qdbus .................................. yes
  Qt Attributions Scanner ................ yes
  qtdiag ................................. yes
  qtplugininfo ........................... yes
Serial Port:
  ntddmodm ............................... no
WebEngine Repository Build Options:
  Build Ninja ............................ no
  Build Gn ............................... yes
  Jumbo Build ............................ yes
  Developer build ........................ no
  Build QtWebEngine Modules:
    Build QtWebEngineCore ................ no
    Build QtWebEngineWidgets ............. no
    Build QtWebEngineQuick ............... no
  Build QtPdf Modules:
    Build QtPdfWidgets ................... no
    Build QtPdfQuick ..................... no
  Optional system libraries:
    re2 .................................. no
    icu .................................. no
    libwebp, libwebpmux and libwebpdemux . no
    opus ................................. no
    ffmpeg ............................... no
    libvpx ............................... no
    snappy ............................... no
    glib ................................. yes
    zlib ................................. yes
    minizip .............................. no
    libevent ............................. yes
    libxml2 and libxslt .................. no
    lcms2 ................................ no
    png .................................. yes
    jpeg ................................. yes
    libopenjpeg2 ......................... no
    harfbuzz ............................. no
    freetype ............................. yes
    libpci ............................... no
Qt Protobuf tools:
  Qt Protobuf generator .................. no
Qt GRPC:
  gRPC support ........................... yes
  Native gRPC support .................... no
Qt GRPC tools:
  Qt GRPC generator ...................... no
Qt Opcua:
  Open62541 .............................. yes
  Unified Automation C++ SDK ............. no
  Support for namespace 0 NodeId names ... yes
  Namespace 0 NodeIds generator .......... no
  Open62541 security support ............. yes
  Support for global discovery server .... yes
Qt Remote Objects:
  High Availability Manager (ham) ........ no
Qt Scxml:
  ECMAScript data model for QtScxml ...... yes
Qt Sensors:
  sensorfw ............................... no
  sensorfw_enabled_with_cmake ............ no
Qt SerialBus:
  Socket CAN ............................. yes
  Socket CAN FD .......................... yes
  SerialPort Support ..................... yes
Qt TextToSpeech:
  Flite .................................. no
  Flite with ALSA ........................ no
  Speech Dispatcher ...................... no
Qt Virtualkeyboard:
  Desktop integration .................... yes
  Built-in layouts ....................... yes
  Key navigation ......................... no
  Retro style as default ................. no
  Sensitive Debug ........................ no
  Cerence ................................ no
    Static Linking ....................... no
    Handwriting .......................... no
      Alphabetic ......................... no
      CJK ................................ no
    XT9 .................................. no
      XT9 Debug .......................... no
      XT9 9-key layouts .................. no
    Bundle resources ..................... no
      Handwriting ........................ no
      XT9 ................................ no
  Hunspell ............................... no
    Using Hunspell copy from 3rdparty/ ... no
  OpenWnn ................................ yes
  MyScript ............................... no
  Language support enabled for:
    Arabic ............................... yes
    Bulgarian ............................ yes
    Czech ................................ yes
    Danish ............................... yes
    German ............................... yes
    Greek ................................ yes
    English GB ........................... yes
    English US ........................... yes
    Spanish .............................. yes
    Spanish Mexico ....................... yes
    Estonian ............................. yes
    Farsi ................................ yes
    Finnish .............................. yes
    French Canada ........................ yes
    French France ........................ yes
    Hebrew ............................... yes
    Hindi ................................ yes
    Croatian ............................. yes
    Hungarian ............................ yes
    Indonesian ........................... yes
    Italian .............................. yes
    Japanese ............................. yes
    Korean ............................... yes
    Malay ................................ yes
    Norwegian ............................ yes
    Dutch ................................ yes
    Polish ............................... yes
    Portuguese Brazil .................... yes
    Portuguese Portugal .................. yes
    Romanian ............................. yes
    Russian .............................. yes
    Slovak ............................... yes
    Slovenian ............................ yes
    Albanian ............................. yes
    Serbian .............................. yes
    Swedish .............................. yes
    Thai ................................. yes
    Turkish .............................. yes
    Ukrainian ............................ yes
    Vietnamese ........................... yes
    Simplified Chinese ................... yes
    Traditional Chinese .................. yes
    HongKong Chinese ..................... no
  Traditional chinese input methods:
    Zhuyin ............................... yes
    Cangjie .............................. yes
Qt Wayland TextInput Protocol V4(WIP) .... no
Qt Wayland Client ........................ yes
Qt Wayland Compositor .................... yes
Qt Wayland Drivers:
  EGL .................................... yes
  Raspberry Pi ........................... no
  DRM EGL ................................ yes
  libhybris EGL .......................... no
  Linux dma-buf server buffer integration  yes
  Shm emulation server buffer integration  yes
  Vulkan-based server buffer integration . yes
Qt Wayland Client Shell Integrations:
  xdg-shell .............................. yes
  ivi-shell .............................. yes
  wl-shell (deprecated) .................. yes
  qt-shell ............................... yes
Qt Wayland Compositor Layer Plugins:
  VSP2 hardware layer integration ........ no
Note: Hunspell in Qt Virtual Keyboard is not enabled. Spelling correction will not be available.
WARNING: QtWebEngine won't be built. Python3 html5lib is missing.
WARNING: QtPdf won't be built. Python3 html5lib is missing.
WARNING: SensorFW support currently not enabled with cmake

==========================================================
Build QT6.5.3 for aarch64
1. Create a sysroot folder, ex, $HOME/STMicroelectronics/QT6_Source/sysroot
    a. Copy it from buildroot, ex: $HOME/STMicroelectronics/buildroot_qt653/output/host/aarch64-  buildroot-linux-gnu/sysroot
    or
    b. Copy usr/ and lib/ from your target aarch64 platform.
$ ls /home/ubuntu/STMicroelectronics/buildroot_qt653/output/host/aarch64-buildroot-linux-gnu/sysroot
bin  dev  etc  lib  lib64(softlink to lib)  media  mnt  opt  proc  root  run  sbin  sys  tmp  usr  var

2. aarch64.cmake, copy it from 鲁班猫Qt应用开发实战
# 这里设置cmake支持的最小版本
cmake_minimum_required(VERSION 3.18)
include_guard(GLOBAL)

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)

# 指定sysroot目录
set(TARGET_SYSROOT /home/ubuntu/STMicroelectronics/QT6_Source/sysroot)

# 指定前面获取的交叉编译器路径
set(CROSS_COMPILER /usr/bin/aarch64-linux-gnu)

set(CMAKE_SYSROOT ${TARGET_SYSROOT})

set(CMAKE_C_COMPILER ${CROSS_COMPILER}-gcc)
set(CMAKE_CXX_COMPILER ${CROSS_COMPILER}-g++)

set(CMAKE_LIBRARY_ARCHITECTURE )

# 库路径
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wl,-rpath-link,${CMAKE_SYSROOT}/lib/${CMAKE_LIBRARY_ARCHITECTURE} -fPIC -Wl,-rpath-link,${CMAKE_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} -L${CMAKE_SYSROOT}/lib -L${CMAKE_SYSROOT}/lib/${CMAKE_LIBRARY_ARCHITECTURE}  -L${CMAKE_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} -L${CMAKE_SYSROOT}/usr/lib -I${TARGET_SYSROOT}/usr/include -I${TARGET_SYSROOT}/usr/include/${CMAKE_LIBRARY_ARCHITECTURE}")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")

# pkg config路径
set(ENV{PKG_CONFIG_PATH} ${TARGET_SYSROOT}/usr/lib/pkgconfig:${TARGET_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig:${TARGET_SYSROOT}/usr/share/pkgconfig/)
set(ENV{PKG_CONFIG_LIBDIR} ${TARGET_SYSROOT}/usr/lib/pkgconfig:${TARGET_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig:${TARGET_SYSROOT}/usr/share/pkgconfig/)
set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})

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 -Wl,-fuse-ld=gold -ldbus-1")

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)

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()

3. Cross compile on x86 PC
 $ mkdir build_aarch64; cd build_aarch64
$ cmake -GNinja \
      -DCMAKE_BUILD_TYPE=Release \
      -DINPUT_opengl=es2 \
      -DQT_BUILD_EXAMPLES=OFF \
      -DQT_BUILD_TESTS=OFF \
      -DQT_HOST_PATH=/home/ubuntu/STMicroelectronics/QT6_Source/qt6Host_x86 \
      -DCMAKE_STAGING_PREFIX=/home/ubuntu/STMicroelectronics/QT6_Source/sysroot/opt/prefix \
      -DCMAKE_INSTALL_PREFIX=/home/ubuntu/STMicroelectronics/QT6_Source/sysroot/opt/prefix \
      -DCMAKE_TOOLCHAIN_FILE=/home/ubuntu/STMicroelectronics/QT6_Source/qt-everywhere-src-6.5.3/aarch64.cmake \
      -DQT_FEATURE_xcb=ON \
      -DFEATURE_xcb_xlib=ON \
      -DQT_FEATURE_xlib=ON \
      -DFEATURE_qtwebengine_build=OFF ..


aarch64 output:


-- Configure summary:

Building for: linux-g++ (arm64, CPU features: cx16 neon)
Compiler: gcc 11.4.0
Build options:
  Mode ................................... release
  Optimize release build for size ........ no
  Fully optimize release builds (-O3) .... no
  Building shared libraries .............. yes
  Using C standard ....................... C11
  Using C++ standard ..................... C++17
  Using ccache ........................... no
  Unity Build ............................ no
  Using new DTAGS ........................ yes
  Relocatable ............................ yes
  Using precompiled headers .............. yes
  Using Link Time Optimization (LTCG) .... no
  Using Intel CET ........................ no
  Target compiler supports:
    ARM Extensions ....................... NEON
  Sanitizers:
    Addresses ............................ no
    Threads .............................. no
    Memory ............................... no
    Fuzzer (instrumentation only) ........ no
    Undefined ............................ no
  Build parts ............................ libs
Qt modules and options:
  Qt Concurrent .......................... yes
  Qt D-Bus ............................... yes
  Qt D-Bus directly linked to libdbus .... yes
  Qt Gui ................................. yes
  Qt Network ............................. yes
  Qt PrintSupport ........................ yes
  Qt Sql ................................. yes
  Qt Testlib ............................. yes
  Qt Widgets ............................. yes
  Qt Xml ................................. yes
Support enabled for:
  Using pkg-config ....................... yes
  udev ................................... no
  OpenSSL ................................ yes
    Qt directly linked to OpenSSL ........ no
  OpenSSL 1.1 ............................ no
  OpenSSL 3.0 ............................ yes
  Using system zlib ...................... yes
  Zstandard support ...................... no
  Thread support ......................... yes
Common build options:
  Linker can resolve circular dependencies  yes
Qt Core:
  backtrace .............................. yes
  DoubleConversion ....................... yes
    Using system DoubleConversion ........ yes
  GLib ................................... yes
  ICU .................................... no
  Using system libb2 ..................... yes
  Built-in copy of the MIME database ..... yes
  cpp/winrt base ......................... no
  Tracing backend ........................ <none>
  Logging backends:
    journald ............................. no
    syslog ............................... no
    slog2 ................................ no
  PCRE2 .................................. yes
    Using system PCRE2 ................... yes
  CLONE_PIDFD support in forkfd .......... yes
  Application permissions ................ no
Qt Sql:
  SQL item models ........................ yes
Qt Network:
  getifaddrs() ........................... yes
  IPv6 ifname ............................ yes
  libproxy ............................... no
  Linux AF_NETLINK ....................... yes
  DTLS ................................... yes
  OCSP-stapling .......................... yes
  SCTP ................................... no
  Use system proxies ..................... yes
  GSSAPI ................................. no
  Brotli Decompression Support ........... no
  qIsEffectiveTLD() ...................... yes
    Built-in publicsuffix database ....... yes
    System publicsuffix database ......... yes
Core tools:
  Android deployment tool ................ no
  macOS deployment tool .................. no
  Windows deployment tool ................ no
  qmake .................................. yes
Qt Gui:
  Accessibility .......................... yes
  FreeType ............................... yes
    Using system FreeType ................ yes
  HarfBuzz ............................... yes
    Using system HarfBuzz ................ no
  Fontconfig ............................. yes
  Image formats:
    GIF .................................. yes
    ICO .................................. yes
    JPEG ................................. yes
      Using system libjpeg ............... yes
    PNG .................................. yes
      Using system libpng ................ yes
  Text formats:
    HtmlParser ........................... yes
    CssParser ............................ yes
    OdfWriter ............................ yes
    MarkdownReader ....................... yes
      Using system libmd4c ............... no
    MarkdownWriter ....................... yes
  EGL .................................... yes
  OpenVG ................................. no
  OpenGL:
    Desktop OpenGL ....................... no
    OpenGL ES 2.0 ........................ yes
    OpenGL ES 3.0 ........................ yes
    OpenGL ES 3.1 ........................ yes
    OpenGL ES 3.2 ........................ yes
  Vulkan ................................. no
  Session Management ..................... yes
Features used by QPA backends:
  evdev .................................. yes
  libinput ............................... no
  HiRes wheel support in libinput ........ no
  INTEGRITY HID .......................... no
  mtdev .................................. no
  tslib .................................. no
  xkbcommon .............................. no
  X11 specific:
    xlib ................................. yes
    XCB Xlib ............................. yes
    EGL on X11 ........................... no
    xkbcommon-x11 ........................ no
    xcb-sm ............................... no
QPA backends:
  DirectFB ............................... no
  EGLFS .................................. yes
  EGLFS details:
    EGLFS OpenWFD ........................ no
    EGLFS i.Mx6 .......................... no
    EGLFS i.Mx6 Wayland .................. no
    EGLFS RCAR ........................... no
    EGLFS EGLDevice ...................... yes
    EGLFS GBM ............................ yes
    EGLFS VSP2 ........................... no
    EGLFS Mali ........................... no
    EGLFS Raspberry Pi ................... no
    EGLFS X11 ............................ no
  LinuxFB ................................ yes
  VNC .................................... yes
  VK_KHR_display ......................... no
  QNX:
    lgmon ................................ no
    IMF .................................. no
  XCB:
    Using system-provided xcb-xinput ..... no
    GL integrations:
      GLX Plugin ......................... no
        XCB GLX .......................... no
      EGL-X11 Plugin ..................... yes
  Windows:
    Direct 2D ............................ no
    Direct 2D 1.1 ........................ no
    DirectWrite .......................... no
    DirectWrite 3 ........................ no
Qt Widgets:
  GTK+ ................................... no
  Styles ................................. Fusion Windows
Qt Testlib:
  Tester for item models ................. yes
  Batch tests ............................ no
Qt PrintSupport:
  CUPS ................................... no
Qt Sql Drivers:
  DB2 (IBM) .............................. no
  InterBase .............................. no
  MySql .................................. no
  OCI (Oracle) ........................... no
  ODBC ................................... no
  PostgreSQL ............................. no
  SQLite ................................. yes
    Using system provided SQLite ......... no
Further Image Formats:
  JasPer ................................. no
  MNG .................................... no
  TIFF ................................... yes
    Using system libtiff ................. no
  WEBP ................................... yes
    Using system libwebp ................. no
Qt QML:
  QML network support .................... yes
  QML debugging and profiling support .... yes
  QML just-in-time compiler .............. yes
  QML XML http request ................... yes
  QML Locale ............................. yes
Qt QML Models:
  QML list model ......................... yes
  QML delegate model ..................... yes
Qt Quick:
  AnimatedImage item ..................... yes
  Canvas item ............................ yes
  Support for Qt Quick Designer .......... yes
  Flipable item .......................... yes
  GridView item .......................... yes
  ListView item .......................... yes
  TableView item ......................... yes
  TreeView item .......................... yes
  Path support ........................... yes
  PathView item .......................... yes
  Positioner items ....................... yes
  Repeater item .......................... yes
  ShaderEffect item ...................... yes
  Sprite item ............................ yes
Qt Quick Templates 2:
  Hover support .......................... yes
  Multi-touch support .................... yes
  Calendar support ....................... yes
Qt Quick Controls 2:
  Styles ................................. Basic Fusion Imagine iOS Material Universal macOS Windows
QtQuick3D:
  Assimp ................................. yes
  System Assimp .......................... no
Qt Multimedia:
  Spatial Audio .......................... yes
  Spatial Audio (Quick3D) ................ yes
  Low level Audio Backend:
    ALSA (experimental) .................. no
    PulseAudio ........................... yes
    MMRenderer ........................... no
    CoreAudio ............................ no
    Windows Media SDK .................... no
    Open SLES (Android) .................. no
    Web Assembly ......................... no
  Plugin:
    GStreamer 1.0 ........................ yes
    FFmpeg ............................... no
    MMRenderer ........................... no
    AVFoundation ......................... no
    Windows Media Foundation ............. no
  Hardware acceleration and features:
    Video for Linux ...................... yes
    VAAPI support ........................ no
    Linux DMA buffer support ............. yes
    VideoToolbox ......................... no
Qt 3D:
  Assimp ................................. yes
  System Assimp .......................... no
  Use SSE2 instructions .................. no
  Use AVX2 instructions .................. no
  Aspects:
    Render aspect ........................ yes
    Input aspect ......................... yes
    Logic aspect ......................... yes
    Animation aspect ..................... yes
    Extras aspect ........................ yes
Qt 3D APIs:
  Vulkan ................................. no
Qt 3D Renderers:
  OpenGL Renderer ........................ yes
  RHI Renderer ........................... yes
Qt3D Geometry Loaders:
  Autodesk FBX ........................... no
Qt 5 Compatibility Libraries:
  iconv .................................. yes
Qt Charts Types:
  Area Chart ............................. yes
  Line Chart ............................. yes
  Spline Chart ........................... yes
  Scatter Chart .......................... yes
  Bar Chart .............................. yes
  Pie Chart .............................. yes
  Boxplot Chart .......................... yes
  Candlestick Chart ...................... yes
Qt Axis Types:
  DateTime Axis .......................... yes
Qt Bluetooth:
  BlueZ .................................. no
  BlueZ Low Energy ....................... no
  Linux Crypto API ....................... no
  WinRT Bluetooth API .................... no
Qt Tools:
  Qt Assistant ........................... yes
  QDoc ................................... no
  Clang-based lupdate parser ............. no
  Qt Designer ............................ yes
  Qt Distance Field Generator ............ yes
  Qt Linguist ............................ yes
  pixeltool .............................. yes
  qdbus .................................. yes
  Qt Attributions Scanner ................ yes
  qtdiag ................................. yes
  qtplugininfo ........................... yes
Serial Port:
  ntddmodm ............................... no
WebEngine Repository Build Options:
  Build Ninja ............................ no
  Build Gn ............................... yes
  Jumbo Build ............................ yes
  Developer build ........................ no
  Build QtWebEngine Modules:
    Build QtWebEngineCore ................ no
    Build QtWebEngineWidgets ............. no
    Build QtWebEngineQuick ............... no
  Build QtPdf Modules:
    Build QtPdfWidgets ................... no
    Build QtPdfQuick ..................... no
  Optional system libraries:
    re2 .................................. no
    icu .................................. no
    libwebp, libwebpmux and libwebpdemux . no
    opus ................................. no
    ffmpeg ............................... no
    libvpx ............................... no
    snappy ............................... no
    glib ................................. yes
    zlib ................................. yes
    minizip .............................. no
    libevent ............................. no
    libxml2 and libxslt .................. no
    lcms2 ................................ no
    png .................................. yes
    jpeg ................................. yes
    libopenjpeg2 ......................... no
    harfbuzz ............................. no
    freetype ............................. yes
    libpci ............................... no
Qt Protobuf tools:
  Qt Protobuf generator .................. no
Qt GRPC:
  gRPC support ........................... yes
  Native gRPC support .................... no
Qt GRPC tools:
  Qt GRPC generator ...................... no
Qt Opcua:
  Open62541 .............................. yes
  Unified Automation C++ SDK ............. no
  Support for namespace 0 NodeId names ... yes
  Namespace 0 NodeIds generator .......... no
  Open62541 security support ............. yes
  Support for global discovery server .... yes
Qt Remote Objects:
  High Availability Manager (ham) ........ no
Qt Scxml:
  ECMAScript data model for QtScxml ...... yes
Qt Sensors:
  sensorfw ............................... no
  sensorfw_enabled_with_cmake ............ no
Qt SerialBus:
  Socket CAN ............................. yes
  Socket CAN FD .......................... yes
  SerialPort Support ..................... yes
Qt TextToSpeech:
  Flite .................................. no
  Flite with ALSA ........................ no
  Speech Dispatcher ...................... no
Qt Virtualkeyboard:
  Desktop integration .................... yes
  Built-in layouts ....................... yes
  Key navigation ......................... no
  Retro style as default ................. no
  Sensitive Debug ........................ no
  Cerence ................................ no
    Static Linking ....................... no
    Handwriting .......................... no
      Alphabetic ......................... no
      CJK ................................ no
    XT9 .................................. no
      XT9 Debug .......................... no
      XT9 9-key layouts .................. no
    Bundle resources ..................... no
      Handwriting ........................ no
      XT9 ................................ no
  Hunspell ............................... no
    Using Hunspell copy from 3rdparty/ ... no
  OpenWnn ................................ yes
  MyScript ............................... no
  Language support enabled for:
    Arabic ............................... yes
    Bulgarian ............................ yes
    Czech ................................ yes
    Danish ............................... yes
    German ............................... yes
    Greek ................................ yes
    English GB ........................... yes
    English US ........................... yes
    Spanish .............................. yes
    Spanish Mexico ....................... yes
    Estonian ............................. yes
    Farsi ................................ yes
    Finnish .............................. yes
    French Canada ........................ yes
    French France ........................ yes
    Hebrew ............................... yes
    Hindi ................................ yes
    Croatian ............................. yes
    Hungarian ............................ yes
    Indonesian ........................... yes
    Italian .............................. yes
    Japanese ............................. yes
    Korean ............................... yes
    Malay ................................ yes
    Norwegian ............................ yes
    Dutch ................................ yes
    Polish ............................... yes
    Portuguese Brazil .................... yes
    Portuguese Portugal .................. yes
    Romanian ............................. yes
    Russian .............................. yes
    Slovak ............................... yes
    Slovenian ............................ yes
    Albanian ............................. yes
    Serbian .............................. yes
    Swedish .............................. yes
    Thai ................................. yes
    Turkish .............................. yes
    Ukrainian ............................ yes
    Vietnamese ........................... yes
    Simplified Chinese ................... yes
    Traditional Chinese .................. yes
    HongKong Chinese ..................... no
  Traditional chinese input methods:
    Zhuyin ............................... yes
    Cangjie .............................. yes
Qt Wayland TextInput Protocol V4(WIP) .... no
Qt Wayland Client ........................ yes
Qt Wayland Compositor .................... yes
Qt Wayland Drivers:
  EGL .................................... yes
  Raspberry Pi ........................... no
  DRM EGL ................................ yes
  libhybris EGL .......................... no
  Linux dma-buf server buffer integration  yes
  Shm emulation server buffer integration  yes
  Vulkan-based server buffer integration . no
Qt Wayland Client Shell Integrations:
  xdg-shell .............................. yes
  ivi-shell .............................. yes
  wl-shell (deprecated) .................. yes
  qt-shell ............................... yes
Qt Wayland Compositor Layer Plugins:
  VSP2 hardware layer integration ........ no


NNote: 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: QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation.
Either set CMAKE_PREFIX_PATH or LLVM_INSTALL_DIR to the location of your llvm installation.
On Linux systems, you may be able to install libclang by installing the libclang-dev or libclang-devel package, depending on your distribution.
On macOS, you can use Homebrew's llvm package.
You will also need to set the FEATURE_clang CMake variable to ON to re-evaluate this check.
WARNING: Clang-based lupdate parser will not be available. LLVM and Clang C++ libraries have not been found.
You will need to set the FEATURE_clangcpp CMake variable to ON to re-evaluate this check.
WARNING: QtWebEngine won't be built. Python3 html5lib is missing.
WARNING: QtPdf won't be built. Python3 html5lib is missing.
WARNING: SensorFW support currently not enabled with cmake

--

Qt is now configured for building. Just run 'cmake --build . --parallel'

Once everything is built, you must run 'cmake --install .'
Qt will be installed into '/home/ubuntu/STMicroelectronics/QT6_Source/sysroot/opt/prefix'

To configure and build other Qt modules, you can use the following convenience script:
        /home/ubuntu/STMicroelectronics/QT6_Source/sysroot/opt/prefix/bin/qt-configure-module

If reconfiguration fails for some reason, try removing 'CMakeCache.txt' from the build directory
Alternatively, you can add the --fresh flag to your CMake flags.

-- Configuring done (27.5s)
-- Generating done (3.9s)
-- Build files have been written to: /home/ubuntu/STMicroelectronics/QT6_Source/qt-everywhere-src-6.5.3/build_aarch64

compile
//build code
//不要用ninja build
$ cmake --build . --parallel 2

//install
$ cmake --install .

hello專案
$ ls
CMakeLists.txt  main.cpp

-----------------------------------------------------

main.cpp
#include <QApplication>
#include <QLabel>

int main(int argc, char *argv[]) {
  QApplication app(argc, argv);
  QLabel label("Hello World");
  label.setWindowTitle("Hello World");
  label.resize(200, 100);
  label.show();
  return app.exec();
}

-----------------------------------------------------

 cat CMakeLists.txt
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required(VERSION 3.16)
project(hellogl2 LANGUAGES CXX)


#AARCH64
set(TARGET_SYSROOT /home/ubuntu/STMicroelectronics/QT6_Source/sysroot)
set(CROSS_COMPILER /usr/bin/aarch64-linux-gnu)
set(CMAKE_SYSROOT ${TARGET_SYSROOT})

set(CMAKE_C_COMPILER ${CROSS_COMPILER}-gcc)
set(CMAKE_CXX_COMPILER ${CROSS_COMPILER}-g++)
set(CMAKE_LIBRARY_ARCHITECTURE)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wl,-rpath-link,${CMAKE_SYSROOT}/lib/${CMAKE_LIBRARY_ARCHITECTURE} -fPIC -Wl,-rpath-link,${CMAKE_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} -L${CMAKE_SYSROOT}/lib -L${CMAKE_SYSROOT}/lib/${CMAKE_LIBRARY_ARCHITECTURE}  -L${CMAKE_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} -L${CMAKE_SYSROOT}/usr/lib -I${TARGET_SYSROOT}/usr/include -I${TARGET_SYSROOT}/usr/include/${CMAKE_LIBRARY_ARCHITECTURE}")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
#end for AARCH64

find_package(Qt6 REQUIRED COMPONENTS Widgets)

qt_standard_project_setup()

qt_add_executable(hello
    main.cpp
)

set_target_properties(hello PROPERTIES
    WIN32_EXECUTABLE TRUE
    MACOSX_BUNDLE TRUE
)

target_link_libraries(hello PRIVATE
    Qt6::Widgets
)

Cross-compile hello project
$ file /home/ubuntu/STMicroelectronics/QT6_Source/sysroot/opt/prefix/bin/qt-cmake
/home/ubuntu/STMicroelectronics/QT6_Source/sysroot/opt/prefix/bin/qt-cmake: POSIX shell script, ASCII text executable

$ mkdir build_aarch64; cd build_aarch64
$ /home/ubuntu/STMicroelectronics/QT6_Source/sysroot/opt/prefix/bin/qt-cmake ..
-- The CXX compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/aarch64-linux-gnu-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE
-- Performing Test HAVE_EGL
-- Performing Test HAVE_EGL - Success
-- Found EGL: /home/ubuntu/STMicroelectronics/QT6_Source/sysroot/usr/include (found version "1.5")
-- Performing Test HAVE_GLESv2
-- Performing Test HAVE_GLESv2 - Success
-- Found GLESv2: /home/ubuntu/STMicroelectronics/QT6_Source/sysroot/usr/include
-- Found XKB: /home/ubuntu/STMicroelectronics/QT6_Source/sysroot/usr/lib/libxkbcommon.so (found suitable version "1.4.0", minimum required is "0.5.0")
-- Configuring done (0.6s)
-- Generating done (0.0s)
-- Build files have been written to: /home/ubuntu/STMicroelectronics/QT6/hello/build_aarch64

$ cmake --build .
[  0%] Built target hello_autogen_timestamp_deps
[ 20%] Automatic MOC and UIC for target hello
[ 20%] Built target hello_autogen
[ 40%] Building CXX object CMakeFiles/hello.dir/hello_autogen/mocs_compilation.cpp.o
[ 60%] Building CXX object CMakeFiles/hello.dir/main.cpp.o
[ 80%] Linking CXX executable hello
[100%] Built target hello

$ file ./hello
hello: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=2bccf14786fd2d593f5ae8d64847d30365ca2f4b, not stripped

ref:
1. 鲁班猫Qt应用开发实战

2020年5月19日 星期二

Qt-QSGTextureAtlas

所有的 png 圖都是以黑色圖呈現@@
出現的error message:
QSGTextureAtlas: texture atlas allocation failed, code=501

src/quick/scenegraph/util/qsgatlastexture.cpp
GLenum errorCode = glGetError();
...
...
...
else if (errorCode != GL_NO_ERROR) {
    qDebug("QSGTextureAtlas: texture atlas allocation failed, code=%x", errorCode);
    funcs->glDeleteTextures(1, &m_texture_id);
    m_texture_id = 0;
}
查了一下,是關於openGL, here
GL_INVALID_VALUE, 0x0501

Given when a value parameter is not a legal value for that function.
This is only given for local problems;
if the spec allows the value in certain circumstances, 
where other parameters or state dictate those circumstances, 
then GL_INVALID_OPERATION is the result instead.
編everywhere時,有打開 es2, 後來只能重編試試,只開 opengl 重編後ok

2020年5月18日 星期一

Qt Project Git Repository Browser

可以下載其它的tool, 只是需要自已編譯
ex: mqtt

https://code.qt.io/cgit/


mqtt:
    https://code.qt.io/cgit/qt/qtmqtt.git/
    載點: 最下方

記得,看下git branch切換對應的版本

2020年5月13日 星期三

Qt export 設定

目前使用到的
#!/bin/bash

export QTDIR=/opt/Qt/Qt5.12.5_guneabihf
export QML2_IMPORT_PATH=/opt/Qt/Qt5.12.5_guneabihf/qml
export QT_QPA_PLATFORM_PLUGIN_PATH=/opt/Qt/Qt5.12.5_guneabihf/plugins
export LD_LIBRARY_PATH=/opt/Qt/Qt5.12.5_guneabihf/lib
export QWS_MOUSE_PROTO=/dev/input/event0
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:rotation=90

######running
if [ $# -lt 1 ]; then
    echo "enter an app_name to running";
else
    $1
fi

2020年3月28日 星期六

Qt 5.12.5 - add rotation for linuxfb

linuxfb必需修改才能rotate
Copy it from qlinuxfbscreen.cpp of QT everywhere 5.12.5 & QT 海思编程三两事

qt-everywhere-src-5.12.5/qtbase/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

#include "qlinuxfbscreen.h"
#include <QtFbSupport/private/qfbcursor_p.h>
#include <QtFbSupport/private/qfbwindow_p.h>
#include <QtCore/QFile>
#include <QtCore/QRegularExpression>
#include <QtGui/QPainter>

#include <private/qcore_unix_p.h> // overrides QT_OPEN
#include <qimage.h>
#include <qdebug.h>

#include <unistd.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <linux/kd.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <limits.h>
#include <signal.h>

#include <linux/fb.h>

QT_BEGIN_NAMESPACE

static int openFramebufferDevice(const QString &dev)
{
    int fd = -1;

    if (access(dev.toLatin1().constData(), R_OK|W_OK) == 0)
        fd = QT_OPEN(dev.toLatin1().constData(), O_RDWR);

    if (fd == -1) {
        if (access(dev.toLatin1().constData(), R_OK) == 0)
            fd = QT_OPEN(dev.toLatin1().constData(), O_RDONLY);
    }

    return fd;
}

static int determineDepth(const fb_var_screeninfo &vinfo)
{
    int depth = vinfo.bits_per_pixel;
    if (depth== 24) {
        depth = vinfo.red.length + vinfo.green.length + vinfo.blue.length;
        if (depth <= 0)
            depth = 24; // reset if color component lengths are not reported
    } else if (depth == 16) {
        depth = vinfo.red.length + vinfo.green.length + vinfo.blue.length;
        if (depth <= 0)
            depth = 16;
    }
    return depth;
}

static QRect determineGeometry(const fb_var_screeninfo &vinfo, const QRect &userGeometry)
{
    int xoff = vinfo.xoffset;
    int yoff = vinfo.yoffset;
    int w, h;
    if (userGeometry.isValid()) {
        w = userGeometry.width();
        h = userGeometry.height();
        if ((uint)w > vinfo.xres)
            w = vinfo.xres;
        if ((uint)h > vinfo.yres)
            h = vinfo.yres;

        int xxoff = userGeometry.x(), yyoff = userGeometry.y();
        if (xxoff != 0 || yyoff != 0) {
            if (xxoff < 0 || xxoff + w > (int)(vinfo.xres))
                xxoff = vinfo.xres - w;
            if (yyoff < 0 || yyoff + h > (int)(vinfo.yres))
                yyoff = vinfo.yres - h;
            xoff += xxoff;
            yoff += yyoff;
        } else {
            xoff += (vinfo.xres - w)/2;
            yoff += (vinfo.yres - h)/2;
        }
    } else {
        w = vinfo.xres;
        h = vinfo.yres;
    }

    if (w == 0 || h == 0) {
        qWarning("Unable to find screen geometry, using 320x240");
        w = 320;
        h = 240;
    }

    return QRect(xoff, yoff, w, h);
}

static QSizeF determinePhysicalSize(const fb_var_screeninfo &vinfo, const QSize &mmSize, const QSize &res)
{
    int mmWidth = mmSize.width(), mmHeight = mmSize.height();

    if (mmWidth <= 0 && mmHeight <= 0) {
        if (vinfo.width != 0 && vinfo.height != 0
            && vinfo.width != UINT_MAX && vinfo.height != UINT_MAX) {
            mmWidth = vinfo.width;
            mmHeight = vinfo.height;
        } else {
            const int dpi = 100;
            mmWidth = qRound(res.width() * 25.4 / dpi);
            mmHeight = qRound(res.height() * 25.4 / dpi);
        }
    } else if (mmWidth > 0 && mmHeight <= 0) {
        mmHeight = res.height() * mmWidth/res.width();
    } else if (mmHeight > 0 && mmWidth <= 0) {
        mmWidth = res.width() * mmHeight/res.height();
    }

    return QSize(mmWidth, mmHeight);
}

static QImage::Format determineFormat(const fb_var_screeninfo &info, int depth)
{
    const fb_bitfield rgba[4] = { info.red, info.green,
                                  info.blue, info.transp };

    QImage::Format format = QImage::Format_Invalid;

    switch (depth) {
    case 32: {
        const fb_bitfield argb8888[4] = {{16, 8, 0}, {8, 8, 0},
                                         {0, 8, 0}, {24, 8, 0}};
        const fb_bitfield abgr8888[4] = {{0, 8, 0}, {8, 8, 0},
                                         {16, 8, 0}, {24, 8, 0}};
        if (memcmp(rgba, argb8888, 4 * sizeof(fb_bitfield)) == 0) {
            format = QImage::Format_ARGB32;
        } else if (memcmp(rgba, argb8888, 3 * sizeof(fb_bitfield)) == 0) {
            format = QImage::Format_RGB32;
        } else if (memcmp(rgba, abgr8888, 3 * sizeof(fb_bitfield)) == 0) {
            format = QImage::Format_RGB32;
            // pixeltype = BGRPixel;
        }
        break;
    }
    case 24: {
        const fb_bitfield rgb888[4] = {{16, 8, 0}, {8, 8, 0},
                                       {0, 8, 0}, {0, 0, 0}};
        const fb_bitfield bgr888[4] = {{0, 8, 0}, {8, 8, 0},
                                       {16, 8, 0}, {0, 0, 0}};
        if (memcmp(rgba, rgb888, 3 * sizeof(fb_bitfield)) == 0) {
            format = QImage::Format_RGB888;
        } else if (memcmp(rgba, bgr888, 3 * sizeof(fb_bitfield)) == 0) {
            format = QImage::Format_RGB888; //<-5.1.4是BGR888
            // pixeltype = BGRPixel;
        }
        break;
    }
    case 18: {
        const fb_bitfield rgb666[4] = {{12, 6, 0}, {6, 6, 0},
                                       {0, 6, 0}, {0, 0, 0}};
        if (memcmp(rgba, rgb666, 3 * sizeof(fb_bitfield)) == 0)
            format = QImage::Format_RGB666;
        break;
    }
    case 16: {
        const fb_bitfield rgb565[4] = {{11, 5, 0}, {5, 6, 0},
                                       {0, 5, 0}, {0, 0, 0}};
        const fb_bitfield bgr565[4] = {{0, 5, 0}, {5, 6, 0},
                                       {11, 5, 0}, {0, 0, 0}};
        if (memcmp(rgba, rgb565, 3 * sizeof(fb_bitfield)) == 0) {
            format = QImage::Format_RGB16;
        } else if (memcmp(rgba, bgr565, 3 * sizeof(fb_bitfield)) == 0) {
            format = QImage::Format_RGB16;
            // pixeltype = BGRPixel;
        }
        break;
    }
    case 15: {
        const fb_bitfield rgb1555[4] = {{10, 5, 0}, {5, 5, 0},
                                        {0, 5, 0}, {15, 1, 0}};
        const fb_bitfield bgr1555[4] = {{0, 5, 0}, {5, 5, 0},
                                        {10, 5, 0}, {15, 1, 0}};
        if (memcmp(rgba, rgb1555, 3 * sizeof(fb_bitfield)) == 0) {
            format = QImage::Format_RGB555;
        } else if (memcmp(rgba, bgr1555, 3 * sizeof(fb_bitfield)) == 0) {
            format = QImage::Format_RGB555;
            // pixeltype = BGRPixel;
        }
        break;
    }
    case 12: {
        const fb_bitfield rgb444[4] = {{8, 4, 0}, {4, 4, 0},
                                       {0, 4, 0}, {0, 0, 0}};
        if (memcmp(rgba, rgb444, 3 * sizeof(fb_bitfield)) == 0)
            format = QImage::Format_RGB444;
        break;
    }
    case 8:
        break;
    case 1:
        format = QImage::Format_Mono; //###: LSB???
        break;
    default:
        break;
    }

    return format;
}

static int openTtyDevice(const QString &device)
{
    const char *const devs[] = { "/dev/tty0", "/dev/tty", "/dev/console", 0 };

    int fd = -1;
    if (device.isEmpty()) {
        for (const char * const *dev = devs; *dev; ++dev) {
            fd = QT_OPEN(*dev, O_RDWR);
            if (fd != -1)
                break;
        }
    } else {
        fd = QT_OPEN(QFile::encodeName(device).constData(), O_RDWR);
    }

    return fd;
}

static void switchToGraphicsMode(int ttyfd, bool doSwitch, int *oldMode)
{
    // Do not warn if the switch fails: the ioctl fails when launching from a
    // remote console and there is nothing we can do about it.  The matching
    // call in resetTty should at least fail then, too, so we do no harm.
    if (ioctl(ttyfd, KDGETMODE, oldMode) == 0) {
        if (doSwitch && *oldMode != KD_GRAPHICS)
            ioctl(ttyfd, KDSETMODE, KD_GRAPHICS);
    }
}

static void resetTty(int ttyfd, int oldMode)
{
    ioctl(ttyfd, KDSETMODE, oldMode);

    QT_CLOSE(ttyfd);
}

static void blankScreen(int fd, bool on)
{
    ioctl(fd, FBIOBLANK, on ? VESA_POWERDOWN : VESA_NO_BLANKING);
}

QLinuxFbScreen::QLinuxFbScreen(const QStringList &args)
    : mArgs(args), mFbFd(-1), mTtyFd(-1), mBlitter(0),mRotation(0)
{
    mMmap.data = 0;
}

QLinuxFbScreen::~QLinuxFbScreen()
{
    if (mFbFd != -1) {
        if (mMmap.data)
            munmap(mMmap.data - mMmap.offset, mMmap.size);
        close(mFbFd);
    }

    if (mTtyFd != -1)
        resetTty(mTtyFd, mOldTtyMode);

    delete mBlitter;
}

bool QLinuxFbScreen::initialize()
{
    QRegularExpression ttyRx(QLatin1String("tty=(.*)"));
    QRegularExpression fbRx(QLatin1String("fb=(.*)"));
    QRegularExpression mmSizeRx(QLatin1String("mmsize=(\\d+)x(\\d+)"));
    QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)"));
    QRegularExpression offsetRx(QLatin1String("offset=(\\d+)x(\\d+)"));

    //@ add for rotation
    QRegularExpression rotationRx(QLatin1String("rotation=(0|90|180|270)"));


    QString fbDevice, ttyDevice;
    QSize userMmSize;
    QRect userGeometry;
    bool doSwitchToGraphicsMode = true;

    // Parse arguments
    for (const QString &arg : qAsConst(mArgs)) {
        QRegularExpressionMatch match;
        if (arg == QLatin1String("nographicsmodeswitch"))
            doSwitchToGraphicsMode = false;
        else if (arg.contains(mmSizeRx, &match))
            userMmSize = QSize(match.captured(1).toInt(), match.captured(2).toInt());
        else if (arg.contains(sizeRx, &match))
            userGeometry.setSize(QSize(match.captured(1).toInt(), match.captured(2).toInt()));
        else if (arg.contains(offsetRx, &match))
            userGeometry.setTopLeft(QPoint(match.captured(1).toInt(), match.captured(2).toInt()));
        else if (arg.contains(ttyRx, &match))
            ttyDevice = match.captured(1);
        else if (arg.contains(fbRx, &match))
            fbDevice = match.captured(1);
        
        //@ add for rotation start
        else if(arg.contains(rotationRx,&match))
            mRotation = match.captured(1).toInt();
        //@ add for rotation end


    }

    if (fbDevice.isEmpty()) {
        fbDevice = QLatin1String("/dev/fb0");
        if (!QFile::exists(fbDevice))
            fbDevice = QLatin1String("/dev/graphics/fb0");
        if (!QFile::exists(fbDevice)) {
            qWarning("Unable to figure out framebuffer device. Specify it manually.");
            return false;
        }
    }

    // Open the device
    mFbFd = openFramebufferDevice(fbDevice);
    if (mFbFd == -1) {
        qErrnoWarning(errno, "Failed to open framebuffer %s", qPrintable(fbDevice));
        return false;
    }

    // Read the fixed and variable screen information
    fb_fix_screeninfo finfo;
    fb_var_screeninfo vinfo;
    memset(&vinfo, 0, sizeof(vinfo));
    memset(&finfo, 0, sizeof(finfo));

    if (ioctl(mFbFd, FBIOGET_FSCREENINFO, &finfo) != 0) {
        qErrnoWarning(errno, "Error reading fixed information");
        return false;
    }

    if (ioctl(mFbFd, FBIOGET_VSCREENINFO, &vinfo)) {
        qErrnoWarning(errno, "Error reading variable information");
        return false;
    }

    mDepth = determineDepth(vinfo);
    mBytesPerLine = finfo.line_length;
    QRect geometry = determineGeometry(vinfo, userGeometry);

    //@ add for rotation start
    QRect originalGeometry = geometry;
    if(90 == mRotation || 270 == mRotation)
    {
        int tmp = geometry.width();
        geometry.setWidth(geometry.height());
        geometry.setHeight(tmp);
    }
    //@ add for rotation end

    mGeometry = QRect(QPoint(0, 0), geometry.size());
    mFormat = determineFormat(vinfo, mDepth);
    
    //@ add for rotation start
    //mPhysicalSize = determinePhysicalSize(vinfo, userMmSize, geometry.size());
     mPhysicalSize = determinePhysicalSize(vinfo, userMmSize, originalGeometry.size());
    //@ add for rotation end


    // mmap the framebuffer
    mMmap.size = finfo.smem_len;
    uchar *data = (unsigned char *)mmap(0, mMmap.size, PROT_READ | PROT_WRITE, MAP_SHARED, mFbFd, 0);
    if ((long)data == -1) {
        qErrnoWarning(errno, "Failed to mmap framebuffer");
        return false;
    }

    //@ add for rotation start
    //mMmap.offset = geometry.y() * mBytesPerLine + geometry.x() * mDepth / 8;
    mMmap.offset = originalGeometry.y() * mBytesPerLine + originalGeometry.x() * mDepth / 8;
    //@ add for rotation end

    mMmap.data = data + mMmap.offset;

    QFbScreen::initializeCompositor();

    //@ add for rotation start
    //mFbScreenImage = QImage(mMmap.data, geometry.width(), geometry.height(), mBytesPerLine, mFormat);
    mFbScreenImage = QImage(mMmap.data, originalGeometry.width(), originalGeometry.height(), mBytesPerLine, mFormat);
    //@ add for rotation end

    mCursor = new QFbCursor(this);

    mTtyFd = openTtyDevice(ttyDevice);
    if (mTtyFd == -1)
        qErrnoWarning(errno, "Failed to open tty");

    switchToGraphicsMode(mTtyFd, doSwitchToGraphicsMode, &mOldTtyMode);
    blankScreen(mFbFd, false);

    return true;
}

QRegion QLinuxFbScreen::doRedraw()
{
    QRegion touched = QFbScreen::doRedraw();

    if (touched.isEmpty())
        return touched;

    if (!mBlitter)
        mBlitter = new QPainter(&mFbScreenImage);

    mBlitter->setCompositionMode(QPainter::CompositionMode_Source);
    for (const QRect &rect : touched)
    {
        //@ add for rotation start
        if(90 == mRotation || 270 == mRotation)
        {
            mBlitter->translate(mGeometry.height()/2,mGeometry.width()/2);
        }
        else if(180 == mRotation)
        {
            mBlitter->translate(mGeometry.width()/2,mGeometry.height()/2);
        }
        if(mRotation != 0)
        {
            mBlitter->rotate(mRotation);
            mBlitter->translate(-mGeometry.width()/2, -mGeometry.height()/2);
        }
        //@ add for rotation end

        mBlitter->drawImage(rect, mScreenImage, rect);

        //@ add for rotation start
        mBlitter->resetTransform();
        //@ add for rotation end

    }

    return touched;
}


// grabWindow() grabs "from the screen" not from the backingstores.
// In linuxfb's case it will also include the mouse cursor.
QPixmap QLinuxFbScreen::grabWindow(WId wid, int x, int y, int width, int height) const
{
    if (!wid) {
        if (width < 0)
            width = mFbScreenImage.width() - x;
        if (height < 0)
            height = mFbScreenImage.height() - y;
        return QPixmap::fromImage(mFbScreenImage).copy(x, y, width, height);
    }

    QFbWindow *window = windowForId(wid);
    if (window) {
        const QRect geom = window->geometry();
        if (width < 0)
            width = geom.width() - x;
        if (height < 0)
            height = geom.height() - y;
        QRect rect(geom.topLeft() + QPoint(x, y), QSize(width, height));
        rect &= window->geometry();
        return QPixmap::fromImage(mFbScreenImage).copy(rect);
    }

    return QPixmap();
}

QT_END_NAMESPACE


qt-everywhere-src-5.12.5/qtbase/src/plugins/platforms/linuxfb/qlinuxfbscreen.h
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

#ifndef QLINUXFBSCREEN_H
#define QLINUXFBSCREEN_H

#include <QtFbSupport/private/qfbscreen_p.h>

QT_BEGIN_NAMESPACE

class QPainter;
class QFbCursor;

class QLinuxFbScreen : public QFbScreen
{
    Q_OBJECT
public:
    QLinuxFbScreen(const QStringList &args);
    ~QLinuxFbScreen();

    bool initialize() override;

    QPixmap grabWindow(WId wid, int x, int y, int width, int height) const override;

    QRegion doRedraw() override;

private:
    QStringList mArgs;
    int mFbFd;
    int mTtyFd;

    int mRotation;


    QImage mFbScreenImage;
    int mBytesPerLine;
    int mOldTtyMode;

    struct {
        uchar *data;
        int offset, size;
    } mMmap;

    QPainter *mBlitter;
};

QT_END_NAMESPACE

#endif // QLINUXFBSCREEN_H
Copy it from qlinuxfbscreen.cpp of QT everywhere 5.12.5 & QT 海思编程三两事


Compile:
1. cd path_qt5.12.5/qtbase
2. make
3. make install


使用方法:
1. export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:rotation=90  <-OK
or
2. ./app -platform linuxfb:fb=/dev/fb0:rotatio=90 <-無效@@

ref:
1. QT everywhere 5.12.5
2. QT 海思编程三两事

2020年2月3日 星期一

安裝Qt

Written with StackEdit.

Environment:

ubuntu 18.04


everywhere

下載:   https://download.qt.io/archive/qt/5.12/5.12.5/single/
安裝
sudo apt-get install libgl1-mesa-dev \
libglu1-mesa-dev \
libwayland-dev \
libclang-dev \
libsnappy-dev \
libavformat-dev \
libavutil-dev \
libfontconfig1-dev \ #for fontconfig
libgtk-3-dev \  #for xcb
libre2-dev \  #for re2
libpoppler-cpp-dev \  #for webengine-poppler
libgles2-mesa-dev \ #for opengl ES2
libgles2-mesa \ #for opengl ES2
libwebp-dev \  #for webp
libwebpdemux1 \ #for webp
libjsoncpp-dev \ #for jsoncpp
re2c \
gperf \
bison \
flex \

Compile

  • ./configure -prefix /opt/Qt/5.12.5 -qt-xcb -webengine-pepper-plugins -webengine-proprietary-codecs -opengl -webengine-ffmpeg -webengine-opus -webengine-webp (很久)
  • ./make (很久很久…超過3小時)
  • ./make install
      more options: ./configure --help
      more log for compile: ./config.lgo & ./config.summary


troubleshoot

1. libqwebengineview.so & libqtwebengineplugin.so for "QT += webenginewidgets"
cd qt-5.12.5/qtwebengine/src/webenginewidgets
/opt/Qt/5.12.5/bin/qmake webenginewidgets.pro
make
make install
  • /usr/local/lib/libxml2.so 沒有"xmlCatalogSetDefaults"
  • /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.4有"xmlCatalogSetDefaults"
   所以需要手動拷貝
2.config.qtwebengine_core.tests.webengine-libvpx FAILED
<vpx/vpx_encoder.h>
pkt.data.frame.width[0] = 0u;
pkt.data.frame.height[0] = 0u;
libvpx 比較麻煩,原本用apt-get安裝的並沒有width和height需要另外下載開源碼
編譯libvpx
./configure --prefix=/usr --enable-shared --disable-static
make
make install
但 /opt/Qt/5.12.5/bin/qmake qt-5.12.5/qtwebengine/config.tests/libvpx/libvpx.pro後的makefile
(g++ -Wl,-O1 -fuse-ld=gold -Wl,--enable-new-dtags -o libvpx .obj/libvpx.o -L/usr/local/lib -lvpx -lm)
它是去讀 /usr/local/include的
所以要將vpx(head files)拷貝到 /usr/local/include 和 /usr/include
3. QQmlApplicationEngine, 是在libQt5Qml.so.5,有重新編過
(qtdeclarative/src/qml/ $make clean; rm -rf Makefile; qmake qml.pro)



Creator

Download:https://www.qt.io/download-open-source# (最下方)
  1. sudo chmod 755 qt-unified-linux-x64-3.2.1-online.run
  2. ./qt-unified-linux-x64-3.2.1-online.run
  3. register
  4. (need a lot of storage space)

Cross Compile

Select your target in qtbase/mkspecs/ or qtbase/mkspecs/devices
ex:
  1. linux-aarch64-gnu-g++
  2. linux-arm-gnueabi-g++ (There is no linux-arm-gnueabihf-g++)
  3. linux-rasp-pi2-g++

Start:

  1. My target board is not RPI2, but RPI2 is 32bit, ARMv7, the SoC specs is the same as my target board
  2. GCC version of the target board is 32-bit, 4.9.x , so select the gcc-linaro-4.9.4-guneabihf_i686
  3. Copy the /usr & /lib form target board to /opt/gcc/opt/Qt/Qt5.12.5_guneabihf for sysroot
./configure -device linux-rasp-pi2-g++ -device-option CROSS_COMPILE=/opt/gcc/gcc-linaro-4.9.4-guneabihf_i686/bin/arm-linux-gnueabihf- -sysroot /opt/Qt/Qt5.12.5_guneabihf -confirm-license -prefix / -v
or
./configure -device linux-rasp-pi2-g++ -device-option CROSS_COMPILE=/opt/gcc/gcc-linaro-4.9.4-guneabihf_i686/bin/arm-linux-gnueabihf- -sysroot /opt/Qt/Qt5.12.5_guneabihf -I/opt/Qt/Qt5.12.5_guneabihf/usr/include -L/opt/Qt/Qt5.12.5_guneabihf/usr/lib/arm-linux-gnueabihf -ssl -openssl -confirm-license -prefix /
    Configure summary:
    Building on: linux-g++ (x86_64, CPU features: mmx sse sse2)
    Building for: devices/linux-rasp-pi2-g++ (arm, CPU features: neon)
    Target compiler: gcc 4.9.4
    Configuration: cross_compile compile_examples enable_new_dtags largefile neon precompile_header shared rpath release c++11 c++14 concurrent dbus reduce_exports stl
    Build options:
      Mode ................................... release
      Optimize release build for size ........ no
      Building shared libraries .............. yes
      Using C standard ....................... C11
      Using C++ standard ..................... C++14
      Using ccache ........................... no
      Using gold linker ...................... no
      Using new DTAGS ........................ yes
      Using precompiled headers .............. yes
      Using LTCG ............................. no
      Target compiler supports:
        NEON ................................. yes
      Build parts ............................ libs examples
    Qt modules and options:
      Qt Concurrent .......................... yes
      Qt D-Bus ............................... yes
      Qt D-Bus directly linked to libdbus .... no
      Qt Gui ................................. yes
      Qt Network ............................. yes
      Qt Sql ................................. yes
      Qt Testlib ............................. yes
      Qt Widgets ............................. yes
      Qt Xml ................................. yes
    Support enabled for:
      Using pkg-config ....................... yes
      udev ................................... no
      Using system zlib ...................... yes
    Qt Core:
      DoubleConversion ....................... yes
        Using system DoubleConversion ........ no
      GLib ................................... no
      iconv .................................. yes
      ICU .................................... no
      Tracing backend ........................ <none>
      Logging backends:
        journald ............................. no
        syslog ............................... no
        slog2 ................................ no
      Using system PCRE2 ..................... no
    Qt Network:
      getifaddrs() ........................... yes
      IPv6 ifname ............................ yes
      libproxy ............................... no
      Linux AF_NETLINK ....................... yes
      OpenSSL ................................ yes
        Qt directly linked to OpenSSL ........ no
      OpenSSL 1.1 ............................ yes
      DTLS ................................... no
      SCTP ................................... no
      Use system proxies ..................... yes
    Qt Gui:
      Accessibility .......................... yes
      FreeType ............................... yes
        Using system FreeType ................ yes
      HarfBuzz ............................... yes
        Using system HarfBuzz ................ no
      Fontconfig ............................. yes
      Image formats:
        GIF .................................. yes
        ICO .................................. yes
        JPEG ................................. yes
          Using system libjpeg ............... no
        PNG .................................. yes
          Using system libpng ................ yes
      EGL .................................... yes
      OpenVG ................................. no
      OpenGL:
        Desktop OpenGL ....................... yes
        OpenGL ES 2.0 ........................ no
        OpenGL ES 3.0 ........................ no
        OpenGL ES 3.1 ........................ no
        OpenGL ES 3.2 ........................ no
      Vulkan ................................. no
      Session Management ..................... yes
    Features used by QPA backends:
      evdev .................................. yes
      libinput ............................... no
      INTEGRITY HID .......................... no
      mtdev .................................. no
      tslib .................................. no
      xkbcommon .............................. no
      X11 specific:
        XLib ................................. yes
        XCB Xlib ............................. yes
        EGL on X11 ........................... yes
    QPA backends:
      DirectFB ............................... no
      EGLFS .................................. yes
      EGLFS details:
        EGLFS OpenWFD ........................ no
        EGLFS i.Mx6 .......................... no
        EGLFS i.Mx6 Wayland .................. no
        EGLFS RCAR ........................... no
        EGLFS EGLDevice ...................... no
        EGLFS GBM ............................ no
        EGLFS VSP2 ........................... no
        EGLFS Mali ........................... no
        EGLFS Raspberry Pi ................... no
        EGLFS X11 ............................ yes
      LinuxFB ................................ yes
      VNC .................................... yes
      Mir client ............................. no
    Qt Sql:
      SQL item models ........................ yes
    Qt Widgets:
      GTK+ ................................... no
      Styles ................................. Fusion Windows
    Qt PrintSupport:
      CUPS ................................... no
    Qt Sql Drivers:
      DB2 (IBM) .............................. no
      InterBase .............................. no
      MySql .................................. no
      OCI (Oracle) ........................... no
      ODBC ................................... no
      PostgreSQL ............................. no
      SQLite2 ................................ no
      SQLite ................................. yes
        Using system provided SQLite ......... no
      TDS (Sybase) ........................... no
    Qt Testlib:
      Tester for item models ................. yes
    Qt SerialBus:
      Socket CAN ............................. yes
      Socket CAN FD .......................... yes
    Further Image Formats:
      JasPer ................................. no
      MNG .................................... no
      TIFF ................................... yes
        Using system libtiff ................. no
      WEBP ................................... yes
        Using system libwebp ................. no
    Qt QML:
      QML network support .................... yes
      QML debugging and profiling support .... yes
      QML sequence object .................... yes
      QML list model ......................... yes
      QML XML http request ................... yes
      QML Locale ............................. yes
      QML delegate model ..................... yes
    Qt Quick:
      Direct3D 12 ............................ no
      AnimatedImage item ..................... yes
      Canvas item ............................ yes
      Support for Qt Quick Designer .......... yes
      Flipable item .......................... yes
      GridView item .......................... yes
      ListView item .......................... yes
      TableView item ......................... yes
      Path support ........................... yes
      PathView item .......................... yes
      Positioner items ....................... yes
      Repeater item .......................... yes
      ShaderEffect item ...................... yes
      Sprite item ............................ yes
    Qt Scxml:
      ECMAScript data model for QtScxml ...... yes
    Qt Gamepad:
      SDL2 ................................... no
    Qt 3D:
      Assimp ................................. yes
      System Assimp .......................... no
      Output Qt3D Job traces ................. no
      Output Qt3D GL traces .................. no
      Use SSE2 instructions .................. no
      Use AVX2 instructions .................. no
      Aspects:
        Render aspect ........................ yes
        Input aspect ......................... yes
        Logic aspect ......................... yes
        Animation aspect ..................... yes
        Extras aspect ........................ yes
    Qt 3D Renderers:
      OpenGL Renderer ........................ yes
    Qt 3D GeometryLoaders:
      Autodesk FBX ........................... no
    Qt Wayland Client ........................ no
    Qt Wayland Compositor .................... no
    Qt Bluetooth:
      BlueZ .................................. no
      BlueZ Low Energy ....................... no
      Linux Crypto API ....................... no
      WinRT Bluetooth API (desktop & UWP) .... no
    Qt Sensors:
      sensorfw ............................... no
    Qt Quick Controls 2:
      Styles ................................. Default Fusion Imagine Material Universal
    Qt Quick Templates 2:
      Hover support .......................... yes
      Multi-touch support .................... yes
    Qt Positioning:
      Gypsy GPS Daemon ....................... no
      WinRT Geolocation API .................. no
    Qt Location:
      Qt.labs.location experimental QML plugin . yes
      Geoservice plugins:
        OpenStreetMap ........................ yes
        HERE ................................. yes
        Esri ................................. yes
        Mapbox ............................... yes
        MapboxGL ............................. yes
        Itemsoverlay ......................... yes
    QtXmlPatterns:
      XML schema support ..................... yes
    Qt Multimedia:
      ALSA ................................... yes
      GStreamer 1.0 .......................... no
      GStreamer 0.10 ......................... no
      Video for Linux ........................ yes
      OpenAL ................................. no
      PulseAudio ............................. no
      Resource Policy (libresourceqt5) ....... no
      Windows Audio Services ................. no
      DirectShow ............................. no
      Windows Media Foundation ............... no
    Qt Tools:
      QDoc ................................... no
    Qt WebEngine:
      Embedded build ......................... yes
      Full debug information ................. no
      Pepper Plugins ......................... no
      Printing and PDF ....................... no
      Proprietary Codecs ..................... no
      Spellchecker ........................... yes
      Native Spellchecker .................... no
      WebRTC ................................. no
      Use System Ninja ....................... no
      Geolocation ............................ yes
      WebChannel support ..................... yes
      Use v8 snapshot ........................ yes
      Kerberos Authentication ................ no
      Support qpa-xcb ........................ no
      Building v8 snapshot supported ......... no
      Use ALSA ............................... yes
      Use PulseAudio ......................... no
      Optional system libraries used:
        re2 .................................. no
        icu .................................. no
        libwebp, libwebpmux and libwebpdemux . no
        opus ................................. no
        ffmpeg ............................... no
        libvpx ............................... no
        snappy ............................... no
        glib ................................. yes
        zlib ................................. yes
        minizip .............................. no
        libevent ............................. no
        jsoncpp .............................. no
        protobuf ............................. no
        libxml2 and libxslt .................. no
        lcms2 ................................ no
        png .................................. no
        JPEG ................................. no
        harfbuzz ............................. no
        freetype ............................. yes
      Required system libraries:
        fontconfig ........................... yes
        dbus ................................. no
        nss .................................. no
        khr .................................. yes
        glibc ................................ yes
      Required system libraries for qpa-xcb:
        x11 .................................. yes
        libdrm ............................... yes
        xcomposite ........................... no
        xcursor .............................. no
        xi ................................... no
        xtst ................................. no

    Note: Also available for Linux: linux-clang linux-icc

    Note: PKG_CONFIG_LIBDIR automatically set to /opt/Qt/Qt5.12.5_guneabihf/usr/lib/pkgconfig:/opt/Qt/Qt5.12.5_guneabihf/usr/share/pkgconfig:/opt/Qt/Qt5.12.5_guneabihf/usr/lib/arm-linux-gnueabihf/pkgconfig

    Note: PKG_CONFIG_SYSROOT_DIR automatically set to /opt/Qt/Qt5.12.5_guneabihf

    WARNING: QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation.

    Either ensure that llvm-config is in your PATH environment variable, or set LLVM_INSTALL_DIR to the location of your llvm installation.
    On Linux systems, you may be able to install libclang by installing the libclang-dev or libclang-devel package, depending on your distribution.
    On macOS, you can use Homebrew's llvm package.
    On Windows, you must set LLVM_INSTALL_DIR to the installation path.

    Qt is now configured for building. Just run 'make'.
    Once everything is built, you must run 'make install'.
    Qt will be installed into '/opt/Qt/Qt5.12.5_guneabihf/'.

    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.
a lot of trouble issue, copy lose library form lib to usr
ex: libdl.a (find ./ -name "libm.*" | xargs ls --color -alh)
      (copy libdl.so.x.x form /opt/Qt/Qt5.12.5_xx/lib to /opt/Qt/Qt5.12.5_xx/usr and make softlink)


After compiling, check the /opt/Qt/Qt5.12.5_guneabihf/bin/
canbusutil:            ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=ccfdf934172bc2e9249426cd47276f8458b7658b, stripped
fixqt4headers.pl:      a /usr/bin/env perl script, ASCII text executable
lconvert:              ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=dbe03cd53310f176cb4b0d153de37b665455f8af, stripped
lrelease:              ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=951acb375769f751935c252693440527ddafcbca, stripped
lupdate:               ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=65942326e5223fa9bf0b98becbb696e252e01777, stripped
moc:                   ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=3a213330171f7cf657a7af9ca9748e3263404ef6, stripped
qdbus:                 ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=2575dbd08bdb9d326aba82f6f8d598ada56d65a4, stripped
qdbuscpp2xml:          ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=d2a31317929e23c263ddd6a29a021f283a44af78, stripped
qdbusviewer:           ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=9f42384cb58e303fd8c0dc8c62622ab48840211f, stripped
qdbusxml2cpp:          ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=9d455355d898de0a4ea1016aca8c8bff87c0e7c3, stripped
qgltf:                 ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=754677bc184ca86e1da9df74b776fc7bb36792fd, stripped
qlalr:                 ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=3d865d28934ae23845d8530f42a6904e71ae279e, stripped
qmake:                 ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=1f59dd50ab5e822f5ba5d4fb1d65d2fa0393e948, not stripped
qml:                   ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=ba48e0f023dafd1ffbc3aadfdefaf0ee2d64c71b, stripped
qmlcachegen:           ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=0d0a3d2fb47ab845c6e1f1f65f38b58ac79e0e3b, stripped
qmlimportscanner:      ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=4abd83d35a901b6b8cbaa585342a5133f6901dcd, stripped
qmllint:               ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=d8f3ecb8e35df2e87a9b9837be5c91efccfc7f32, stripped
qmlmin:                ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=dbd96a818df62b126a1b42f5b721d866c5ea7f11, stripped
qmlpreview:            ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=c4193b805436072f49041c4d12c2101ab2c5201c, stripped
qmlscene:              ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=90b8a43caba92987845e63a759ecda1895606942, stripped
qmltestrunner:         ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=5d72242414ae067c19cb4ac641a224b2b23d46ad, stripped
qscxmlc:               ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=1476cb52e827348eb997756c6ad667f71ec8a63c, stripped
qtattributionsscanner: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=12adb5624c828550b3086897b1bdf89220fe422a, stripped
qtdiag:                ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=b3e356b22f45bc11151fe9baa5adc8dbb7125671, stripped
qtpaths:               ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=4359187c31d920f3e0467ccc0223f93bf39f6879, stripped
qtplugininfo:          ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=2fe8ac3ff0f02aaa11b8d52e1d167b62a92340c6, stripped
qvkgen:                ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=55c65d3df95f32dd1b40e23233ac40e2a137c91c, stripped
rcc:                   ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=941d72e5c122f14f2163e6b6fe2d130725254356, stripped
repc:                  ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=1d26c059d68a0a1c91dfadfbe957eccc85ac22ca, stripped
syncqt.pl:             a /usr/bin/env perl script, ASCII text executable
uic:                   ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=74fa6993997a37bb333d19bcebae8d84e83a8db7, stripped
xmlpatterns:           ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=7ce52c834c1add0e22060a1c9805d4fe1d86828e, stripped
xmlpatternsvalidator:  ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 2.6.32, BuildID[sha1]=81a26a9fe33cb822eafeb142e3bb94dff0aabeeb, stripped

issues when running on target board

  1. This application failed to start because it could not find or load the Qt platform plugin “linuxfb” in “”
export QTDIR=/opt/Qt/Qt5.12.5_guneabihf
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins/
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
————————————————
版权声明:本文为CSDN博主「天已青色等烟雨来」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/x356982611/article/details/70799165
  1. module “QtQuick.Window” is not installed
export QML2_IMPORT_PATH=$QTDIR/qml


ref:
1. [HowTo] Cross compile Qt5
2. Cross-compile and deploy Qt 5.12 for Raspberry Pi
3. jiejieaiai
4. 天已青色等烟雨来
/*nice*/