Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#8572 closed defect (fixed)

Fix MythTV for Qt 4.7 compatibility

Reported by: databubble Owned by: sphery
Priority: minor Milestone: 0.23-fixes
Component: MythTV - General Version: Master Head
Severity: medium Keywords: trunk
Cc: Ticket locked: no

Description (last modified by sphery)

I've been building 0.23-fixes and trunk fine on ubuntu 10.4, however, I recently enabled the kubuntu beta ppc (ppa:kubuntu-ppa/beta) to test KDE Software Compilation 4.5 Beta 2.

Since then, both trunk (25125) and 0.23-fixes are failing to build, as follows:

make[2]: Entering directory `/home/local/src/mythtv/trunk/mythtv/libs/libmythupnp'
ccache g++ -c -pipe -fomit-frame-pointer -O3 -g -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -Wno-non-virtual-dtor -funit-at-a-time -D__STDC_CONSTANT_MACROS -D_REENTRANT -DPIC -fPIC -DMMX -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I/usr/include -I/usr -I../libmythdb -I.. -I. -o upnpcmgr.o upnpcmgr.cpp
In file included from upnpcmgr.h:29,
                 from upnpcmgr.cpp:26:
eventing.h: In member function ‘T StateVariables::GetValue(const QString&) [with T = QString]’:
upnpcmgr.cpp:69:   instantiated from here
eventing.h:236: error: call of overloaded ‘QString(int)’ is ambiguous
/usr/include/qt4/QtCore/qstring.h:428: note: candidates are: QString::QString(const QByteArray&)
/usr/include/qt4/QtCore/qstring.h:426: note:                 QString::QString(const char*)
/usr/include/qt4/QtCore/qstring.h:727: note:                 QString::QString(const QString&)
/usr/include/qt4/QtCore/qstring.h:106: note:                 QString::QString(QChar)
/usr/include/qt4/QtCore/qstring.h:105: note:                 QString::QString(const QChar*)
eventing.h:244: error: call of overloaded ‘QString(int)’ is ambiguous
/usr/include/qt4/QtCore/qstring.h:428: note: candidates are: QString::QString(const QByteArray&)
/usr/include/qt4/QtCore/qstring.h:426: note:                 QString::QString(const char*)
/usr/include/qt4/QtCore/qstring.h:727: note:                 QString::QString(const QString&)
/usr/include/qt4/QtCore/qstring.h:106: note:                 QString::QString(QChar)
/usr/include/qt4/QtCore/qstring.h:105: note:                 QString::QString(const QChar*)
make[2]: *** [upnpcmgr.o] Error 1
make[2]: Leaving directory `/home/local/src/mythtv/trunk/mythtv/libs/libmythupnp'
make[1]: *** [sub-libmythupnp-make_default] Error 2
make[1]: Leaving directory `/home/local/src/mythtv/trunk/mythtv/libs'
make: *** [sub-libs-make_default-ordered] Error 2

I'm guessing the failure is related to the use of Qt 4.7.0 beta (4:4.7.0~beta1+git20100522-0ubuntu1~lucid1~ppa1).

Attachments (4)

mythtv-compile_fixes_for_qt_4_7.patch (3.3 KB) - added by sphery 8 years ago.
mythplugins-compile_fixes_for_qt_4_7.patch (1.8 KB) - added by sphery 8 years ago.
mythtv-trunk-r26286-compile.patch (2.6 KB) - added by James.Dutton@… 8 years ago.
Same patch as above, but modified to work against mythtv trunk
mythtv-8572-compile_fixes_for_qt_4_7-templates.patch (3.2 KB) - added by sphery 8 years ago.
Hack to just make MythTV compile. This marks the 2 locations that still need fixing in trunk and -fixes after [26391] (and includes a third change that's only necessary because of the hack that's being used elsewhere).

Download all attachments as: .zip

Change History (19)

comment:1 Changed 8 years ago by databubble

Sorry, hopefully this is formatted better:

make[2]: Entering directory `/home/local/src/mythtv/trunk/mythtv/libs/libmythupnp'
ccache g++ -c -pipe -fomit-frame-pointer -O3 -g -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -Wno-non-virtual-dtor -funit-at-a-time -D__STDC_CONSTANT_MACROS -D_REENTRANT -DPIC -fPIC -DMMX -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I/usr/include -I/usr -I../libmythdb -I.. -I. -o upnpcmgr.o upnpcmgr.cpp
In file included from upnpcmgr.h:29,
                 from upnpcmgr.cpp:26:
eventing.h: In member function ‘T StateVariables::GetValue(const QString&) [with T = QString]’:
upnpcmgr.cpp:69:   instantiated from here
eventing.h:236: error: call of overloaded ‘QString(int)’ is ambiguous
/usr/include/qt4/QtCore/qstring.h:428: note: candidates are: QString::QString(const QByteArray&)
/usr/include/qt4/QtCore/qstring.h:426: note:                 QString::QString(const char*)
/usr/include/qt4/QtCore/qstring.h:727: note:                 QString::QString(const QString&)
/usr/include/qt4/QtCore/qstring.h:106: note:                 QString::QString(QChar)
/usr/include/qt4/QtCore/qstring.h:105: note:                 QString::QString(const QChar*)
eventing.h:244: error: call of overloaded ‘QString(int)’ is ambiguous
/usr/include/qt4/QtCore/qstring.h:428: note: candidates are: QString::QString(const QByteArray&)
/usr/include/qt4/QtCore/qstring.h:426: note:                 QString::QString(const char*)
/usr/include/qt4/QtCore/qstring.h:727: note:                 QString::QString(const QString&)
/usr/include/qt4/QtCore/qstring.h:106: note:                 QString::QString(QChar)
/usr/include/qt4/QtCore/qstring.h:105: note:                 QString::QString(const QChar*)
make[2]: *** [upnpcmgr.o] Error 1
make[2]: Leaving directory `/home/local/src/mythtv/trunk/mythtv/libs/libmythupnp'
make[1]: *** [sub-libmythupnp-make_default] Error 2
make[1]: Leaving directory `/home/local/src/mythtv/trunk/mythtv/libs'
make: *** [sub-libs-make_default-ordered] Error 2

