Install Spatialite on OS X Yosemite
Asked Answered
E

0

7

I have problems installing Spatialite tools on OS X Yosemite, first of all I have read Install Spatialite for python (GeoDjango) on OS X but it didn't help me to resolve the issue.

Here I will provide steps that I did in order to install spatialite with Homebrew.

1) Install latest sqlite3

brew install sqlite
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.8.8.3.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/sqlite-3.8.8.3.yosemite.bottle.tar.gz
==> Pouring sqlite-3.8.8.3.yosemite.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

OS X provides an older sqlite3.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/sqlite/lib
    CPPFLAGS: -I/usr/local/opt/sqlite/include

==> Summary
🍺  /usr/local/Cellar/sqlite/3.8.8.3: 9 files, 2.1M

2) Install libspatialite

brew install libspatialite 
==> Downloading https://homebrew.bintray.com/bottles/libspatialite-4.2.0_1.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/libspatialite-4.2.0_1.yosemite.bottle.tar.gz
==> Pouring libspatialite-4.2.0_1.yosemite.bottle.tar.gz
🍺  /usr/local/Cellar/libspatialite/4.2.0_1: 26 files,  17M

3) Install spatialite-tools

brew install spatialite-tools 
==> Downloading https://homebrew.bintray.com/bottles/spatialite-tools-4.2.0.yosemite.bottle.3.tar.gz
Already downloaded: /Library/Caches/Homebrew/spatialite-tools-4.2.0.yosemite.bottle.3.tar.gz
==> Pouring spatialite-tools-4.2.0.yosemite.bottle.3.tar.gz
🍺  /usr/local/Cellar/spatialite-tools/4.2.0: 21 files, 804K

4) Looks good so far, lets try to use spatialite

spatialite -version
SQLite header and source version mismatch
2015-02-25 13:29:11 9d6c1880fb75660bbabd693175579529785f8a6b
2014-12-09 01:34:36 f66f7a17b78ba617acde90fc810107f34f1a1f2e

So it looks like spatialite is built on top of sqlite3 (f66f7a17b78ba617acde90fc810107f34f1a1f2e) but not (9d6c1880fb75660bbabd693175579529785f8a6b)

Current version 3.8.8.3 9d6c1880fb75660bbabd693175579529785f8a6b

Required version 3.8.7.4 f66f7a17b78ba617acde90fc810107f34f1a1f2e

To fix this I need to install manually sqlite 3.8.7.4 instead of 3.8.8.3 which is latest version in homebrew

6) Remove currently installed sqlite

brew remove sqlite 
brew unlink sqlite

7) Install sqlite 3.8.7.4

Download tarbal from here https://www.sqlite.org/src/info/f66f7a17b78ba617acde90fc810107f34f1a1f2e and unpack contents

Install with

./configure
sudo make clean
sudo make
sudo make install

8) Try to create spatialite database

spatialite geo.db "SELECT InitSpatialMetaData();"
dyld: lazy symbol binding failed: Symbol not found: _sqlite3_rtree_geometry_callback
  Referenced from: /usr/local/lib/libspatialite.7.dylib
  Expected in: /usr/local/lib/libsqlite3.0.dylib

dyld: Symbol not found: _sqlite3_rtree_geometry_callback
  Referenced from: /usr/local/lib/libspatialite.7.dylib
  Expected in: /usr/local/lib/libsqlite3.0.dylib

Trace/BPT trap: 5

So the issue is that it cannot find _sqlite3_rtree_geometry_callback in a library...

Please point me what I did wrong or if there is a better way to install it on OS X

Thank you for your time

Ezekielezell answered 17/3, 2015 at 21:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.