Bug 393222 - kaffeine-2.0.14: build error: no matching function for call to ‘asString(DvbTransponderBase::TransmissionType)
Summary: kaffeine-2.0.14: build error: no matching function for call to ‘asString(DvbT...
Status: RESOLVED FIXED
Alias: None
Product: kaffeine
Classification: Applications
Component: general (show other bugs)
Version: 2.0.14
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Mauro Carvalho Chehab
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-17 12:44 UTC by Andreas Sturmlechner
Modified: 2018-05-16 19:42 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
build.log (118.96 KB, text/plain)
2018-04-17 12:44 UTC, Andreas Sturmlechner
Details
replace qPrintable() by a macro used only at Kaffeine (39.62 KB, patch)
2018-05-16 15:36 UTC, Mauro Carvalho Chehab
Details
replace qPrintable() by a macro used only at Kaffeine v2 (1.29 KB, patch)
2018-05-16 17:09 UTC, Mauro Carvalho Chehab
Details
Fix use of qPrintable (3.40 KB, patch)
2018-05-16 18:15 UTC, Fabian Vogt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Sturmlechner 2018-04-17 12:44:53 UTC
Created attachment 112070 [details]
build.log

This build failure is most likely caused by Qt-5.11 due to internal header cleanup.
Comment 1 Mauro Carvalho Chehab 2018-04-17 20:12:29 UTC
Hmm... the line in question is this one:

 qCWarning(logDev, "Unknown transmission type %s", qPrintable(transponder.getTransmissionType()));

With sounds OK on my eyes, as qPrintable is a valid statement: http://doc.qt.io/qt-5/qtglobal.html#qPrintable

As Qt 5.11 is still a WIP, I suspect that this is a transitory regression at their development tree. You should probably open a bug for Qt.
Comment 2 Antonio Rojas 2018-05-16 14:50:07 UTC
upstream report: https://bugreports.qt.io/browse/QTBUG-68307
Comment 3 Fabian Vogt 2018-05-16 15:18:01 UTC
AFAICT this is not actually valid use of qPrintable.

The documentation states that it is a function which takes a const-ref to a QString, which means the argument has to be either a QString or implicitly convertable. This is not the case for this use.

That this worked at all is due to a violation of the documentation in Qt itself, it's a macro and not a function.
The change which broke Kaffeine is this:

-#  define qPrintable(string) QString(string).toLocal8Bit().constData()
+#  define qPrintable(string) QtPrivate::asString(string).toLocal8Bit().constData()

It replaces the explicit converstion to QString with an implicit converstion. This means it's now behaving as documented.
Comment 4 Mauro Carvalho Chehab 2018-05-16 15:36:46 UTC
Created attachment 112687 [details]
replace qPrintable() by a macro used only at Kaffeine

Based on the comments at: https://bugreports.qt.io/browse/QTBUG-68307, qt5 seems to be explicitly breaking qPrintable() API.

So, add a replacement for it.
Comment 5 Fabian Vogt 2018-05-16 16:37:58 UTC
(In reply to Mauro Carvalho Chehab from comment #4)
> Created attachment 112687 [details]
> replace qPrintable() by a macro used only at Kaffeine
> 
> Based on the comments at: https://bugreports.qt.io/browse/QTBUG-68307, qt5
> seems to be explicitly breaking qPrintable() API.
> 
> So, add a replacement for it.

That's much longer than it needs to be - what about changing only the failing cases to qPrintable(QString(foo))?
Comment 6 Mauro Carvalho Chehab 2018-05-16 17:09:34 UTC
Created attachment 112690 [details]
replace qPrintable() by a macro used only at Kaffeine v2

(In reply to Fabian Vogt from comment #5)
> (In reply to Mauro Carvalho Chehab from comment #4)
> > Created attachment 112687 [details]
> > replace qPrintable() by a macro used only at Kaffeine
> > 
> > Based on the comments at: https://bugreports.qt.io/browse/QTBUG-68307, qt5
> > seems to be explicitly breaking qPrintable() API.
> > 
> > So, add a replacement for it.
> 
> That's much longer than it needs to be - what about changing only the
> failing cases to qPrintable(QString(foo))?

It is hard to tell what's wrong with qt5.11 without having it installed :-)

Could you please check if the enclosed patch is enough?
Comment 7 Fabian Vogt 2018-05-16 18:15:22 UTC
Created attachment 112692 [details]
Fix use of qPrintable

It was not - it didn't even touch the code in the posted build log ;-)

I attached a patch which fixes all compile errors here.
Comment 8 Mauro Carvalho Chehab 2018-05-16 19:42:12 UTC
Git commit 06b78c5f24891fd38d25ed64f5029106eec7c4fb by Mauro Carvalho Chehab, on behalf of Fabian Vogt.
Committed on 16/05/2018 at 19:39.
Pushed by mauroc into branch 'master'.

Fix breakages with qt5.11-rc2

On Qt5.11, there was a change at the way qPrintable() works.
There, the var using it should be already a QString() type,
not allowing implicit conversions.

With that, some usages of qPrintable() are invalid for qt5.11,
as the vars to be printed are either enums or integers.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

M  +2    -2    src/backend-vlc/vlcmediawidget.cpp
M  +1    -1    src/dvb/dvbdevice_linux.cpp
M  +1    -1    src/dvb/dvbrecording.cpp
M  +4    -4    src/sqlinterface.cpp

https://commits.kde.org/kaffeine/06b78c5f24891fd38d25ed64f5029106eec7c4fb