Qt bindings compilation
Alexey Morozov
alex-db at idisys.iae.nsk.su
Mon Jan 31 03:29:23 PST 2005
Hello!
I'm trying to compile dbus-0.23 w/ qt bindings enabled, and got a lot of
errors.
While problems w/ configure/qt-detection stage are relatively simple to
solve (and probably distro-specific), there're other errors, which I
think either mean that current Qt-bindings are fundamentally broken or I
do smth really wrong.
First of all there're two 'typo' errors at lines 39 and 60 of
qt/dbus-qthread.cpp
(http://cvs.freedesktop.org/dbus/dbus/qt/dbus-qthread.cpp?annotate=1.4&only_with_tag=DBUS_0_23)
There're certainly typos (a dot instead of comma after *mutex at line
39, and missing comma after dbus_qmutex_unlock at line 60). These two
typos are trivially to fix, not a big problem indeed.
There're also some constants clash, DBUS_THREAD_FUNCTIONS_NEW_MASK is
now called (well, _perhaps_, called)
DBUS_THREAD_FUNCTIONS_MUTEX_NEW_MASK and so that
DBUS_THREAD_FUNCTIONS_FREE_MASK and DBUS_THREAD_FUNCTIONS_FREE_MASK.
Also a rather trivial fix.
Later I encountered w/ some C++-specific errors like this:
dbus-qthread.cpp: In function `DBusMutex* dbus_qmutex_new()':
dbus-qthread.cpp:74: error: invalid static_cast from type `QMutex*' to
type `DBusMutex*'
...
I took a look at the code, and found (beside some other typos like
'timeout_msec' spelled as 'timout_msec', at line 133 and obviously
'mutex' instead' of 'qmutex' at 81)
expressions like the following:
static void
dbus_qmutex_free (DBusMutex *mutex)
{
QMutex * qmutex = static_cast<QMutex*>(mutex);
...
Well, I'm not a C++-hacker (anymore), but it seems that reinterpret_cast
instead of static_cast is what the code writer(s) meant. static_cast is
a type-safe casting, used mainly for derived-to-base class casts, while
reinterpret_cast is a unsafe cast used to blindly convert a pointer of
one type to a pointer to another.
There were a bunch of changes related to such static_cast. Also wakeOne
and wakeAll methods of QWaitCondition have no arguments, so I changed that.
Well, now dbus-qthread.cpp can be compiled and since it's mostly a
wrapper for corresponding Qt methods, it should even work now. There're
minor issues w/ code style (this code is evidently exception-unsafe and
potentially leaking but it's not that important right now).
There're also a bunch of 'code reaches the end of non-void function'
warnings (actually, errors) in message.cpp (yet another trivial fix) and
a couple more serious problems, like unimplemented class Message copy
constructor.
Nevertheless, I can see that some vendors (Mdk, PLD, Suse contribs) do
provide RPM packages of dbus-qt. This either means that they avoided all
these, well, serious compilation problems or they built smth else. Also
I can see that tools like KVM (KDE Volume Manager in KDE non beta)
requires 'dbus-qt'. So my questions are:
1. Are Qt-bindings for dbus [theoretically] alive?
2. Does development of these bindings occur in dbus CVS,
http://cvs.freedesktop.org/dbus/dbus/qt/ or maybe some other place?
3. Is there anybody who really uses it for some apps?
If dbus-qt is really what comes w/ dbus releases and can be downloaded
from dbus CVS, I'll provide all patches I have created so far to
configure and compile entire lib.
Yours sincerely,
Alexey Morozov
More information about the dbus
mailing list