Bug 297964

Summary: FTBFS on armel and armhf due to not maintaining proper distinctions between double and qreal
Product: [Applications] digikam Reporter: Mark Purcell <msp>
Component: Portability-RuntimeAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: major CC: caulier.gilles
Priority: NOR    
Version: 2.6.0   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed In: 5.1.0
Sentry Crash Report:

Description Mark Purcell 2012-04-12 12:13:24 UTC
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=667700

From: peter green <plugwash@p10link.net>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: digikam FTBFS on armel and armhf due to not maintaining proper distinctions
 between double and qreal
Date: Thu, 05 Apr 2012 23:57:15 +0100
[Message part 1 (text/plain, inline)]
package: digikam
severity: serious
tags: patch
version: 4:2.6.0~beta2-2

The latest upload of digikam failed on armel and armhf with
the following erors

> cd "/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/obj-arm-linux-gnueabihf/extra/kipi-plugins/photolayoutseditor" && /usr/bin/c++   -D_BSD_SOURCE -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -DQT_NO_STL -DQT_NO_CAST_TO_ASCII -D_REENTRANT -DKDE_DEPRECATED_WARNINGS -DKDE4_CMAKE_TOPLEVEL_DIR_LENGTH=48 -DKDE_DEFAULT_DEBUG_AREA=51000 -DAREA_CODE_GENERAL=51000 -DAREA_CODE_LOADING=51001 -DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -DQT_NO_EXCEPTIONS -fno-check-new -fno-common -Woverloaded-virtual -fno-threadsafe-statics -fvisibility=hidden -Werror=return-type -fvisibility-inlines-hidden -DNDEBUG -DQT_NO_DEBUG -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/obj-arm-linux-gnueabihf/extra/kipi-plugins/photolayoutseditor" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-
plugins/photolayoutseditor" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/common/libkipiplugins" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/obj-arm-linux-gnueabihf/extra/kipi-plugins/common/libkipiplugins" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/common/libkipiplugins/dialogs" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/obj-arm-linux-gnueabihf/extra/kipi-plugins/common/libkipiplugins/dialogs" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/common/libkipiplugins/widgets" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/obj-arm-linux-gnueabihf/extra/kipi-plugins/common/libkipiplugins/widgets" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/common/libkipiplugins/tools" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/di
gikam-2.6.0~beta2/obj-arm-linux-gnueabihf/extra/kipi-plugins/common/libkipiplugins/tools" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/common/libkipiplugins/tools/threads" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/obj-arm-linux-gnueabihf/extra/kipi-plugins/common/libkipiplugins/tools/threads" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/common/libkipiplugins/tools/imageio" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/obj-arm-linux-gnueabihf/extra/kipi-plugins/common/libkipiplugins/tools/imageio" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/borders" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/borderplugins" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photo
layoutseditor/borderplugins/polaroid" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/borderplugins/solid" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/effects" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/effectplugins" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/effectplugins/blur" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/effectplugins/colorize" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/effectplugins/grayscale" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/effectplugins/sepia" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef
6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/effectplugins/negative" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/events" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/listeners" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/models" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/plugin" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/settings" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/threads" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/undo" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/e
xtra/kipi-plugins/photolayoutseditor/utils" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/utils/qtpropertybrowser/src" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets/canvas" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets/dialogs" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets/extra" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets/items" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets/layers" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam
-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets/menus" -I"/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets/tools" -I/usr/include/opencv -I/usr/include/KDE -I/usr/include/qt4/phonon -I/usr/include/qt4/QtXmlPatterns -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtWebKit -I/usr/include/qt4/QtUiTools -I/usr/include/qt4/QtTest -I/usr/include/qt4/QtSvg -I/usr/include/qt4/QtSql -I/usr/include/qt4/QtScriptTools -I/usr/include/qt4/QtScript -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtHelp -I/usr/include/qt4/QtDesigner -I/usr/include/qt4/QtDeclarative -I/usr/include/qt4/QtDBus -I/usr/include/qt4/Qt3Support -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -I/usr/include/qt4/Qt -I/usr/share/qt4/mkspecs/default -I/usr/include/qt4    -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -fPIC -fdata-sections -ffunction-sections -fPIC -o CMakeFiles/libphotolayoutseditor.d
ir/widgets/canvas/CropWidgetItem.cpp.o -c "/build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets/canvas/CropWidgetItem.cpp"
> /build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets/canvas/CropWidgetItem.cpp: In member function 'virtual void KIPIPhotoLayoutsEditor::CropWidgetItem::mouseMoveEvent(QGraphicsSceneMouseEvent*)':
> /build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets/canvas/CropWidgetItem.cpp:343:62: error: no matching function for call to 'qMin(qreal, double)'
> /build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets/canvas/CropWidgetItem.cpp:343:62: note: candidate is:
> /usr/include/qt4/QtCore/qglobal.h:1114:17: note: template<class T> const T& qMin(const T&, const T&)
> /build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets/canvas/CropWidgetItem.cpp:343:104: error: no matching function for call to 'qMin(qreal, double)'
> /build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets/canvas/CropWidgetItem.cpp:343:104: note: candidate is:
> /usr/include/qt4/QtCore/qglobal.h:1114:17: note: template<class T> const T& qMin(const T&, const T&)
> /build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets/canvas/CropWidgetItem.cpp:344:60: error: no matching function for call to 'qMax(qreal, double)'
> /build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets/canvas/CropWidgetItem.cpp:344:60: note: candidate is:
> /usr/include/qt4/QtCore/qglobal.h:1116:17: note: template<class T> const T& qMax(const T&, const T&)
> /build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets/canvas/CropWidgetItem.cpp:344:96: error: no matching function for call to 'qMax(qreal, double)'
> /build/buildd-digikam_2.6.0~beta2-2-armhf-ef6tKS/digikam-2.6.0~beta2/extra/kipi-plugins/photolayoutseditor/widgets/canvas/CropWidgetItem.cpp:344:96: note: candidate is:
> /usr/include/qt4/QtCore/qglobal.h:1116:17: note: template<class T> const T& qMax(const T&, const T&)