comment:2 Changed 8 years ago by databubble

I had a look at the code where the build is failing. I'm not a programmer, but it looks to me like the function is looking up value from an array using a string name/index. If the string isn't found, it should be returning a 0 or false or something (I think), but instead it seems to by trying to lookup the value of a null character - definitely odd, and I can see why the compiler is throwing a wobbly.

If I change the two cases of "return T(0);" to "return 0" it compiles... but I don't know if is the intended return value.

I'm sure any real programmer can look at this and, in just a couple of seconds, say what the function should be returning, so that I can build 0.23-fixes and trunk again....

From mythtv/libs/libmythupnp/eventing.h (lines 236 & 244).

       template < class T >
        T GetValue( const QString &sName )
        {
            SVMap::iterator it = m_map.find(sName);
            if (it == m_map.end())
            return T(0);

            StateVariable< T > *pVariable =
                dynamic_cast< StateVariable< T > *>( *it );

            if (pVariable != NULL)
                return pVariable->GetValue();

            return T(0);
        }

comment:3 Changed 8 years ago by sphery

Description: modified (diff)

comment:4 Changed 8 years ago by sphery

Status: newinfoneeded_new

Can you try rebuilding after changing:

return T(0);

on lines 236 and 244 of mythtv/libs/libmythupnp/eventing.h to

return T(QString::null);

and let us know if that solves it, please. Thanks.

comment:5 Changed 8 years ago by sphery

oops, that should have been a capital N: return T(QString::Null);

comment:6 Changed 8 years ago by anonymous

Hmmm.... not quite....

ccache g++ -c -pipe -fomit-frame-pointer -O3 -g -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -Wno-non-virtual-dtor -funit-at-a-time -D__STDC_CONSTANT_MACROS -D_REENTRANT -DPIC -fPIC -DMMX -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I/usr/include -I/usr -I../libmythdb -I.. -I. -o upnpcds.o upnpcds.cpp
In file included from upnpcds.h:33,
                 from upnpcds.cpp:28:
eventing.h: In member function ‘T StateVariables::GetValue(const QString&)’:
eventing.h:236: error: expected primary-expression before ‘(’ token
eventing.h:236: error: expected primary-expression before ‘)’ token
eventing.h:244: error: expected primary-expression before ‘(’ token
eventing.h:244: error: expected primary-expression before ‘)’ token
make: *** [upnpcds.o] Error 1

Changed 8 years ago by sphery

Changed 8 years ago by sphery

comment:7 Changed 8 years ago by sphery

Status: infoneeded_newnew

The attached 2 patches allow compilation with Qt 4.7, but I don't know if they break MythTV or the code involved. The template code (in eventing.h and mythdeque.h) and the change to the TuningRequest? constructor (required after the change to mythdeque.h), especially. The template classes need to be able to work with QString and int, but Qt 4.7 no longer allows construction of a null QString with QString(0) or QString(null). Instead, QString() should be used. I have no idea what effect the template changes will have when T = int.

comment:8 Changed 8 years ago by anonymous

Just an update that I've been running this now for 5 weeks without issue,and I'm currently updated to 25612.

comment:9 Changed 8 years ago by sphery

Component: MythTV - UPnPMythTV - General
Owner: changed from dblain to sphery
Priority: majorminor
Status: newassigned
Summary: trunk and 0.23-fixes build failure in upnpcmgr with Qt 4.7.0-beta1Fix MythTV for Qt 4.7 compatibility

I plan to do a proper fix for this, but likely won't work on it until after we freeze for 0.24.

Changed 8 years ago by James.Dutton@…

Same patch as above, but modified to work against mythtv trunk

comment:10 Changed 8 years ago by sphery

(In [26390]) Partial build fixes for Qt 4.7 (currently a release candidate).

This commits the not-broken parts of the patch from #8572. The template portion is still broken and needs to be fixed properly, but I still haven't figured out a good way of doing so.. Refs #8572.

Changed 8 years ago by sphery

Hack to just make MythTV compile. This marks the 2 locations that still need fixing in trunk and -fixes after [26391] (and includes a third change that's only necessary because of the hack that's being used elsewhere).

comment:11 Changed 8 years ago by sphery

Forgot to ref this ticket in [26391] , which backported the changes in [26390] to 0.23-fixes. Only the templates need fixing in 0.23-fixes and trunk, now.

comment:12 Changed 8 years ago by danielk

[26429] should have referenced this ticket.

comment:13 Changed 8 years ago by danielk

(In [26431]) Refs #8572. Another Qt 4.7 compile fix.

comment:14 Changed 8 years ago by sphery

Resolution: fixed
Status: assignedclosed

(In [26434]) Fix compilation with Qt 4.7. Backports [26429] and [26431] from trunk. Fixes #8572.

comment:15 Changed 8 years ago by sphery

Milestone: unknown0.23-fixes
Note: See TracTickets for help on using tickets.