Cannot build Qt6.2.4 against ARM32 hf processor in Ubuntu x86 host
-
Hello everyone
My goal is to build a QT version to compile and deploy on an arm32 linux device.
On my development host (UBUNTU Focal) i have installed Qt 6.2.4.
My target device is a board based on arm32v7 processor.STEPS:
-
Get the QT Source version from here: https://download.qt.io/official_releases/qt/6.2/6.2.4/single/
Unpacked int my folder $HOME/qt-cross -
Get the compiler version from the linaro site: gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar
I set a toolchain and sysroot under $HOME/arm-sdk
Untar the compiler here $HOME/arm-sdk/gcc-linaro-7.5.0
The sysrooot is here:
./arm-linux-gnueabihf-g++ -print-sysroot
$HOME/arm-sdk/gcc-linaro-7.5.0/bin/../arm-linux-gnueabihf/libcI copied it in $HOME/arm-sdk/sysroot
- The toolchain is created in $HOME/qt-cross/qtbase
File name is: toolchain.cmake
cmake_minimum_required(VERSION 3.18)
include_guard(GLOBAL)set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)set(Qt6HostInfo_DIR /home/ingfernando/Qt/6.2.4/gcc_64/lib/cmake/Qt6HostInfo)
set(TARGET_SYSROOT /home/ingfernando/arm-sdk/sysroot)
set(CROSS_COMPILER /home/ingfernando/arm-sdk/gcc-linaro-7.5.0)**set(CMAKE_SYSROOT ${TARGET_SYSROOT})*
set(ENV{PKG_CONFIG_PATH} "")
set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_SYSROOT}/usr/lib/pkgconfig:${CMAKE_SYSROOT}/usr/share/pkgconfig)
set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})set(CMAKE_C_COMPILER ${CROSS_COMPILER}/bin/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER ${CROSS_COMPILER}/bin/arm-linux-gnueabihf-g++)##set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
##set(CMAKE_CXX_EXTENSIONS ON)##set(CMAKE_CXX_FLAGS "-std=c++17")
##set(INPUT_cxx14 "no")##set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
##set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")##set(QT_COMPILER_FLAGS "-march=armv7-a -mfloat-abi=hard -std=gnu++17 -std=c++17")
set(QT_COMPILER_FLAGS "-march=armv7-a -mfloat-abi=hard")
set(QT_COMPILER_FLAGS_RELEASE "-O2 -pipe")
set(QT_LINKER_FLAGS "-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed")set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)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()
- The config command:
./configure -release -nomake examples -no-opengl -nomake tests -qt-host-path $HOME/Qt/6.2.4 -extprefix $HOME/qt6-arm32 -prefix /usr/local/qt6 -- -DCMAKE_TOOLCHAIN_FILE=$HOME/qt-cross/qtbase/toolchain.cmake
It seems running correctly. Hereafter the configuration summary:
Configure summary:
Building for: linux-g++ (arm, CPU features: neon)
Compiler: gcc 7.5.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
Using new DTAGS ........................ yes
Relocatable ............................ yes
Using precompiled headers .............. yes
Using LTCG ............................. no
Target compiler supports:
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 .... no
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
Using system zlib ...................... no
Zstandard support ...................... no
Thread support ......................... yes
Common build options:
Linker can resolve circular dependencies yes
Qt Core:
backtrace .............................. yes
DoubleConversion ....................... yes
Using system DoubleConversion ........ no
GLib ................................... no
ICU .................................... no
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 ................... no
CLONE_PIDFD support in forkfd .......... yes
Qt Sql:
SQL item models ........................ yes
Qt Network:
getifaddrs() ........................... yes
IPv6 ifname ............................ yes
libproxy ............................... no
Linux AF_NETLINK ....................... yes
OpenSSL ................................ no
Qt directly linked to OpenSSL ........ no
OpenSSL 1.1 ............................ no
DTLS ................................... no
OCSP-stapling .......................... no
SCTP ................................... no
Use system proxies ..................... yes
GSSAPI ................................. no
Brotli Decompression Support ........... no
Qt Gui:
Accessibility .......................... yes
FreeType ............................... yes
Using system FreeType ................ no
HarfBuzz ............................... yes
Using system HarfBuzz ................ no
Fontconfig ............................. no
Image formats:
GIF .................................. yes
ICO .................................. yes
JPEG ................................. yes
Using system libjpeg ............... no
PNG .................................. yes
Using system libpng ................ no
Text formats:
HtmlParser ........................... yes
CssParser ............................ yes
OdfWriter ............................ yes
MarkdownReader ....................... yes
Using system libmd4c ............... no
MarkdownWriter ....................... yes
EGL .................................... no
OpenVG ................................. no
OpenGL:
Desktop OpenGL ....................... no
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 ................................. no
XCB Xlib ............................. no
EGL on X11 ........................... no
xkbcommon-x11 ........................ no
xcb-sm ............................... no
QPA backends:
DirectFB ............................... no
EGLFS .................................. no
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 ............................ 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 ..................... 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
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 ......... noQt is now configured for building. Just run 'cmake --build . --parallel'
Once everything is built, you must run 'cmake --install .'
Qt will be installed into '/usr/local/qt6'To configure and build other Qt modules, you can use the following convenience script:
/home/ingfernando/qt6-arm32/bin/qt-configure-moduleIf reconfiguration fails for some reason, try to remove 'CMakeCache.txt' from the build directory
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ingfernando/qt-cross/qtbase
- The cmake build FAILS
cmake --build .
This is the error i got:
error: ‘(QObjectPrivate::ExtraData::nameChangedForwarder == 0)’ is not a constant expression
if constexpr (Signal != nullptr)
Any help will be apprecieted. Many thanjs in advance
Regards -
-
Hello everyone
My goal is to build a QT version to compile and deploy on an arm32 linux device.
On my development host (UBUNTU Focal) i have installed Qt 6.2.4.
My target device is a board based on arm32v7 processor.STEPS:
-
Get the QT Source version from here: https://download.qt.io/official_releases/qt/6.2/6.2.4/single/
Unpacked int my folder $HOME/qt-cross -
Get the compiler version from the linaro site: gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar
I set a toolchain and sysroot under $HOME/arm-sdk
Untar the compiler here $HOME/arm-sdk/gcc-linaro-7.5.0
The sysrooot is here:
./arm-linux-gnueabihf-g++ -print-sysroot
$HOME/arm-sdk/gcc-linaro-7.5.0/bin/../arm-linux-gnueabihf/libcI copied it in $HOME/arm-sdk/sysroot
- The toolchain is created in $HOME/qt-cross/qtbase
File name is: toolchain.cmake
cmake_minimum_required(VERSION 3.18)
include_guard(GLOBAL)set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)set(Qt6HostInfo_DIR /home/ingfernando/Qt/6.2.4/gcc_64/lib/cmake/Qt6HostInfo)
set(TARGET_SYSROOT /home/ingfernando/arm-sdk/sysroot)
set(CROSS_COMPILER /home/ingfernando/arm-sdk/gcc-linaro-7.5.0)**set(CMAKE_SYSROOT ${TARGET_SYSROOT})*
set(ENV{PKG_CONFIG_PATH} "")
set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_SYSROOT}/usr/lib/pkgconfig:${CMAKE_SYSROOT}/usr/share/pkgconfig)
set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})set(CMAKE_C_COMPILER ${CROSS_COMPILER}/bin/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER ${CROSS_COMPILER}/bin/arm-linux-gnueabihf-g++)##set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
##set(CMAKE_CXX_EXTENSIONS ON)##set(CMAKE_CXX_FLAGS "-std=c++17")
##set(INPUT_cxx14 "no")##set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
##set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")##set(QT_COMPILER_FLAGS "-march=armv7-a -mfloat-abi=hard -std=gnu++17 -std=c++17")
set(QT_COMPILER_FLAGS "-march=armv7-a -mfloat-abi=hard")
set(QT_COMPILER_FLAGS_RELEASE "-O2 -pipe")
set(QT_LINKER_FLAGS "-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed")set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)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()
- The config command:
./configure -release -nomake examples -no-opengl -nomake tests -qt-host-path $HOME/Qt/6.2.4 -extprefix $HOME/qt6-arm32 -prefix /usr/local/qt6 -- -DCMAKE_TOOLCHAIN_FILE=$HOME/qt-cross/qtbase/toolchain.cmake
It seems running correctly. Hereafter the configuration summary:
Configure summary:
Building for: linux-g++ (arm, CPU features: neon)
Compiler: gcc 7.5.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
Using new DTAGS ........................ yes
Relocatable ............................ yes
Using precompiled headers .............. yes
Using LTCG ............................. no
Target compiler supports:
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 .... no
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
Using system zlib ...................... no
Zstandard support ...................... no
Thread support ......................... yes
Common build options:
Linker can resolve circular dependencies yes
Qt Core:
backtrace .............................. yes
DoubleConversion ....................... yes
Using system DoubleConversion ........ no
GLib ................................... no
ICU .................................... no
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 ................... no
CLONE_PIDFD support in forkfd .......... yes
Qt Sql:
SQL item models ........................ yes
Qt Network:
getifaddrs() ........................... yes
IPv6 ifname ............................ yes
libproxy ............................... no
Linux AF_NETLINK ....................... yes
OpenSSL ................................ no
Qt directly linked to OpenSSL ........ no
OpenSSL 1.1 ............................ no
DTLS ................................... no
OCSP-stapling .......................... no
SCTP ................................... no
Use system proxies ..................... yes
GSSAPI ................................. no
Brotli Decompression Support ........... no
Qt Gui:
Accessibility .......................... yes
FreeType ............................... yes
Using system FreeType ................ no
HarfBuzz ............................... yes
Using system HarfBuzz ................ no
Fontconfig ............................. no
Image formats:
GIF .................................. yes
ICO .................................. yes
JPEG ................................. yes
Using system libjpeg ............... no
PNG .................................. yes
Using system libpng ................ no
Text formats:
HtmlParser ........................... yes
CssParser ............................ yes
OdfWriter ............................ yes
MarkdownReader ....................... yes
Using system libmd4c ............... no
MarkdownWriter ....................... yes
EGL .................................... no
OpenVG ................................. no
OpenGL:
Desktop OpenGL ....................... no
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 ................................. no
XCB Xlib ............................. no
EGL on X11 ........................... no
xkbcommon-x11 ........................ no
xcb-sm ............................... no
QPA backends:
DirectFB ............................... no
EGLFS .................................. no
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 ............................ 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 ..................... 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
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 ......... noQt is now configured for building. Just run 'cmake --build . --parallel'
Once everything is built, you must run 'cmake --install .'
Qt will be installed into '/usr/local/qt6'To configure and build other Qt modules, you can use the following convenience script:
/home/ingfernando/qt6-arm32/bin/qt-configure-moduleIf reconfiguration fails for some reason, try to remove 'CMakeCache.txt' from the build directory
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ingfernando/qt-cross/qtbase
- The cmake build FAILS
cmake --build .
This is the error i got:
error: ‘(QObjectPrivate::ExtraData::nameChangedForwarder == 0)’ is not a constant expression
if constexpr (Signal != nullptr)
Any help will be apprecieted. Many thanjs in advance
Regards@rightec According to https://doc.qt.io/qt-6.2/supported-platforms.html you need at least GCC 9 to compile Qt 6.2
-
-
@rightec According to https://doc.qt.io/qt-6.2/supported-platforms.html you need at least GCC 9 to compile Qt 6.2