On most architectures qreal is defined as double but on arm
architectures it is defined as float. Assignments between double and
qreal are ok because assignments between float and qreal are ok. However
pointers to qreal must be treated as incompatible with pointers to
double and there can also be problems involving templates and ambiguous
overloads. In this particular case the issue is the qMin, qMax and
qBound templates which require all parameters to be of the same type.

The fix in this case is pretty simple, just a matter of adding some
typecasts to change constants to qreal before passing them to qMin,
qMax and qBound.

I also found an issue where something was creating a qlist with component
type qreal but passing it to a a routine that took a qlist with component
type double. Again this was easy to fix.



Index: digikam-2.6.0~beta3/core/utilities/gpssearch/gpssearchview.cpp
===================================================================
--- digikam-2.6.0~beta3.orig/core/utilities/gpssearch/gpssearchview.cpp 2012-04-01 20:54:26.000000000 +1000
+++ digikam-2.6.0~beta3/core/utilities/gpssearch/gpssearchview.cpp      2012-04-10 18:59:40.000000000 +1000
@@ -422,7 +422,7 @@
 
     // NOTE: coordinates as lon1, lat1, lon2, lat2 (or West, North, East, South)
     // as left/top, right/bottom rectangle.
-    QList<qreal> coordinatesList = QList<qreal>() <<
+    QList<double> coordinatesList = QList<double>() <<
                                    coordinates.first.lon() << coordinates.first.lat() <<
                                    coordinates.second.lon() << coordinates.second.lat();
 
Index: digikam-2.6.0~beta3/extra/kipi-plugins/photolayoutseditor/widgets/canvas/CropWidgetItem.cpp
===================================================================
--- digikam-2.6.0~beta3.orig/extra/kipi-plugins/photolayoutseditor/widgets/canvas/CropWidgetItem.cpp    2012-04-01 20:54:26.000000000 +1000
+++ digikam-2.6.0~beta3/extra/kipi-plugins/photolayoutseditor/widgets/canvas/CropWidgetItem.cpp 2012-04-10 18:59:40.000000000 +1000
@@ -340,8 +340,8 @@
         QPointF dif = event->scenePos() - event->lastScenePos();
         temp.translate(dif);
 
-        temp.translate( qMin(maxRect.right()-temp.right(),0.0), qMin(maxRect.bottom()-temp.bottom(),0.0) );
-        temp.translate( qMax(maxRect.left()-temp.left(),0.0), qMax(maxRect.top()-temp.top(),0.0) );
+        temp.translate( qMin(maxRect.right()-temp.right(),qreal(0.0)), qMin(maxRect.bottom()-temp.bottom(),qreal(0.0)) );
+        temp.translate( qMax(maxRect.left()-temp.left(),qreal(0.0)), qMax(maxRect.top()-temp.top(),qreal(0.0)) );
     }
     // Size change
     else
Index: digikam-2.6.0~beta3/core/libs/widgets/graphicsview/regionframeitem.cpp
===================================================================
--- digikam-2.6.0~beta3.orig/core/libs/widgets/graphicsview/regionframeitem.cpp 2012-04-01 20:54:26.000000000 +1000
+++ digikam-2.6.0~beta3/core/libs/widgets/graphicsview/regionframeitem.cpp      2012-04-10 18:59:40.000000000 +1000
@@ -639,8 +639,8 @@
 {
     const QSizeF maxSize = parentDImgItem()->boundingRect().size();
     const QPointF point  = mapToParent(event->pos());
-    qreal posX           = qBound<qreal>(0., point.x(), maxSize.width());
-    qreal posY           = qBound<qreal>(0., point.y(), maxSize.height());
+    qreal posX           = qBound(qreal(0.), point.x(), maxSize.width());
+    qreal posY           = qBound(qreal(0.), point.y(), maxSize.height());
     QRectF r             = rect();
 
     // Adjust edge
Comment 1 caulier.gilles 2012-04-12 13:19:03 UTC
try 2.6.0 beta3 which include already ARM compilation fixes...

Gilles Caulier
Comment 2 caulier.gilles 2015-06-26 13:43:34 UTC
New digiKam 4.11.0 is available :

https://www.digikam.org/node/740

Can you reproduce the problem with this release ?

Gilles Caulier
Comment 3 caulier.gilles 2015-08-21 07:06:20 UTC
digiKam 4.12.0 is out :

https://www.digikam.org/node/741

We need a fresh feedback using this release please...
Thanks in advance.
Comment 4 caulier.gilles 2016-07-14 13:16:54 UTC
This problem is not reproducible using last digiKam 5.0.0 .
I close this file now. Don't hesitate to re-open if necessary.
Gilles Caulier