Notes on Qt 6.3 on the Raspberry Pi

This error came up when trying to build Qt 6.3 for the Raspberry Pi:

FAILED: qtbase/lib/libQt6DBus.so.6.3.0 qtbase/src/dbus/DBus.version /root/build/qtbase/src/dbus/DBus.version 
cd /root/qt-everywhere-src-6.3.0/qtbase/src/dbus && /usr/bin/perl /root/qt-everywhere-src-6.3.0/qtbase/mkspecs/features/data/unix/findclasslist.pl < /root/build/qtbase/src/dbus/DBus.version.in > /root/build/qtbase/src/dbus/DBus.version && cd /root/build && /opt/rpi/rpi-gcc-10.2.1/bin/arm-linux-gnueabihf-g++ --sysroot=/opt/rpi/sysroot -fPIC -Wl,-rpath-link,/opt/rpi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/opt/rpi/sysroot/lib/arm-linux-gnueabihf -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mthumb -DNDEBUG -O2  -Wl,-rpath-link,/opt/rpi/sysroot/usr/lib/arm-linux-gnueabihf   -Wl,--version-script,/root/build/qtbase/src/dbus/DBus.version -Wl,--no-undefined -Wl,--enable-new-dtags -shared -Wl,-soname,libQt6DBus.so.6 -o qtbase/lib/libQt6DBus.so.6.3.0 qtbase/src/dbus/CMakeFiles/DBus.dir/DBus_autogen/mocs_compilation.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbus_symbols.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusabstractadaptor.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusabstractinterface.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusargument.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusconnection.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusconnectioninterface.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbuscontext.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbuserror.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusextratypes.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusintegrator.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusinterface.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusinternalfilters.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusintrospection.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusmessage.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusmetaobject.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusmetatype.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusmisc.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbuspendingcall.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbuspendingreply.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusreply.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusserver.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusservicewatcher.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusunixfiledescriptor.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusutil.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusvirtualobject.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusxmlgenerator.cpp.o qtbase/src/dbus/CMakeFiles/DBus.dir/qdbusxmlparser.cpp.o  -Wl,-rpath,/root/build/qtbase/lib:  /opt/rpi/sysroot/usr/lib/arm-linux-gnueabihf/libdbus-1.a  qtbase/lib/libQt6Core.so.6.3.0  -pthread && :
/opt/rpi/rpi-gcc-10.2.1/lib/gcc/arm-linux-gnueabihf/10.2.1/../../../../arm-linux-gnueabihf/bin/ld: /opt/rpi/sysroot/usr/lib/arm-linux-gnueabihf/libdbus-1.a(libdbus_1_la-dbus-sysdeps-unix.o): in function `_dbus_listen_systemd_sockets':
(.text+0x1e5c): undefined reference to `sd_listen_fds'
/opt/rpi/rpi-gcc-10.2.1/lib/gcc/arm-linux-gnueabihf/10.2.1/../../../../arm-linux-gnueabihf/bin/ld: (.text+0x1e94): undefined reference to `sd_is_socket'
collect2: error: ld returned 1 exit status
[689/8283] Building C object qtbase/src/plugins/sqldrivers/sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/__/__/__/3rdparty/sqlite/sqlite3.c.o
ninja: build stopped: subcommand failed.

This means that the build must also link to libsystemd, so a quick fix is:

diff --git a/src/dbus/CMakeLists.txt b/src/dbus/CMakeLists.txt
index 5e4ee48ee7..f0a07c596d 100644
--- a/src/dbus/CMakeLists.txt
+++ b/src/dbus/CMakeLists.txt
@@ -65,6 +65,7 @@ qt_internal_extend_target(DBus CONDITION QT_FEATURE_dbus_linked
         QT_LINKED_LIBDBUS
     LIBRARIES
         dbus-1
+        systemd
 )
 
 qt_internal_extend_target(DBus CONDITION WIN32

Leave a Reply

Your email address will not be published. Required fields are marked *