Bug report #10762

2.4 build failure with old gcc

Added by landry Landry Breuil over 9 years ago. Updated almost 9 years ago.

Assignee:landry Landry Breuil
Affected QGIS version:2.4.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:19145


As reported in http://osgeo-org.1560.x6.nabble.com/Compiling-QGIS-2-4-with-GCC-4-4-debian-squeeze-td5146777.html, and i'm also facing that issue on OpenBSD with GCC 4.2.1, build fails the same way on several files.

/home/ports/pobj/qgis-2.4.0/qgis-2.4.0/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp: In constructor 'QgsDelimitedTextFeatureIterator::QgsDelimitedTextFeatureIterator(QgsDelimitedTextFeatureSource*, bool, const QgsFeatureRequest&)':
/home/ports/pobj/qgis-2.4.0/qgis-2.4.0/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp:29: error: class 'QgsDelimitedTextFeatureIterator' does not have any field named 'QgsAbstractFeatureIteratorFromSource'
/home/ports/pobj/qgis-2.4.0/qgis-2.4.0/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp:29: error: no matching function for call to 'QgsAbstractFeatureIteratorFromSource<QgsDelimitedTextFeatureSource>::QgsAbstractFeatureIteratorFromSource()'
/home/ports/pobj/qgis-2.4.0/qgis-2.4.0/src/providers/delimitedtext/../../core/qgsfeatureiterator.h:113: note: candidates are: QgsAbstractFeatureIteratorFromSource< <template-parameter-1-1> >::QgsAbstractFeatureIteratorFromSource(T*, bool, const QgsFeatureRequest&) [with T = QgsD
/home/ports/pobj/qgis-2.4.0/qgis-2.4.0/src/providers/delimitedtext/../../core/qgsfeatureiterator.h:111: note:                 QgsAbstractFeatureIteratorFromSource<QgsDelimitedTextFeatureSource>::QgsAbstractFeatureIteratorFromSource(const QgsAbstractFeatureIteratorFromSource<QgsD

A simple fix (that seem to work so far for me with gcc 4.2.1) is for all occurences of constructors inheriting from QgsAbstractFeatureIteratorFromSource calling their parent class constructor to specify the template type for source. Ie:

--- src/providers/wfs/qgswfsfeatureiterator.cpp.orig    Tue Jul  1 09:51:49 2014
+++ src/providers/wfs/qgswfsfeatureiterator.cpp Tue Jul  1 09:52:01 2014
@@ -19,7 +19,7 @@
 #include "qgsgeometry.h" 

 QgsWFSFeatureIterator::QgsWFSFeatureIterator( QgsWFSFeatureSource* source, bool ownSource, const QgsFeatureRequest& request )
-    : QgsAbstractFeatureIteratorFromSource( source, ownSource, request )
+    : QgsAbstractFeatureIteratorFromSource<QgsWFSFeatureSource>( source, ownSource, request )
   switch ( request.filterType() )

So far, here's the list of occurences i've found in my build (not yet finished)

  • src/core/qgsvectorlayerfeatureiterator.cpp
  • src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp
  • src/providers/gpx/qgsgpxfeatureiterator.cpp
  • src/providers/grass/qgsgrassfeatureiterator.cpp
  • src/providers/memory/qgsmemoryfeatureiterator.cpp
  • src/providers/mssql/qgsmssqlfeatureiterator.cpp
  • src/providers/ogr/qgsogrfeatureiterator.cpp
  • src/providers/oracle/qgsoraclefeatureiterator.cpp
  • src/providers/postgres/qgspostgresfeatureiterator.cpp
  • src/providers/spatialite/qgsspatialitefeatureiterator.cpp
  • src/providers/wfs/qgswfsfeatureiterator.cpp

If the fix is acceptable, i'll try to provide a pull request against git master...

0001-Fix-build-failure-with-gcc-4.4-bug-10762.patch Magnifier (9.67 KB) landry Landry Breuil, 2014-08-18 06:53 AM


#1 Updated by landry Landry Breuil over 9 years ago

More are needed, apparently for all occurences of Ctors inheriting from QgsConnectionPoolGroup

/home/ports/pobj/qgis-2.4.0/qgis-2.4.0/src/providers/spatialite/qgsspatialiteconnpool.h: In constructor 'QgsSpatiaLiteConnPoolGroup::QgsSpatiaLiteConnPoolGroup(QString)':
/home/ports/pobj/qgis-2.4.0/qgis-2.4.0/src/providers/spatialite/qgsspatialiteconnpool.h:44: error: class 'QgsSpatiaLiteConnPoolGroup' does not have any field named 'QgsConnectionPoolGroup'
/home/ports/pobj/qgis-2.4.0/qgis-2.4.0/src/providers/spatialite/qgsspatialiteconnpool.h:44: error: no matching function for call to 'QgsConnectionPoolGroup<QgsSqliteHandle*>::QgsConnectionPoolGroup()'
/home/ports/pobj/qgis-2.4.0/qgis-2.4.0/src/providers/spatialite/../../core/qgsconnectionpool.h:63: note: candidates are: QgsConnectionPoolGroup<T>::QgsConnectionPoolGroup(const QString&) [with T = QgsSqliteHandle*]
/home/ports/pobj/qgis-2.4.0/qgis-2.4.0/src/providers/spatialite/../../core/qgsconnectionpool.h:52: note:                 QgsConnectionPoolGroup<QgsSqliteHandle*>::QgsConnectionPoolGroup(const QgsConnectionPoolGroup<QgsSqliteHandle*>&)

similar fix:

--- src/providers/spatialite/qgsspatialiteconnpool.h.orig       Wed Jul  2 15:41:30 2014
+++ src/providers/spatialite/qgsspatialiteconnpool.h    Wed Jul  2 15:41:42 2014
@@ -41,7 +41,7 @@ class QgsSpatiaLiteConnPoolGroup : public QObject, pub

-    QgsSpatiaLiteConnPoolGroup( QString name ) : QgsConnectionPoolGroup( name ) { initTimer( this ); }
+    QgsSpatiaLiteConnPoolGroup( QString name ) : QgsConnectionPoolGroup<QgsSqliteHandle*>( name ) { initTimer( this ); }

   protected slots:
     void handleConnectionExpired() { onConnectionExpired(); }

#2 Updated by Jürgen Fischer over 9 years ago

  • Category set to Build/Install

#3 Updated by landry Landry Breuil over 9 years ago

And here's a patch against master, fixing the build for me.

#4 Updated by landry Landry Breuil about 9 years ago

  • % Done changed from 0 to 80
  • Target version set to Future Release - Nice to have
  • Assignee set to landry Landry Breuil

Anyone can apply this, before it bitrots ? Or i should do a github pull request ?

#5 Updated by Giovanni Manghi about 9 years ago

  • Assignee deleted (landry Landry Breuil)

landry - wrote:

Anyone can apply this, before it bitrots ? Or i should do a github pull request ?

I suggest to make a Pull Request on Github, because I'm not sure that patches are reviewed anymore on this bug tracker.

#6 Updated by landry Landry Breuil almost 9 years ago

  • Target version changed from Future Release - Nice to have to Version 2.8
  • % Done changed from 80 to 90
  • Assignee set to landry Landry Breuil

#7 Updated by Matthias Kuhn almost 9 years ago

  • Status changed from Open to Closed

Merged in 581cac7
Thank you very much

Also available in: Atom PDF