4

I am trying to build the latest version of Spatialite for use on the iOS platform and am not making much progress. I have downloaded the latest version of the following libraries, and have attempted to bring them into one project (each as their own target) and build them as one static library.

  • Spatialite (3.0.1 amalgamation)
  • GEOS (nightly build on 20121114)
  • PROJ.4 (4.8.0)

Each download contains dozens of files intermingled with scrips, headers and source code. It is unclear from the steps here, which should be loaded and which shouldn't. I have tried bringing in all the files in each directory into their own group, to no avail and I get stuck at Step 2 because my version of Xcode is different from that used in the example. When adding the PROJ.4 bits Xcode asks me if I want to create an "external build system project."

I have also tried taking Lionel's project from this post and updating the versions of all the software. Unfortunately Xcode throws dozens of warnings in the new source and throws a few errors as well. I can share those if necessary. Going further, I've even taken his output (a static library and headers) and brought them into another project, but for some reason the compiler is throwing errors saying they it can't find "sqlite3." I've added SQLite3 to the project but it didn't clear things up.

I have also tried following up on this thread, but I'm not able to ask questions and so I can't ask the original user how he/she accomplished this.

Finally, a question:

Does anyone know how to build the latest version of Spatialite and its companion libraries (GEOS, PROJ.4) with Xcode 4.5 and iOS 6?

If so, can you share how you did it? I'd like to understand conceptually what is happening as well.

Community
  • 1
  • 1
Aaron
  • 7,055
  • 2
  • 38
  • 53

2 Answers2

2

I know two alternative methods, both worked fine for me.

  1. Get the Makefile and patch from libspatialite-ios, Type make
  2. Use Cocoapods and pod called 'spatialite' or even more general SpatialDBKit

Both will give you currently a bit older 4.1.1 version, but that's fine for most uses.

JaakL
  • 4,107
  • 5
  • 24
  • 37
  • Interesting. I'll have to check it out. We ended up going with non GIS solution onboard the device and moved on a while ago. – Aaron Aug 26 '14 at 17:33
  • In fact I have tested simple point data with plain SQLite and Spatialite on Android, and for many cases like basic data storage the plain (non GIS) SQLite turned out to be just as fast, if not even faster. I'd expect same on iOs. – JaakL Sep 02 '14 at 14:45
1

Via CocoaPods:

install dependencies for pod install

brew install automake autoconf libtool

then add your Podfile template inside your XCode project:

pod init

Add spatialite pod dependency:

vi Podfile

and add this line inside your main target

pod 'spatialite', '4.1.1'

Add workspace if existing project inside Podfile

workspace 'YourWorkspaceName'

run

pod install

sit back and relax. When finished open the workspace with XCode

Sanandrea
  • 2,112
  • 1
  • 27
  • 45
  • Looks like a workable solution if you don't mind the cocoa pods dependency. I'll take a look when I get a chance to verify. – Aaron Feb 18 '15 at 17:24
  • 1
    Not working for me under XCode 7.3 - I have CP integration anyways, I managed to add new pod but after installation source code won't compile with 19 errors related to `sqlite3_int64` and `sqlite3` – Krodak Apr 26 '16 at 09:24
  • Looks like this answer has fractured. I tried updating the podspec to `4.3.0` here https://gist.github.com/lukepighetti/44b8a32b9bceece47015c9a54595f6ea but I keep getting a `'geos_c.h' file not found with include; use "quotes" instead` error. Looks like spatialite uses an older import syntax that isn't supported or 'shimmable' by xcode https://www.programmersought.com/article/60352123739/. tried `5.0.0` but it needs someone with more experience to setup a new podspec – Luke Pighetti Dec 31 '20 at 16:32