Hi,

Recent dbus cmake build system (and binary packages) uses different dll names for release/debug build (dbus-1/dbus1d) and compiler (mingw: libdbus-1(d).dll msvc: dbus-1(d).dll) While linking the dbus libraries to the qdbus module using the import libraries (which is indicated by the QT_LINKED_LIBDBUS macro) qt honors all the above mentioned dll naming scheme.

In the opposite the newly added qdbus feature to load the dbus library dynamically breaks debug support because qdbus only loads dbus-1.dll (the msvc release dll) regardless of compiler and compile mode.

Unfortunally this makes it impossible to debug qdbus with dbus. The appended patch fixes this problem according to the following rules:
/*
dbus library searching rules as already implemented for linked qdbus (with extension [1],[2]) os compiler compile type library versions library name win32 gcc debug --- libdbus-1d, libdbus-1[1], dbus-1[2] win32 gcc release --- libdbus-1, dbus-1 [2] win32 msvc debug --- dbus-1d, dbus-1[1] win32 msvc release --- dbus-1 unix gcc debug 3,2 dbus-1 unix gcc release 3,2 dbus-1 [1] when qdbus is compiled as debug release and there is no dbus debug library, the dbus release library will be taken [2] when no gcc debug or release dbus library is available a msvc dbus release build will be taken.
*/

Does anyone see a problem with this rules ?

Ralf


Index: dbus/qdbus_symbols.cpp
===================================================================
--- dbus/qdbus_symbols.cpp	(revision 832472)
+++ dbus/qdbus_symbols.cpp	(working copy)
@@ -73,17 +73,50 @@
     lib = new QLibrary;
     triedToLoadLibrary = true;
 
-    static int majorversions[] = { 3, 2, -1 };
     lib->unload();
-    lib->setFileName(QLatin1String("dbus-1"));
-    for (uint i = 0; i < sizeof(majorversions) / sizeof(majorversions[0]); ++i) {
-        lib->setFileNameAndVersion(lib->fileName(), majorversions[i]);
-        if (lib->load() && lib->resolve("dbus_connection_open_private"))
-            return true;
 
-        lib->unload();
+    /*
+       dbus library searching rules as already implemented for linked qdbus (with extension [1],[2]) 
+          
+        os     compiler   compile type  library versions    library name 
+       win32    gcc         debug             ---             libdbus-1d, libdbus-1[1], dbus-1[2]
+       win32    gcc         release           ---             libdbus-1, dbus-1 [2]
+       win32    msvc        debug             ---             dbus-1d, dbus-1[1]
+       win32    msvc        release           ---             dbus-1
+       unix     gcc         debug             3,2             dbus-1
+       unix     gcc         release           3,2             dbus-1 
+                
+       [1] when qdbus is compiled as debug release and there is no dbus debug library, the dbus release library will be taken 
+       [2] when no gcc debug or release dbus library is available a msvc dbus release build will be taken
+    */ 
+    QStringList libNames;
+#if defined(Q_OS_WIN32)
+#if defined(Q_CC_MINGW)
+#if defined(QT_DEBUG)
+    libNames << QLatin1String("libdbus-1d");
+#endif
+    libNames << QLatin1String("libdbus-1") << QLatin1String("dbus-1");
+#else // MSVC
+#if defined(QT_DEBUG)
+    libNames << QLatin1String("dbus-1d");
+#endif
+    libNames << QLatin1String("dbus-1");
+#endif
+    static int majorversions[] = { -1 };
+#else // UNIX
+    libNames << QLatin1String("dbus-1");
+    static int majorversions[] = { 3, 2, -1 };
+#endif
+
+    foreach(const QString libName, libNames) {
+        for (uint i = 0; i < sizeof(majorversions) / sizeof(majorversions[0]); ++i) {
+            lib->setFileNameAndVersion(libName, majorversions[i]);
+            if (lib->load() && lib->resolve("dbus_connection_open_private"))
+                return true;
+
+            lib->unload();
+        }
     }
-
     delete lib;
     lib = 0;
     return false;
_______________________________________________
Kde-windows mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-windows

Reply via email to