Bug report #5105

Embedded version of spatialite in QGIS conflict with the external one linked to OGR SQLite driver

Added by Even Rouault about 12 years ago. Updated over 9 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:worksforme
Crashes QGIS or corrupts data:No Copied to github as #:14866

Description

Extract from thread http://lists.osgeo.org/pipermail/qgis-developer/2012-February/thread.html#18510

The conclusion is in the last email

Paolo Cavallini cavallini at faunalia.it
Tue Feb 28 12:42:13 EST 2012

    Previous message: [Qgis-developer] Problems with Martin's repo
    Next message: [Qgis-developer] SpatiaLite layers invisible when loaded from browser
    Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

Hi all.
If I load a SL layer from the browser (from the files list, not from the SL submenu),
the layer is loaded, and can be exported, but is not displayed: anyone confirms?
All the best.
-- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Paolo Cavallini cavallini at faunalia.it
Wed Feb 29 02:45:21 EST 2012

    Previous message: [Qgis-developer] Import support for PostGIS in browser
    Next message: [Qgis-developer] SpatiaLite layers invisible when loaded from browser
    Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

Il 28/02/2012 20:23, Even Rouault ha scritto:

> I don't confirm. It works for me with both GDAL 1.9.0 and GDAL trunk, at least 
> on the attached simple example.

Confirmed: your sample is ok. The sample file[0] does not load correctly here.
Thanks.

[0]http://www.gaia-gis.it/spatialite-2.3.1/test-2.3.zip
-- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Even Rouault even.rouault at mines-paris.org
Wed Feb 29 14:09:32 EST 2012

    Previous message: [Qgis-developer] SpatiaLite layers invisible when loaded from browser
    Next message: [Qgis-developer] Offset curve tool
    Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

Le mercredi 29 février 2012 08:45:21, Paolo Cavallini a écrit :
> Il 28/02/2012 20:23, Even Rouault ha scritto:
> > I don't confirm. It works for me with both GDAL 1.9.0 and GDAL trunk, at
> > least on the attached simple example.
> 
> Confirmed: your sample is ok. The sample file[0] does not load correctly
> here. Thanks.

I also reproduce the error with the test-2.3 database. The difference with the 
poly.sqlite that I sent before is that test-2.3 contains no spatial index.

The console has interesting error messages :

ERROR 1: In ResetStatement(): sqlite3_prepare(SELECT _rowid_, * FROM 'Towns' 
WHERE MBRIntersects("Geometry", BuildMBR(-213552396.323174118996, 
-167417043.364000141621, 215180205.733174085617, 176566090.844000160694, 
32632))):
  no such function: BuildMBR

I'd note that you get the same behaviour when opening from "Open a Vector 
Layer" (which uses the OGR driver)

What is more interesting is that the same request run from ogrinfo works 
perfectly....

I'm afraid the reason why it does not work in QGIS is that it has the bad idea 
of embedding directly libspatialite in /usr/lib/libqgis_core.so.1.9.90 instead 
of dynamically linking to the one provided by the system. So I highly suspect 
a conflict between the libspatialite linked by libgdal.so and the one linked by 
libqgis_core, especially if they are not the same version ....

Another point is  that the QGIS File Browser only displays the first OGR layer, 
whereas when opening with "Open a Vector Layer", you can choose among all OGR 
layers.

History

#1 Updated by Volker Fröhlich about 12 years ago

Who built your QGIS?

#2 Updated by Even Rouault about 12 years ago

As far as I'm concerned, UbuntuGIS nightly builds:

ii libqgis1.9.90 1.9.90+git20120227+cda3693~lucid1 Quantum GIS - shared libraries

"objdump -T /usr/lib/libqgis_core.so.1.9.90 | grep spatialite" clearly shows that spatialite is embedded in it :

000000000050dbc8 g    DO .rodata    0000000000000006  Base        spatialiteversion
00000000003428f0 g    DF .text    0000000000000008  Base        spatialite_version
00000000004a5770 g    DF .text    000000000000011f  Base        spatialite_init

No idea for Paolo

#3 Updated by Even Rouault about 12 years ago

rouault - wrote:

As far as I'm concerned, UbuntuGIS nightly builds:

Well, correcting myself, I guess it is not UbuntuGIS, but :

deb http://qgis.org/debian-nightly lucid main

#4 Updated by Jürgen Fischer about 12 years ago

rouault - wrote:

rouault - wrote:

As far as I'm concerned, UbuntuGIS nightly builds:

Well, correcting myself, I guess it is not UbuntuGIS, but :
[...]

Not sure, but I think the spatialite provider needs spatialite 2.4.0 - lucid is at 2.3.0. The debian package stopped to use the system spatialite in 79bda7ff right after the internal spatialite version was updated to 2.4.0-RC4 in cdae0f67.

The browser should probably not rely on OGR to open spatialite tables, but use the spatialite provider.

#5 Updated by Paolo Cavallini over 11 years ago

  • Target version set to Version 2.0.0

#6 Updated by Jürgen Fischer almost 10 years ago

  • Target version changed from Version 2.0.0 to Future Release - Lower Priority

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

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

internal spatialite is only used when the system spatialite is too old for QGIS. Usually GDAL and QGIS are built against the system's spatialite version.

Also available in: Atom PDF