为iOS构建静态库-特别是spacespaceite [英] Build a static library for iOS - specifically spatialite

查看:139
本文介绍了为iOS构建静态库-特别是spacespaceite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,请原谅并指出我是否要使用其他协议来引用另一个线程/帖子.

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

以前有一个线程如何为iOS编译spacespaceite ,最佳答案部分描述了将spacealite作为iOS的静态库进行构建.答案包括以下文字:

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:

一旦拖放了.a(在模拟器和实际硬件上都需要工作),就可以通过调用spatialite_init(1)来初始化spacespaceite."

"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. 文件->新建->新建目标-> iOS->框架&库->可可触摸静态库

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

命名库-libSpatialite_TedS

Name the library - libSpatialite_TedS

将头文件拖放到libSpatialite_TedS->复制头(这里的问题...在"spatialite2.3.1.zip"下载的头"目录中有一个spacespaceite.h文件.然后在子目录中"spatialite"还有另一个spaceiteite.h,它不是同一文件,显然是需要的.我们是否只是将头文件从"headers"目录中拖出,然后将"spatialite"目录作为目录拖到"Copy Headers"区域中?我们的Xcode静态库'myNewLibrary'?)

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'?)

拖动'.a文件'libSPATIALITE2.3.1_arm.a& libSPATIALITE2.3.1_x86.a

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

我们是否应该在"Compile Sources"字段中包含一些带有这些标头的".m"文件?

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

现在,在不参考我项目中的libSpatialite_TedS的情况下,当我使用"Command-B"进行构建时,项目构建成功.但是,当我在

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

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

我看到了build的产品,但其中不包含libSpatialite_TedS.

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

这是因为编译器是智能"的,并且识别出项目中没有引用header/.a文件,所以它不会打扰它们吗?

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?

而且,这是否是实现原始海报目标的正确方法如何为iOS编译spacealite?

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

非常感谢, 泰德·S

Many thanks, Ted S

推荐答案

我也遇到了原始发布者的链接器错误,但是通过在目标中包含libsqlite3.dylib,libstc ++.dylib和libiconv.dylib来解决了该错误.

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.

希望这会有所帮助!

这篇关于为iOS构建静态库-特别是spacespaceite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