mod_rasterlite2 .so instead of .dylib in librasterlite2 (macOS)

44 views
Skip to first unread message

Petros Koutsolampros

unread,
Mar 27, 2017, 6:11:18 AM3/27/17
to SpatiaLite Users
Hello,

I'm trying to compile rasterlite2 for macOS sierra (10.12.3) and I get the librasterlite2.dylib but a mod_rasterlite2.so not a mod_rasterlite2.dylib that I can use through load_extension()

Any ideas how to solve this?

Cheers,
Petros

a.fu...@lqt.it

unread,
Mar 27, 2017, 7:24:12 AM3/27/17
to spatiali...@googlegroups.com
On Mon, 27 Mar 2017 03:11:17 -0700 (PDT), Petros Koutsolampros wrote:
> Hello,
>
> I'm trying to compile rasterlite2 for macOS sierra (10.12.3) and I
> get
> the librasterlite2.dylib but a mod_rasterlite2.SO not a
> mod_rasterlite2.DYLIB that I can use through load_extension()
>
> Any ideas how to solve this?
>

Hi Petros,

the binaries suffix (.dll, .so, .dylib or whatever else) is
always automatically set by the standard ./configure script,
so it fully depends on GNU Automake.

I've just a very limited experience about MacOsX, but AFAIK
MacOsX is one of the very few operating systems making a real
distinction between dynamic libraries and loadable modules
(this strongly differs from e.g. either Linux or Windows, where
they are just two different synonyms for the same binary object).

accordingly to this post [1] it seems that on MacOsX the
.dylib suffix should be only used for genuine shared libraries,
whilst loadable modules ("bundles" in Mac jargon) are always
expected to be identified by a .so suffix (thus confirming
that Automake is correctly applying the MacOsX rules when
building the loadable module "mod_rasterlite2").

[1]
http://stackoverflow.com/questions/2339679/what-are-the-differences-between-so-and-dylib-on-osx

if you are facing troubles when using an SQL statement
like this:

SELECT load_extension('mod_rasterlite2');

this probably means that SQLite on Mac wrongly ignores to
check if a module legitimately named "mod_rasterlite2.so"
do really exist; it seems to be kind of a bug / partial
porting, and should be more appropriately reported to
sqlite's developers.

an alternative hot-fix could simply be the one to explicitly
declare the required suffix, as e.g.:

SELECT load_extension('mod_rasterlite2.so');

bye Sandro


Petros Koutsolampros

unread,
Mar 27, 2017, 8:05:19 AM3/27/17
to SpatiaLite Users

Hi Sandro,

Thank you for this information!

I did try load_extension('mod_rasterlite2.so') but then it tries to fetch mod_rasterlite2.so.dylib, which yes, seems like an issue for sqlite, although from what I can see here spatialite uses a dylib (mod_spatialite.dylib which loads fine).

I renamed mod_rasterlite2.so to mod_rasterlite2.dylib (I suppose that's fine because it's just a link to mod_rasterlite2.1.so?) and it goes forward but then it throws this error:

Error: dlopen(/usr/local/lib/mod_rasterlite2.dylib, 10): Symbol not found: _GifFreeMapObject
 
Referenced from: /usr/local/lib/mod_rasterlite2.dylib
 
Expected in: flat namespace
 
in /usr/local/lib/mod_rasterlite2.dylib

which is exactly the same error as when I try to load librasterlite2.dylib (was trying just in case)

Petros


mj10777

unread,
Mar 27, 2017, 8:13:26 AM3/27/17
to SpatiaLite Users
This looks more like a dependency problem (like an outdated libgif):

ldd /usr/local/lib/mod_rasterlite2.so

should show something like this (look for different version numbers):

