[gdal-dev] Problem to compile in Lucid with Spatialite 3.0 and gdal 1.9

Even Rouault even.rouault at mines-paris.org
Tue Jan 24 03:17:40 EST 2012


Thomas,

Your issue reminds me something that Tamas Szerekeres also hit when switching to
spatialite 3.0 on Windows.

There has been a change in spatialite 3.0 w.r.t spatialite 2.X regarding to how
its "amalgamation" is done.

In spatialite 3.0, the sqlite3.h that is included redefines the sqlite3_XXXX
symbols as SPLite_XXXX (previously it did no do this). So the libspatialite.so
(resulting from amalgamation) does no longer contain sqlite3_XXXX symbols but
SPLite_XXXX .

What happens here is that the GDAL compilation must fetch the standard sqlite3.h
header (not the one from spatialite), and then expect the regular symbol names.

My recommandation :
1) Don't use spatialite-amalgamation (as recommanded by Sandro) on Linux, but
the regular libspatialite built against external libsqlite3. AFAIU,
spatialite-amalgamation is mainly aimed at making Windows users life easier.
2) Why do you use sqlite 3.3.10 on Ubuntu 10.04, whereas it ships with sqlite
3.6 in its default configuration ?

Alternatively (but not recommanded), if you still want to use
spatialite-amalgamation, 2 possibilities :
    * Make sure that the standard sqlite3.h isn't found in the include path when
compiling GDAL, and that the spatialite one is always used
    * OR (but really not recommanded) also add -lsqlite3 in the linking line,
but that's going to be messy to have 2 versions of sqlite. I'm not sure what
would happen then, but potentially bad things if the sqlite versions of the
external sqlite and spatialite's embeded one are different.

Best regards,

Even

>
> Am 24.01.2012 02:32, schrieb Thomas Gratier:
> > Hello all,
> >
> > I've done some tests to build gdal 1.9.0 in Ubuntu 10.04 (Lucid)
> > I've build proj 3.3.2, Sqlite 3.3.10, Free XL 1.0.0b, libspatialite
> > amalgation 3.0.0, spatialite-tools 3.0.0
> > No problem with sqlite alone.
> >
> > #####################################################
> > My main problem is when I compile gdal for spatialite support.
> > #####################################################
> >
> > I do
> >
> > ./configure --with-geos=yes --with-python --with-spatialite=yes
> > --with-sqlite3=yes --with-curl=/usr/bin/
> > --with-pg=/usr/lib/postgresql/9.0/bin/pg_config
> > make
> >
> > and I get
> >
> > ...
> > libtool: link: g++ .libs/gdalinfo.o -o .libs/gdalinfo
> > /home/thomas/compile/gdal-1.9.0/.libs/libgdal.so -L/usr/local/lib
> > -L/usr/lib /usr/lib/libodbc.so /usr/lib/libodbcinst.so /usr/lib/libexpat.so
> > -lxerces-c /usr/lib/libNCSEcw.so /usr/lib/libNCSEcwC.so
> > /usr/lib/libNCSCnet.so /usr/lib/libNCSUtil.so /usr/lib/libjasper.so
> > -lnetcdf /usr/lib/libhdf5.so /usr/lib/libmfhdfalt.so /usr/lib/libdfalt.so
> > -logdi /usr/lib/libgif.so /usr/lib/libjpeg.so -lpng -lpq -lz -lrt
> > /usr/local/lib/libspatialite.so -lpthread -ldl /usr/local/lib/libfreexl.so
> > /usr/local/lib/libgeos_c.so /usr/local/lib/libgeos.so /usr/lib/libproj.so
> > -lm /usr/lib/libcurl-gnutls.so
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_bind_int'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_column_double'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_exec'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_column_text'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_bind_double'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_bind_blob'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_step'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_get_table'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_open'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_free_table'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_reset'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_vfs_find'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_column_bytes'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to
> `sqlite3_clear_bindings'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_column_blob'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to
> `sqlite3_vfs_unregister'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to
> > `sqlite3_last_insert_rowid'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to
> > `sqlite3_libversion_number'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_column_name'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_prepare'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_vfs_register'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_column_int'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_prepare_v2'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_finalize'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_bind_text'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_column_count'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_close'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to
> > `sqlite3_column_decltype'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_column_type'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_errmsg'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_bind_null'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_free'
> > gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_open_v2'
> >
> > With the ./configure, the return was
> > SQLite support:            yes
> > SpatiaLite support:        yes
> >
> > Doing
> >
> > ldd /home/thomas/compile/gdal-1.9.0/.libs/libgdal.so|grep lite
> > return
> > libspatialite.so.2 =>  /usr/local/lib/libspatialite.so.2 (0x012ec000)
> >
> >
> > #############################################################
> > The same case without --with-spatialite=yes
> > no problem in the make, but no spatialite support
> > #############################################################
> >
> > ./configure --with-geos=yes --with-python --with-sqlite3=yes
> > --with-curl=/usr/bin/ --with-pg=/usr/lib/postgresql/9.0/bin/pg_config
> > make
> >
> > Doing
> >
> > ldd /home/thomas/compile/gdal-1.9.0/.libs/libgdal.so|grep lite
> > return
> > libsqlite3.so.0 =>  /usr/local/lib/libsqlite3.so.0 (0x0040f000)
> >
> > ########
> > Question
> > ########
> >
> > I suppose the list of
> > "gdal-1.9.0/.libs/libgdal.so: undefined reference to `sqlite3_*" is sent
> > because of the missing
> > libsqlite3.so.0 =>  /usr/local/lib/libsqlite3.so.0 (0x0040f000)
> > but why the libgdal.so doesn't reference libsqlite3.so too when building
> > using --with-spatialite=yes
> > For information, I've used ldconfig after each build of each lib.
> > Any clue is welcome, maybe I miss something obvious.
> >
> > Thanks
> >
> > ThomasG
> >
> >
> >
> >
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
> --
> Frank BRONIEWSKI
>
> METRICO s.à r.l.
> géomètres
> technologies d'information géographique
> rue des Romains 36
> L-5433 NIEDERDONVEN
>
> tél.: +352 26 74 94 - 28
> fax.: +352 26 74 94 99
> http://www.metrico.lu
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>


More information about the gdal-dev mailing list