Question

First, please forgive and point out if I am to use some other protocol for referencing another thread/post.

There was a previous thread how to compile spatialite for iOS where the top answer partly described building spatialite as a static library for iOS. The answer included the text:

"Once you've drag n drop the .a (both are required to work in the simulator AND on the real hardware), you can initialize spatialite by just invoking spatialite_init(1)."

I am guessing this is translated to some version of the following?

Xcode 4

  1. File->New->New Target->iOS->Framework & Library->Cocoa Touch Static Library

  2. Name the library - libSpatialite_TedS

  3. Drag the header files to libSpatialite_TedS -> Copy Headers (question here ... there is a spatialite.h file in the 'headers' directory of the 'spatialite2.3.1.zip' download. Then in the subdirectory 'spatialite' there is another spatialite.h that is not an identical file and is obviously needed. Do we just drag the header files from 'headers' directory, then drag the directory 'spatialite' as a directory into 'Copy Headers' area of our Xcode static library 'myNewLibrary'?)

  4. Drag the '.a files' libSPATIALITE2.3.1_arm.a & libSPATIALITE2.3.1_x86.a

  5. Shouldn't we have some '.m' files to go with these headers in the 'Compile Sources' field?

Now, without referencing the libSpatialite_TedS in my project, when I 'Command-B' to build, the project build succeeds. However, when I look for the compiled product in

/Users/Admin/Library/Developer/Xcode/DerivedData/MyProject-gutnkbwqqonzgxbcmfzzzkadqhid/Build/Products/Release-iphonesimulator

I see build's products, but they do not include libSpatialite_TedS.

Is this because the compiler is 'smart' and recognizes that none of the header/.a files are referenced in the project so it does not bother compiling them?

And, is this the correct way to go about achieving the objective of the original poster how to compile spatialite for iOS?

Many thanks, Ted S

Was it helpful?

Solution

I was running into linker errors with the original poster too, but solved it by including libsqlite3.dylib, libstc++.dylib, and libiconv.dylib in the target.

Hope this helps!

OTHER TIPS

Ted, I believe that the .a (static library) files and headers are meant to be used in a project right away, rather than in another static library as you've described. They are the result of a project's output. I think you can find the project that built them, here:

http://lionel.gueganton.free.fr/spatialite/

And a little more on static library files:

What is a .a (as libcrypto.a) file?

EDITED

Here's another link that you might find helpful. It s a summary of the Static Library build process in iOS: http://www.icodeblog.com/2011/04/07/creating-static-libraries-for-ios/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top