linux-vdso.so.1 =>  (0x00007ffd711e0000)
libpng16.so.16 => /usr/local/lib/libpng16.so.16 (0x00007f40ba190000)
libwebp.so.4 => /usr/local/lib/libwebp.so.4 (0x00007f40b9f42000)
libcairo.so.2 => /usr/local/lib/libcairo.so.2 (0x00007f40b9c2a000)
libcurl.so.4 => /usr/local/lib/libcurl.so.4 (0x00007f40b99c3000)
libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007f40b95fe000)
libCharLS.so.1 => /usr/lib/x86_64-linux-gnu/libCharLS.so.1 (0x00007f40b93bb000)
libopenjp2.so.6 => /usr/local/lib/libopenjp2.so.6 (0x00007f40b9174000)
libgeotiff.so.2 => /usr/local/lib/libgeotiff.so.2 (0x00007f40b8f3c000)
libtiff.so.5 => /usr/local/lib/libtiff.so.5 (0x00007f40b8cc7000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f40b8aa5000)
libjpeg.so.8 => /usr/local/lib/libjpeg.so.8 (0x00007f40b8869000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f40b8563000)
libgif.so.4 => /usr/lib/x86_64-linux-gnu/libgif.so.4 (0x00007f40b835a000)
libz.so.1 => /usr/local/lib/libz.so.1 (0x00007f40b813f000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f40b7f21000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f40b7b5d000)
libpixman-1.so.0 => /usr/lib/x86_64-linux-gnu/libpixman-1.so.0 (0x00007f40b78b1000)
libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f40b7674000)
libfreetype.so.6 => /usr/local/lib/libfreetype.so.6 (0x00007f40b73e8000)
libxcb-shm.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007f40b71e4000)
libxcb-render.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007f40b6fdb000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f40b6dbc000)
libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007f40b6bb1000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f40b6878000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f40b6666000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f40b645d000)
libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f40b61fc000)
libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f40b5e19000)
liblber-2.4.so.2 => /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 (0x00007f40b5c09000)
libldap_r-2.4.so.2 => /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2 (0x00007f40b59b7000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f40b57b3000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f40b54a3000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f40b528c000)
libproj.so.0 => /usr/local/lib/libproj.so.0 (0x00007f40b5040000)
libjbig.so.0 => /usr/lib/x86_64-linux-gnu/libjbig.so.0 (0x00007f40b4e31000)
/lib64/ld-linux-x86-64.so.2 (0x00007f40ba6ad000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f40b4c08000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f40b4a03000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f40b47fd000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f40b45e1000)
libsasl2.so.2 => /usr/lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007f40b43c6000)
libgssapi.so.3 => /usr/lib/x86_64-linux-gnu/libgssapi.so.3 (0x00007f40b4185000)
libgnutls-deb0.so.28 => /usr/lib/x86_64-linux-gnu/libgnutls-deb0.so.28 (0x00007f40b3e7b000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007f40b3b9a000)
libheimntlm.so.0 => /usr/lib/x86_64-linux-gnu/libheimntlm.so.0 (0x00007f40b3990000)
libkrb5.so.26 => /usr/lib/x86_64-linux-gnu/libkrb5.so.26 (0x00007f40b3706000)
libasn1.so.8 => /usr/lib/x86_64-linux-gnu/libasn1.so.8 (0x00007f40b3461000)
libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007f40b325c000)
libhcrypto.so.4 => /usr/lib/x86_64-linux-gnu/libhcrypto.so.4 (0x00007f40b3028000)
libroken.so.18 => /usr/lib/x86_64-linux-gnu/libroken.so.18 (0x00007f40b2e13000)
libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007f40b2bd0000)
libtasn1.so.6 => /usr/lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007f40b29bd000)
libnettle.so.4 => /usr/lib/x86_64-linux-gnu/libnettle.so.4 (0x00007f40b278c000)
libhogweed.so.2 => /usr/lib/x86_64-linux-gnu/libhogweed.so.2 (0x00007f40b255d000)
libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f40b22dd000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f40b20d8000)
libwind.so.0 => /usr/lib/x86_64-linux-gnu/libwind.so.0 (0x00007f40b1eae000)
libheimbase.so.1 => /usr/lib/x86_64-linux-gnu/libheimbase.so.1 (0x00007f40b1c9f000)
libhx509.so.5 => /usr/lib/x86_64-linux-gnu/libhx509.so.5 (0x00007f40b1a54000)
libsqlite3.so.0 => /usr/local/lib/libsqlite3.so.0 (0x00007f40b177f000)
libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f40b1546000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f40b133d000)



