Compile C lib for iPhone

爷,独闯天下 提交于 2019-11-29 07:51:36

It sounds like you're building a universal armv6/armv7 binary for the iPhone (this is the default, so that makes sense). That means that you need to build a universal library to link against. Build both libraries, and then use lipo to combine the two.

For example, build the armv6 one and place it at armv6/libfoo.a, and the armv7 one at armv7/libfoo.a. Then run

lipo -arch armv6 armv6/libfoo.a -arch armv7 armv7/libfoo.a -output libfoo.a -create

to create the universal library libfoo.a.

Shaggy Frog

Given the warning message from ld, my guess is you're not compiling the library for the correct platform. And given you're using configure, my guess is you're trying to compile the library outside of Xcode and then bring it into Xcode later to link it in.

Perhaps you could try running configure to set up your headers, but do the actual compilation step inside Xcode?

There are lots of related questions here on SO about compiling third-party (external) C or C++ libraries for use in iPhone projects.

Creating static library for iPhone

TiMidity: need help compiling this library for the iPhone

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