Bug 380769 - rkward 0.6.3 fails to compile on Linux/ARM
Summary: rkward 0.6.3 fails to compile on Linux/ARM
Status: RESOLVED FIXED
Alias: None
Product: rkward
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified All
: NOR normal
Target Milestone: ---
Assignee: RKWard Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-10 23:39 UTC by RKWard Team
Modified: 2015-12-31 21:11 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description RKWard Team 2015-03-10 23:39:08 UTC
-- Originally posted by (AT sourceforge.net): spotrh --

-- This ticket was imported from http://sourceforge.net/p/rkward/bugs/137 on 2017-05-30 15:26:58 +0100 --
In the process of updating rkward to 0.6.3 (against R 3.1.3) in Fedora, it was discovered that 0.6.3 failed to compile on ARM. The specific failure was:

~~~~~~~
/builddir/build/BUILD/rkward-0.6.3/rkward/plugin/rkpluginspinbox.cpp: In constructor 'RKPluginSpinBox::RKPluginSpinBox(const QDomElement&, RKComponent*, QWidget*)':
/builddir/build/BUILD/rkward-0.6.3/rkward/plugin/rkpluginspinbox.cpp:53:97: error: no matching function for call to 'qMax(double&, qreal)'
   double initial = xml->getDoubleAttribute (element, "initial", qMin (max, qMax (min, qreal(0.0))), DL_INFO);
                                                                                                 ^
/builddir/build/BUILD/rkward-0.6.3/rkward/plugin/rkpluginspinbox.cpp:53:97: note: candidate is:
In file included from /usr/include/QtCore/qatomic.h:45:0,
                 from /usr/include/QtCore/qhash.h:45,
                 from /usr/include/QtCore/QHash:1,
                 from /builddir/build/BUILD/rkward-0.6.3/rkward/plugin/rkcomponent.h:21,
                 from /builddir/build/BUILD/rkward-0.6.3/rkward/plugin/rkpluginspinbox.h:20,
                 from /builddir/build/BUILD/rkward-0.6.3/rkward/plugin/rkpluginspinbox.cpp:17:
/usr/include/QtCore/qglobal.h:1217:34: note: template<class T> const T& qMax(const T&, const T&)
 Q_DECL_CONSTEXPR inline const T &qMax(const T &a, const T &b) { return (a < b) ? b : a; }
                                  ^
/usr/include/QtCore/qglobal.h:1217:34: note:   template argument deduction/substitution failed:
/builddir/build/BUILD/rkward-0.6.3/rkward/plugin/rkpluginspinbox.cpp:53:97: note:   deduced conflicting types for parameter 'const T' ('double' and 'qreal {aka float}')
   double initial = xml->getDoubleAttribute (element, "initial", qMin (max, qMax (min, qreal(0.0))), DL_INFO);
~~~~~~~

This failure has been noted in other QT apps, specifically, it is the same issue noted in Debian http://localhost/show_bug.cgi?id=638813: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=638813

The fix is the same, to cast the necessary parameters of qMax to a double:

~~~~~~~
diff -up rkward-0.6.3/rkward/plugin/rkpluginspinbox.cpp.armfix rkward-0.6.3/rkward/plugin/rkpluginspinbox.cpp
--- rkward-0.6.3/rkward/plugin/rkpluginspinbox.cpp.armfix	2015-03-10 19:37:12.501771989 -0400
+++ rkward-0.6.3/rkward/plugin/rkpluginspinbox.cpp	2015-03-10 19:37:45.131562327 -0400
@@ -50,7 +50,7 @@ RKPluginSpinBox::RKPluginSpinBox (const
        if (!intmode) {
                double min = xml->getDoubleAttribute (element, "min", -FLT_MAX, DL_INFO);
                double max = xml->getDoubleAttribute (element, "max", FLT_MAX, DL_INFO);
-               double initial = xml->getDoubleAttribute (element, "initial", qMin (max, qMax (min, qreal(0.0))), DL_INFO);
+               double initial = xml->getDoubleAttribute (element, "initial", qMin (max, qMax (min, double(qreal(0.0)))), DL_INFO);
                int default_precision = xml->getIntAttribute (element, "default_precision", 2, DL_INFO);
                int max_precision = xml->getIntAttribute (element, "max_precision", 8, DL_INFO);

diff -up rkward-0.6.3/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp.armfix rkward-0.6.3/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp
--- rkward-0.6.3/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp.armfix	2015-03-10 20:11:02.363493214 -0400
+++ rkward-0.6.3/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp	2015-03-10 20:11:13.903466769 -0400
@@ -105,7 +105,7 @@ static QPen readSimplePen (QDataStream &
 	instream >> lwd >> lty;
 	if (!col.isValid () || (lty == -1L)) return QPen (Qt::NoPen);
 
-	lwd = qMax (qreal(1.0), lwd);	// minimum 1 px as in X11 device
+	lwd = qMax (double(qreal(1.0)), lwd);	// minimum 1 px as in X11 device
 	QPen ret;
 	if (lty != 0) {	// solid
 		QVector<qreal> dashes;
~~~~~~~

I waive any copyright on this patch, and when that is not possible, grant permission for it to be used under the same license as the rest of RKWard.
Comment 1 Thomas Friedrichsmeier 2015-12-31 21:11:12 UTC
- **status**: open --> closed-fixed
Comment 2 Thomas Friedrichsmeier 2015-12-31 21:11:12 UTC
Applied in 0.6.4. Thanks!