Bug report #5517

spatialindex includes in subfolder, not found by qgis

Added by William Kyngesburye over 9 years ago. Updated over 9 years ago.

Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:15119


The standard spatialindex installation places its headers in a subfolder of $prefix/include, ie /usr/local/include/spatialindex/. The cmake FindSpatialitindex does not check for this, but I'm not sure if that is broken, as I am installing in a non-standard location.

But, qgsspatialindex.cpp also does not include from the subfolder. A leftover from when spatialindex was included in the source and didn't have the subfolder. Changing the qgsspatialindex.cpp include to:

#include <spatialindex/SpatialIndex.h>

fixes the include problem. The findspatialindex.cmake probably needs a similar fix.


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

SPATIALINDEX_INCLUDE_DIR is the directory where SpatialIndex.h is, so FindSpatialindex.cmake should set it to /usr/local/include/spatialindex in your case - and #include "SpatialIndex.h" should work just fine.

#2 Updated by William Kyngesburye over 9 years ago

  • Resolution set to invalid
  • Status changed from Open to Closed

Ah. But then spatialindex has a bug. I looked at all its internal headers included by spatialindex.h, and they are indeed local off the subfolder. Except Point.h, it causes the include error I saw with this:

#include <spatialindex/tools/Tools.h>

If you install spatialindex in a standard location like /usr/local you probably won't see an error because /usr/local/include will likely also be in your compile command.

So, invalid QGIS bug. Over to spatialindex folks...

Also available in: Atom PDF