I'm upgrading from GDAL 1.11.0 to 2.0.2 and having difficulties with the new 
geopackage implementation. When our code attempts to create a new geopackage 
the driver fails to initialize spatialite. We've using the same 
libspatialite-4.2.0 DLL built with sqlite-amalgamation-3.8.8.2 we used with the 
previous GDAL build. I haven't found any relevant differences in how we're 
building our GDAL DLL this time.

The failure occurs when sqliteGlobalConfig.mutex.xMutexEnter() is called from 
sqlite3_mutex_enter() in sqlite3.c. This results in attempting to execute NULL, 
so it appears sqliteGlobalConfig is not being initialized correctly or being 
overwritten after initialization. I've tried to step through that 
initialization but it's just too much code for me to understand in a reasonable 
period of time.

The originating call in our code is:

   GDALAllRegister();
   _driver = 
(GeoPackageDriverPtr)GetGDALDriverManager()->GetDriverByName("GPKG");
   if (_driver == NULL)
      throw "Unable to initialize GeoPackageWriter driver.";

   GDALDriver* gdalDriver = (GDALDriver*)_driver;
   char** metadata = gdalDriver->GetMetadata();
   if (!CSLFetchBoolean(metadata, GDAL_DCAP_CREATE, FALSE))
      throw "GPKG driver does not support Create";

   _dataset = (GeoPackageDatasetPtr) 
gdalDriver->Create(_tempFile->path().ascii(),
                                                        0,
                                                        0,
                                                        0,
                                                        GDT_Unknown,
                                                        0);

We're expecting the call to create the path in _tempFile as a vector-capable 
geopackage.
The call stack from there is:

sqlite3_mutex_enter()
sqlite_create_function_v2()
sqlite_create_function()
register_spatialite_sql_functions()
spatialite_init_ex()
OGRSQLiteBaseDataSource::InitNewSpatialite()
GDALGeoPackageDataset::OpenOrCreateDB()
GDALGeoPackageDataset::Create()
OGRGeoPackageDriverCreate()
GDALDriver::Create()

Does anyone have any ideas on what could be wrong?

Alan Stewart
Senior Software Engineer
TerraGo Technologies
3200 Windy Hill Road, Suite 1550W
Atlanta, GA 30339 USA
O.  +1 678.391.9615

www.terragotech.com<applewebdata://B24C0762-C7C9-4431-8518-ACC915448B89/www.terragotech.com>

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to