Weird build failure in kdelibs due to Phonon

Michael Pyne michael.pyne at kdemail.net
Tue May 1 03:42:32 BST 2007


Hi all,

It looks like phonon in kdelibs requires that Qt 4 be built with either 
QT_NO_MEMBER_TEMPLATES or QT_NO_QOBJECT_CHECK to be defined, due to the 
declaration of qobject_cast in qobject.h, line 411.

It appears that the ObjectDescriptionModel template in phonon tries to 
simulate a QObject class for each instantiated template definition by 
implementing various internal QObject methods and data members, including a 
meta object.  Unfortunately, it doesn't seem to implement the 
qt_check_for_QOBJECT_macro() method, which breaks compilation in phonon/kcm 
(where a qobject_cast is used on a template definition of 
ObjectDescriptionModel, called AudioOutputDeviceModel in a qobject_cast<> 
call in outputdevicechoice.cpp:207.

I'd fix it but I'm not exactly sure how. :) I would imagine that we're 
duplicating internal Qt stuff since the Q_OBJECT stuff doesn't work with 
template classes but unfortunately that leads us to problems like this.

I could be completely screwed up, but here's the error message I'm getting:
[ 97%] Building CXX object 
phonon/kcm/CMakeFiles/kcm_phonon.dir/outputdevicechoice.o
/home/kde-svn/qt4/include/QtCore/qabstractitemmodel.h: In member 
function ‘void QAbstractListModel::qt_check_for_QOBJECT_macro(const T&) const 
[with T = Phonon::ObjectDescriptionModel<AudioOutputDeviceType>]’:
/home/kde-svn/qt4/include/QtCore/qobject.h:411:   instantiated from ‘T 
qobject_cast(QObject*) [with T = Phonon::AudioOutputDeviceModel*]’
/home/kde-svn/kde4/kdelibs/phonon/kcm/outputdevicechoice.cpp:207:   
instantiated from here
/home/kde-svn/qt4/include/QtCore/qabstractitemmodel.h:311: error: void value 
not ignored as it ought to be
/home/kde-svn/qt4/include/QtCore/qabstractitemmodel.h: In member 
function ‘void QAbstractListModel::qt_check_for_QOBJECT_macro(const T&) const 
[with T = Phonon::ObjectDescriptionModel<AudioCaptureDeviceType>]’:
/home/kde-svn/qt4/include/QtCore/qobject.h:411:   instantiated from ‘T 
qobject_cast(QObject*) [with T = Phonon::AudioCaptureDeviceModel*]’
/home/kde-svn/kde4/kdelibs/phonon/kcm/outputdevicechoice.cpp:255:   
instantiated from here
/home/kde-svn/qt4/include/QtCore/qabstractitemmodel.h:311: error: void value 
not ignored as it ought to be
make[2]: *** [phonon/kcm/CMakeFiles/kcm_phonon.dir/outputdevicechoice.o] Error 
1
make[1]: *** [phonon/kcm/CMakeFiles/kcm_phonon.dir/all] Error 2
make: *** [all] Error 2

I've seen similar errors in the dashboard which were due to missing Q_OBJECTs 
or .mocs, but both of those seem to be taken care of in this case by 
implementing them directly.

Regards,
 - Michael Pyne

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070430/3ac51ecc/attachment.sig>


More information about the kde-core-devel mailing list