Error: no such function: SetRasterCoverageInfos

37 views
Skip to first unread message

Chiara Marmo

unread,
Mar 27, 2017, 10:06:18 AM3/27/17
to SpatiaLite Users
Hello,

I'm on CentOS7 (I can't choose the OS on this machine...)
I have installed from source SQLite version 3.17.0, then libspatialite and librasterlite2 from fossil development repos (https://www.gaia-gis.it/fossil/libspatialite, https://www.gaia-gis.it/fossil/librasterlite2).

But once in sqlite3
SQLite version 3.17.0 2017-02-13 16:02:40
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite
> SELECT load_extension('mod_spatialite');

sqlite
> SELECT load_extension('mod_rasterlite2');

sqlite
> .open fractal.sqlite
sqlite
> .databases
main
: /mnt/data/textures/fractal.sqlite
sqlite
> SELECT RL2_SetRasterCoverageInfos('formatted_fractal_field_georef_byte', 'fractal field georeferenced', 'worldwide synthetic topography');
Error: no such function: RL2_SetRasterCoverageInfos

And yet RL2_SetRasterCoverageInfos()
is the name of the function available from rl2sql.c ...
Any hints?

Thanks a lot,

ciao!
Chiara

a.fu...@lqt.it

unread,
Mar 27, 2017, 10:41:23 AM3/27/17
to spatiali...@googlegroups.com
On Mon, 27 Mar 2017 07:06:17 -0700 (PDT), Chiara Marmo wrote:
> sqlite> SELECT load_extension('mod_spatialite');
> sqlite> SELECT load_extension('mod_rasterlite2');
>

ciao Chiara,

just a small remark; you are loading the two extensions in
the wrong order. mod_rasterlite2 should always be loaded
first and mod_spatialite second. Please check:

https://www.gaia-gis.it/fossil/librasterlite2/wiki?name=planetEarthReloaded


> Error: no such function: RL2_SetRasterCoverageInfos
>
> And yet RL2_SetRasterCoverageInfos()
> is the name of the function available from rl2sql.c ...
> Any hints?
>

probably there are two (or more) different copies of
mod_rasterlite2 installed on your system, and you are
actually loading the wrong (obsolete) one.
you can easily check if this is true by executing:

$ sudo find / -name mod_rasterlite2.so -print

a. you can then check the creation date-time of
each copy (ls -l absolute-path)
b. and you can then test each copy by loading
it using its absolute path, as e.g.:
SELECT load_extension('/usr/local/lib/mod_rasterlite2.so');

bye sandro



Chiara Marmo

unread,
Mar 28, 2017, 5:33:15 AM3/28/17
to SpatiaLite Users
Ciao Sandro,


On Monday, March 27, 2017 at 4:41:23 PM UTC+2, sandro furieri wrote:
On Mon, 27 Mar 2017 07:06:17 -0700 (PDT), Chiara Marmo wrote:
> sqlite> SELECT load_extension('mod_spatialite');
> sqlite> SELECT load_extension('mod_rasterlite2');
>

just a small remark; you are loading the two extensions in
the wrong order. mod_rasterlite2 should always be loaded
first and mod_spatialite second. Please check:

https://www.gaia-gis.it/fossil/librasterlite2/wiki?name=planetEarthReloaded


Thanks, I missed that one, now fixed


> Error: no such function: RL2_SetRasterCoverageInfos
>
> And yet RL2_SetRasterCoverageInfos()
> is the name of the function available from rl2sql.c ...
> Any hints?
>

probably there are two (or more) different copies of
mod_rasterlite2 installed on your system, and you are
actually loading the wrong (obsolete) one.
you can easily check if this is true by executing:

$ sudo find / -name mod_rasterlite2.so -print

a. you can then check the creation date-time of
    each copy (ls -l absolute-path)
b. and you can then test each copy by loading
    it using its absolute path, as e.g.:
    SELECT load_extension('/usr/local/lib/mod_rasterlite2.so');

$ sudo find / -name mod_rasterlite2.so -print
/usr/lib64/mod_rasterlite2.so
/usr/local/lib/mod_rasterlite2.so
/home/centos/software/librasterlite2/src/.libs/mod_rasterlite2.so


 /usr/lib64/mod_rasterlite2.so is a symbolic link to /usr/local/lib/mod_rasterlite2.so
/home/centos/software/librasterlite2/src/.libs/mod_rasterlite2.so is the compiled version before installation on standard path.
Just to be sure I have loaded the absolute path of the 'true' files (I mean not linked) but nothing changes...
I'm open to any suggestions.. :)

Thanks for your help and your code!
Chiara

mj10777

unread,
Mar 28, 2017, 7:24:26 AM3/28/17
to SpatiaLite Users


On Monday, 27 March 2017 16:41:23 UTC+2, sandro furieri wrote:
On Mon, 27 Mar 2017 07:06:17 -0700 (PDT), Chiara Marmo wrote:
> sqlite> SELECT load_extension('mod_spatialite');
> sqlite> SELECT load_extension('mod_rasterlite2');
>

ciao Chiara,

just a small remark; you are loading the two extensions in
the wrong order. mod_rasterlite2 should always be loaded
first and mod_spatialite second. Please check:
For those that are interested:
The reason why 'mod_rasterlite2' must be called first is that
- 'mod_spatialite' contains function headers for RL2 functions
-- that return NULL if 'mod_rasterlite2' has not yet been loaded, otherwise it will use the point set by mod_rasterlite2

The goal is to be able to use 'mod_spatialite' without 'mod_rasterlite2'.

Mark

a.fu...@lqt.it

unread,
Mar 28, 2017, 12:48:56 PM3/28/17
to spatiali...@googlegroups.com
On Tue, 28 Mar 2017 02:33:14 -0700 (PDT), Chiara Marmo wrote:
>
> $ sudo find / -name mod_rasterlite2.so -print
> /usr/lib64/mod_rasterlite2.so
> /usr/local/lib/mod_rasterlite2.so
> /home/centos/software/librasterlite2/src/.libs/mod_rasterlite2.so
>
>  /usr/lib64/mod_rasterlite2.so is a symbolic link to
> /usr/local/lib/mod_rasterlite2.so
> /home/centos/software/librasterlite2/src/.libs/mod_rasterlite2.so is
> the compiled version before installation on standard path.
> Just to be sure I have loaded the absolute path of the 'true' files
> (I
> mean not linked) but nothing changes...
> I'm open to any suggestions.. :)
>

Chiara,

RL2_SetRasterCoverageInfos() works as expected on both Fedora
and Windows (using binaries built from the latest sources);
so we can reasonably exclude any code defect.
anyway on your CentOS an error message "no such function:
RL2_SetRasterCoverageInfos" is unexpectedly returned, and
we should now discover why it happens.

hypothesis #1
-------------
for some unknown reason loading mod_rasterlite2 failed.
you can easily check if this is your case by executing
few SQL statements:

SELECT rl2_version();
SELECT rl2_target_cpu();
SELECT rl2_has_codec_jpeg();
SELECT RL2_GetMaxThreads();

case #1.A: if all the above statements will return
an error like "no such function: xxxxx" this will
surely mean that mod_rasterlite2 hasn't been loaded
(and we'll be required to discover why).

case #1.B: anything runs smoothly as expected, but
RL2_SetRasterCoverageInfos() still fails.
in this case there is a reasonable suspect
that the mod_rasterlite2.so being loaded does
not corresponds to the source's latest version.

hypothesis #2
-------------
inadvertently using an obsolete mod_rasterlite2.
you can check this shell command:

nm <absolute_path_to_mod_rasterlite2.so> |
grep fnct_SetRasterCoverageInfos

the expected output should be something like:

0000000000001112f6 t fnct_SetRasterCoverageInfos

note: you must install rasterlite2 by executing
"make install" and not "make install-strip" (this
second will remove all internal symbols from
the installed library)

case #2.A: "nm" returns nothing; this surely means
that mod_rasterlite2.so does not correspond
to the latest sources (probably something
gone wrong during the build process).
hint: carefully remove all sources and binaries
(revert back to a clean system), then try again
to rebuild and install rasterlite2.

case #2.B: "nm" confirms that the link symbol
"fnct_SetRasterCoverageInfos" is effectively
defined within mod_rasterlite2 but calling
the corresponding SQL function will continue
to fail ... OMG: quickly call an exorcist for
assistance: your CentOS is bewitched :-D

bye Sandro

Chiara Marmo

unread,
Mar 29, 2017, 4:03:30 AM3/29/17
to SpatiaLite Users
Ciao Sandro,
sei un tesoro! :)

Following your workflow many problems were hilighted:

- I have installed librasterlite2 with "make install-strip", having no nm answer to the command.

- After reinstall with "make install" nm answers as expected but
sqlite> SELECT load_extension('mod_rasterlite2');
sqlite
> SELECT load_extension('mod_spatialite');

sqlite
> SELECT rl2_version();
Error: no such function: rl2_version
The solution was to load mod_rasterlite2 with its absolute path (either the symbolic link or the 'hard' file work)

- I have opened my database
sqlite> .open fractal.sqlite
sqlite
> SELECT RL2_SetRasterCoverageInfos('formatted_fractal_field_georef_byte', 'fractal field georeferenced', 'worldwide synthetic topography');
Error: no such function: RL2_SetRasterCoverageInfos
sqlite
> SELECT rl2_version();
Error: no such function: rl2_version
Aaarrrgh... but no panic... reloading the modules after opening the file finally did the job

- The right thing to do for me is

sqlite> .open fractal.sqlite
sqlite
> SELECT load_extension('/usr/local/lib/mod_rasterlite2.so');

sqlite
> SELECT load_extension('mod_spatialite');

sqlite
> SELECT RL2_SetRasterCoverageInfos('formatted_fractal_field_georef_byte', 'fractal field georeferenced', 'worldwide synthetic topography');
0

...even if I do not know exactly why...
Sorry for the details, hoping that they will be useful to other users.

Grazie mille!
Chiara

mj10777

unread,
Mar 29, 2017, 4:20:47 AM3/29/17
to SpatiaLite Users
The reason is very simple:
- sqlite has no idea, when called in this way, what  'spatialite', 'rasterlite2' or any other extension is.

Even after 'load_extension('..') has been called
- sqlite has no idea what the spatialite functions are
--> but it knows that extensions have been loaded, and sends the commands to them
---> if none of the loaded extensions know the called function
----> 'Error: no such function:' will be reported

This is true not only for the 'sqlite' command interface
- but also for a pure sqlite Database driver: SELECT load_extension('..') must be called

For the spatialite command interface, this is slightly different
- a load_extension for spatialite is NOT needed
-> a load_extension for rasterlite2 IS needed

Mark
Reply all
Reply to author
Forward
0 new messages