Mark


Petros


Petros Koutsolampros

unread,
Mar 27, 2017, 10:46:00 AM3/27/17
to SpatiaLite Users


That was indeed the problem Mark, thank you for your comment!

For future reference I used the mac equivalent:
 
otool -L /usr/local/lib/mod_rasterlite2.1.so

which yielded (see in bold):

/usr/local/lib/mod_rasterlite2.1.so:
   
/usr/local/opt/libpng/lib/libpng16.16.dylib (compatibility version 46.0.0, current version 46.0.0)
   
/opt/local/lib/libwebp.6.dylib (compatibility version 7.0.0, current version 7.1.0)
   
/opt/local/lib/liblzma.5.dylib (compatibility version 8.0.0, current version 8.2.0)
   
/opt/local/lib/libcairo.2.dylib (compatibility version 11403.0.0, current version 11403.6.0)
   
/opt/local/lib/libcurl.4.dylib (compatibility version 9.0.0, current version 9.0.0)
   
/opt/local/lib/libxml2.2.dylib (compatibility version 12.0.0, current version 12.4.0)
   
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
   
/opt/local/lib/libopenjp2.7.dylib (compatibility version 7.0.0, current version 2.1.0)
   
/usr/local/opt/libgeotiff/lib/libgeotiff.2.dylib (compatibility version 4.0.0, current version 4.1.0)
   
/opt/local/lib/libtiff.5.dylib (compatibility version 8.0.0, current version 8.4.0)
   
/opt/local/lib/libgif.4.dylib (compatibility version 6.0.0, current version 6.7.0)
   
/opt/local/lib/libjpeg.9.dylib (compatibility version 11.0.0, current version 11.0.0)
   
/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
   
/opt/local/lib/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0)

which is where homebrew (a macOS package manager) installed an old version of giflib

The result after removing that and installing giflib-5.1.4:

/usr/local/lib/mod_rasterlite2.1.so:
   
/usr/local/opt/libpng/lib/libpng16.16.dylib (compatibility version 46.0.0, current version 46.0.0)
   
/opt/local/lib/libwebp.6.dylib (compatibility version 7.0.0, current version 7.1.0)
   
/opt/local/lib/liblzma.5.dylib (compatibility version 8.0.0, current version 8.2.0)
   
/opt/local/lib/libcairo.2.dylib (compatibility version 11403.0.0, current version 11403.6.0)
   
/opt/local/lib/libcurl.4.dylib (compatibility version 9.0.0, current version 9.0.0)
   
/opt/local/lib/libxml2.2.dylib (compatibility version 12.0.0, current version 12.4.0)
   
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
   
/opt/local/lib/libopenjp2.7.dylib (compatibility version 7.0.0, current version 2.1.0)
   
/usr/local/opt/libgeotiff/lib/libgeotiff.2.dylib (compatibility version 4.0.0, current version 4.1.0)
   
/opt/local/lib/libtiff.5.dylib (compatibility version 8.0.0, current version 8.4.0)
    /usr/local/lib/libgif.7.dylib (compatibility version 8.0.0, current version 8.0.0)
   
/opt/local/lib/libjpeg.9.dylib (compatibility version 11.0.0, current version 11.0.0)
   
/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
   
/opt/local/lib/libsqlite3.0.dylib (compatibility version 9.0.0, current version 9.6.0)

And with the previously mentioned hack (rename mod_rasterlib2.so link to mod_rasterlib2.dylib) it now loads properly!
Thanks both!

Petros
Reply all
Reply to author
Forward
0 new messages