Talk:Cross-Compile Qt 6 for Raspberry Pi
Jump to navigation
Jump to search
This discussion page is intended for talks about improving the article.
Issue with libdbus
During the testing process, we found a compilation error related to libdbus.
FAILED: qtbase/lib/libQt6DBus.so.6.3.0 qtbase/src/dbus/DBus.version /home/uraihan/qt-cross/qtbase/src/dbus/DBus.version
cd /home/uraihan/qt5/qtbase/src/dbus && /usr/bin/perl /home/uraihan/qt5/qtbase/mkspecs/features/data/unix/findclasslist.pl < /home/uraihan/qt-cross/qtbase/src/dbus/DBus.version.in > /home/uraihan/qt-cross/qtbase/src/dbus/DBus.version && cd /home/uraihan/qt-cross && /usr/bin/aarch64-linux-gnu-g++-9 --sysroot=/home/uraihan/rpi-sysroot -fPIC -I/home/uraihan/rpi-sysroot/usr/include -pipe -O2 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,--version-script,/home/uraihan/qt-cross/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,/home/uraihan/rpi-sysroot:/home/uraihan/qt-cross/qtbase/lib: /home/uraihan/rpi-sysroot/usr/lib/aarch64-linux-gnu/libdbus-1.a qtbase/lib/libQt6Core.so.6.3.0 -lpthread && :
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: /home/uraihan/rpi-sysroot/usr/lib/aarch64-linux-gnu/libdbus-1.a(libdbus_1_la-dbus-message.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `dbus_message_unref' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/uraihan/rpi-sysroot/usr/lib/aarch64-linux-gnu/libdbus-1.a(libdbus_1_la-dbus-message.o): in function `_dbus_message_loader_unref':
(.text+0x59d8): dangerous relocation: unsupported relocation
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: /home/uraihan/rpi-sysroot/usr/lib/aarch64-linux-gnu/libdbus-1.a(libdbus_1_la-dbus-timeout.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_dbus_timeout_unref' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/uraihan/rpi-sysroot/usr/lib/aarch64-linux-gnu/libdbus-1.a(libdbus_1_la-dbus-timeout.o): in function `_dbus_timeout_list_free':
(.text+0x130): dangerous relocation: unsupported relocation
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: /home/uraihan/rpi-sysroot/usr/lib/aarch64-linux-gnu/libdbus-1.a(libdbus_1_la-dbus-watch.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_dbus_watch_unref' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/uraihan/rpi-sysroot/usr/lib/aarch64-linux-gnu/libdbus-1.a(libdbus_1_la-dbus-watch.o): in function `_dbus_watch_list_free':
(.text+0x1b0): dangerous relocation: unsupported relocation
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: /home/uraihan/rpi-sysroot/usr/lib/aarch64-linux-gnu/libdbus-1.a(libdbus_1_la-dbus-sysdeps-unix.o): in function `_dbus_listen_systemd_sockets':
(.text+0x204c): undefined reference to `sd_listen_fds'
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: (.text+0x2090): undefined reference to `sd_is_socket'
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: /home/uraihan/rpi-sysroot/usr/lib/aarch64-linux-gnu/libdbus-1.a(libdbus_1_la-dbus-userdb.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_dbus_group_info_unref' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/uraihan/rpi-sysroot/usr/lib/aarch64-linux-gnu/libdbus-1.a(libdbus_1_la-dbus-userdb.o): in function `_dbus_user_database_new':
(.text+0x4e8): dangerous relocation: unsupported relocation
collect2: error: ld returned 1 exit status
[563/4792] Building CXX object qtbase/src/testlib/CMakeFiles/Test.dir/qjunittestlogger.cpp.o
ninja: build stopped: subcommand failed.
It was found that the libdbus inside the initial sysroot was not a dynamically shared objects. As a temporary fix, it was decided to temporarily exclude this feature from the configuration by including
-DFEATURE_dbus=OFF
flag, but this is fixable by doing clean reinstall of Raspberry Pi OS.