Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.8.0
-
None
-
Raspbian 8 / Raspberry Pi 3.
-
5afde92bd76421a49b9eb76e6071b32fd3ca41df
Description
Since some months Raspian brings its own version of Qt (5.3?) which leads to linking errors when building Qt on the RasPi: Programs that depend on Qt module A where A depends on module B (but the program does not directly depend on) can't be linked because the linker tries to resolve B using the (outdated) system libraries.
For example canbustool depends on libQtSerialBus which depends on libQtNetwork (but the cantool does not directly depend on it):
linking ../../../bin/canbusutil /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpServer::newConnection()@Qt_5' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpServer::QTcpServer(QObject*)@Qt_5' //usr/lib/arm-linux-gnueabihf/libQt5Network.so.5: undefined reference to `qt_safe_select(int, fd_set*, fd_set*, fd_set*, timespec const*)' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpServer::acceptError(QAbstractSocket::SocketError )@Qt_5' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpServer::close()@Qt_5' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QHostAddress::~QHostAddress()@Qt_5' //usr/lib/arm-linux-gnueabihf/libQt5Network.so.5: undefined reference to `qIsEffectiveTLD(QString const&)' //usr/lib/arm-linux-gnueabihf/libQt5Network.so.5: undefined reference to `QNonContiguousByteDevice::disableReset()' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QAbstractSocket::connected()@Qt_5' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QAbstractSocket::peerName() const@Qt_5' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QAbstractSocket::state() const@Qt_5' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QAbstractSocket::staticMetaObject@Qt_5' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QAbstractSocket::error(QAbstractSocket::SocketError) @Qt_5' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpServer::isListening() const@Qt_5' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QAbstractSocket::peerAddress() const@Qt_5' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QAbstractSocket::disconnected()@Qt_5' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpServer::errorString() const@Qt_5' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpSocket::QTcpSocket(QObject*)@Qt_5' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QHostAddress::QHostAddress(QString const&)@Qt_5' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QAbstractSocket::peerPort() const@Qt_5' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpServer::staticMetaObject@Qt_5' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpServer::listen(QHostAddress const&, unsigned sho rt)@Qt_5' /media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `operator<<(QDebug, QHostAddress const&)@Qt_5' collect2: error: ld returned 1 exit status Makefile:90: recipe for target '../../../bin/canbusutil' failed make[4]: *** [../../../bin/canbusutil] Error 1 make[4]: Leaving directory '/media/pi/7018255e-fde8-46e9-9353-916727a36a5c/rpi3/src/qt-everywhere-opensource-src-5.8.0/qtserialbus/src/tools/canbusutil' Makefile:42: recipe for target 'sub-canbusutil-make_first' failed make[3]: *** [sub-canbusutil-make_first] Error 2
I saw this problem the first time with Qt 5.8.0 but I think also previous versions are affected (especially 5.6.x LTS) since the problem came in with the Raspbian provided Qt version.
In my case I was able to solve the problem by dropping the system library path from the file /qtbase/mkspecs/devices/common/linux_device_post.conf:
#contains(DISTRO_OPTS, deb-multi-arch) { # QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/$${GCC_MACHINE_DUMP} \ # -Wl,-rpath-link,$$[QT_SYSROOT]/lib/$${GCC_MACHINE_DUMP} #}
This definition makes the system path appear in first place so the linker finds the wrong Qt libraries and ignores the following build path with the correct libraries.
(A short workaround could be to tell the linker to ignore indirectly used libraries by setting QMAKE_LFLAGS="-Wl,-unresolved-symbols=ignore-in-shared-libs").
Attachments
Issue Links
- relates to
-
QTBUG-28094 rpath passed to configure should imply rpath-link
- Closed
For Gerrit Dashboard: QTBUG-59457 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
194830,3 | make mkspecs not mess up -rpath-link | 5.9 | qt/qtbase | Status: MERGED | +2 | 0 |