Details
-
Bug
-
Resolution: Unresolved
-
P4: Low
-
None
-
5.0.0, 5.0.1, 5.0.2
-
None
Description
When building with -dbus-linked on a Linux system, the variables $$QT_CFLAGS_DBUS and $$QT_LIBS_DBUS get populated by pkg-config. $$QT_CFLAGS_DBUS contains the include paths for the D-Bus library (e.g. -I/usr/include/dbus-1.0), and is always added into the build. $$QT_LIBS_DBUS contains the library (e.g. -ldbus-1), and is added to the build only when building with -dbus-linked. This part works fine.
However, when building on Windows, pkg-config is not available. In order to build against D-Bus, the user sets the variable DBUS_PATH instead, which provides a location for the header files and libraries to be found. This is sufficient to build the dynamic mode of QtDbus (-dbus), but it doesn't handle adding in the -ldbus-1 line which would be necessary for -dbus-linked to work properly.
When native building for Windows, some special win32-specific code takes care of adding -ldbus-1. However, if cross-building to another platform from Windows, this code doesn't get run, so -ldbus-1 is never added to the link. This effectively means that -dbus-linked does not work properly in this case.
I believe the right solution here is to remove the -ldbus-1 code from the special win32 block in dbus.pro, and instead add a line that says "QT_LIBS_DBUS = -ldbus-1" up in the DBUS_PATH block, which would simulate what normally happens via pkg-config. Then the normal code that handles -dbus-linked would take care of adding it to the build when the user builds with that mode. I'm not positive that this would catch all of the build cases, but it seems like it would be the right way to handle this problem. Does that sound right?
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-29984 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
49392,1 | Fixed -dbus-linked when cross-compiling from Windows | stable | qt/qtbase | Status: MERGED | +2 | 0 |
54933,1 | Fixed -dbus-linked when cross-compiling from Windows | 4.8 | qt/qt | Status: MERGED | +2 | 0 |