适用于 iPhone 的 MySQL C API 库 [英] MySQL C API libraries for iPhone

查看:30
本文介绍了适用于 iPhone 的 MySQL C API 库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道在哪里可以获得为 arm iPhone 架构编译的 MySQL 库?

Does anybody know where to get a MySQL libraries compiled for the arm iPhone architecture?

或者如何为arm交叉编译MySQL?

Or how to cross-compile MySQL for arm?

感谢

推荐答案

我是这样做的:

1) 从MySQL下载Connector/C的源代码版本

1) Download the source code version of Connector/C from MySQL

2) 下载cmake(如果你安装了macports,输入sudo port install cmake")

2) Download cmake (if you have macports installed, type "sudo port install cmake")

3) 从 http://sites.google.com/site/michaelsafyan/coding/resources/how-to-guides/cross-compile-for-the-iphone/how-to-cross-compile-for-the-iphone-using-cmake

4) 在模拟器的工具链文件中,从包含 CMAKE_OSX_ARCHITECTURES 的行中删除一个架构

4) In the toolchain file for the simulator, remove one architecture from the line containing CMAKE_OSX_ARCHITECTURES

5) 如果要为模拟器构建,请复制/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/usr/include/netinet/中缺少的头文件(ip.h 和 in_system.h) 来自/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk/usr/include/netinet

5) If you want to build for the simulator, copy the missing headers in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/usr/include/netinet/ (ip.h and in_system.h) from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk/usr/include/netinet

6) 在某处创建一个名为compiled_library"的目录,例如在您的桌面上

6) Create a directory called "compiled_library" somewhere, eg on your Desktop

7) 像这样调用 cmake:cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/iphone-toolchain-file -DCMAKE_INSTALL_PREFIX=/path/to/compiled_library -DHAVE_FDATASYNC:INTERNAL=0

7) Call cmake like this: cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/iphone-toolchain-file -DCMAKE_INSTALL_PREFIX=/path/to/compiled_library -DHAVE_FDATASYNC:INTERNAL=0

8) 请注意,如果您想第二次运行 cmake,您可能必须先删除缓存文件

8) Note that if you want to run cmake a 2nd time, you might have to delete the cache file first

9) 输入 make install

9) type make install

10) 现在您在/path/to/compiled_library 中拥有了已编译的库.通过添加现有文件..."将头文件目录和 libmysql.a 复制到您的 xcode 项目中.该库应自动添加到链接器阶段.

10) Now you have the compiled library in /path/to/compiled_library. Copy the header file directory and libmysql.a to your xcode project via "Add existing files...". The library should be automtically added to the linker stage.

11) 哇哦.使用 mysql C API.

11) WOOHOO. Use the mysql C API.

12) 如果工作量太大,我目前正在为 iPhone 编写一个 MySQL 包装框架.我将在未来十年的某个时间发布它并在此处放置链接.

12) If this is too much work, I'm currently writing a MySQL wrapper framework for the iPhone. I will publish it sometime in the next ten years and put a link here.

其他人为 MySQL 客户端库创建了一个 Objective C Wrapper:http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/

Someone else created an Objective C Wrapper for the MySQL client library: http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/

这篇关于适用于 iPhone 的 MySQL C API 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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