我正在编写一个运行 xml-rpc 服务器的 iOS 应用程序。我正在使用此处提供的用于 xml-rpc 的 C 库:http://xmlrpc-c.sourceforge.net/ .该库使用 ./configure
根据主机架构生成 makefile,并使用 make, make install
构建/安装库。
我需要在我的 iOS 应用程序中使用这个库。我知道 XCode 使用完全不同的构建系统,而且我是 iOS 开发的新手,所以我不太确定如何将库与我的应用程序结合起来。我需要通过 ./configure 传递哪些选项来为 iOS 架构编译库(我知道有三个目标,armv7、armv7s 和 i386)?
提前致谢。
最佳答案
这里是模拟器和设备平台的配置脚本选项。
模拟器(i386):
$ ./configure --host=i386-apple-darwin --prefix <path_to_binaries> CFLAGS="-arch i386 -isysroot /Applications/XCode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/ -miphoneos-version-min=4.0 --disable-cplusplus
$ make
$ make install
iOS 设备(arm):这有点棘手,还有一个 Unresolved issue有了这个,但这里是一般步骤:
$ ./configure --host=arm-apple-darwin --prefix <path_to_binaries> CFLAGS="-arch armv7s -isysroot /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -miphoneos-version-min=4.0" --disable-curl-client --disable-cplusplus LDFLAGS='-arch armv7s -miphoneos-version-min=4.0 -isysroot /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk’
$ make
特定于此库的说明:我们需要针对 x86 构建 gennmtab,因为它定义了符号表并且将在编译程序的机器上运行 - 运行以下命令(从基本 xmlrpc-xx.xxx 目录开始)
$ cd lib/expat/gennmtab/
$ rm gennmtab gennmtab.o
$ gcc -c gennmtab.c -o gennmtab.o -DNDEBUG -Wall -W -Wno-uninitialized -Wundef -Wimplicit -Winline -Wno-unknown-pragmas -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -fno-common -g -O3 -D_THREAD -I/Users/sradhakrishnan/dev/xmlrpc-c-1.25.28 -Isrcdir/lib/util/include -I/Users/sradhakrishnan/dev/xmlrpc-c-1.25.28 -Isrcdir/lib/util/include
现在已经针对 x86 构建了 gennmtab,通过运行以下命令继续之前的 make:
$ cd ../../../ (you are back in the base xmlrpc-xx.xxx directory)
$ make
$ make install
关于ios - ./configure 参数为 iOS 构建 C 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24413974/