对于像我这样需要花费数小时查找这些标准配置标志的文档的人(用于运行 ./configure make make install)
./configure --build is used for specifing the architecture you want to complie for
./configure --host is used to specify the ark of the machine doing the compileing (running xcode)
./configure --target seems to be an alias
现在来解决问题。
1) 获取最新版本的 FreeTDS http://www.freetds.org/
2) 下一步是制作您自己的 bash shell 文件以正确运行 FreeTDS ./configure。您将需要两个,因为模拟器是 i386/i686 架构,而苹果设备(iPhone、iPod 等)是 ARM 架构。此外,您在 iPhone 开发目录中的编译器文件/版本可能会有所不同,只需找到合乎逻辑且具有相似命名约定的内容即可。mac 主机体系结构由命令 uname -p 提供。
这是我在模拟器 (i386) build_for_simulator_i386.sh 上使用的构建示例:
#!/bin/sh
#unset some shell variables
unset CC
unset CFLAGS
unset CPP
export buildPath=`pwd`
# make i386 (Simulator) target
export CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/i686-apple-darwin11-llvm-gcc-4.2
export CFLAGS="-isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk"
# if you want Windows Authentication (NTLM) support you must use at least tds version 7
# the default is 5
./configure --build=i386 --host=i386 --target=i386 --with-tdsver=7.1
ARM 编译配置示例 (build_for_device_armv7.sh):
#!/bin/sh
# unset some shell variables
unset CC
unset CFLAGS
unset CPP
export buildPath=`pwd`
# make arm target
export CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2
export CFLAGS="-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk"
export CPP=/usr/bin/cpp
./configure --build=arm-apple-darwin10 --host=x86_64-apple-darwin11.3.0 --target=armv7 --with-tdsver=7.1
3) 下一个 cd 到解压 freetds 下载的根 freetds 目录,我的是 freetds_0.91
4) 运行您的脚本之一。您一次只能编译一个架构
sh build_for_(desiered build)
this runs ./configure for you with the correct options
(tds version 7 required for NTLM authentication)
5)一旦配置过程完成,你必须破解配置文件。打开 freetds_0.91/include/config.h 然后在第 172行将 #define HAVE_ICONV 1更改为#define HAVE_ICONV 0
6) 如果您之前运行过 ./configure、make、make install 然后运行这些命令。特别是如果您的切换架构,因为您将在不这样做的情况下运行 make 时出错
sudo make clean
sudo make uninstall
7) 使用 make 执行编译
make all
sudo make install
make 过程会故意通过一些错误,但是如果您在 shell 提示符的六七行内看到错误,一旦返回,您就有问题,需要在继续之前修复它们。让我们说很多事情在这一点上可能会出错。
8) 安装二进制编译文件后,freetds 制作的所有小 .o 文件的顶点是/usr/local/lib/libsybdb.a 相信我,你不想只为库拉一个 .o 文件你要。将 /usr/local/lib/libsybdb.a 复制到项目中的相应文件夹。我所做的是有两个单独的文件夹,每个架构一个,命名为“compiled_freetds-0.91_simulator_i386”和“compiled_freetds-0.91_device_armv7”。
9)因为你想让你的生活更轻松,并让 xcode 找出要使用哪个编译文件,请按照此步骤子集执行动态链接。
a) Select you project settings on the left had side of xcode
(the blue think with the name of your project on it)
b) Select the Target (usual the same name as your app)
c) Navigate to **build settings**, scroll down to **linking > other linker flags**
d) On the left side of Other Linker Flags a mouse over will reveal an expander,
expanding will reveal Debug and Release rows.
e) Add the appriate architectures by selecting the plus on the right side of
either Debug or Release. When the new row appears select the architecture,
double click the first editable field from the right to open an entry box
that you can then drag the appropriate complied file into it to be dynamically
linked. You must do this for both files and when done correctly the file
under ARMv7 will be used when building for the device and the one for Any iOS
Simulator SDK will be used when running on the simulator.
**Note:** You may also need to add the -all_load flag to resolve linking issues.
10) 在设备上运行代码时,似乎可以避免涉及 libsybdb.5.dylib 的动态链接错误问题的最后一步是进行卸载。此外,在设备上运行时,您还会收到很多警告,以 36 为增量,关于 CPU_SUBTYPE_ARM_ALL 已被弃用,这很正常,但很烦人。
sudo make uninstall
我希望这有帮助。