Creating static library for iPhone

大憨熊 提交于 2019-11-28 03:52:06

For autoconf based library, I would vote for Christopher Stawarz's build script:

http://pseudogreen.org/blog/build_autoconfed_libs_for_iphone.html

With this script, you can automate the whole process with single command, and easily come up with library binaries for different platforms, such as iPhoneOS 2.0/2.1/2.2/2.2.1 and iPhoneSimulator 2.0/2.1/2.2/2.2.1.

However, due to the change of Xcode 3.1, the $(SDKROOT) build setting had became some short names like "macosx10.5", "iphoneos2.2.1" or "iphonesimulator2.2.1". So, the way he mentioned in the article about setting search path in Xcode for library and header will not work (in Xcode 3.1). You will need to hard code the path by yourself.

Try compiling with arm-apple-darwin-gcc as your GCC application. You can then use lipo to merge the 2 static libraries (arm and 386) together so that the development on the sim versus the device is seamless.

Just compile it normally using the x86 sdk (iphone simulator) then again using the platform for arm/ios (arm-xxx-xxx) then combine both static libs in a .a using "LIPO" (command-line tool). Works a treat and it's simpler than reinventing the wheel (at least for those smallish libs).... i did that with liblo and libdmtx and i'm not having any problems and it took me like 10 minutes to do both... :-)

After several attempts to use the arm GCC compiler with the tips provided here, I gave up. In my case, it is much simpler to simply port the library to XCode than trying to compile a static library for the iPhone.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!