简体   繁体   中英

Cannot compile a static library for arch armv7

I have a static library (very simple, no includes) which builds fine with "-arch i386", I can use the demo method in this library and everything is fine. As usual I have an .a file to link in my project.

Unfortunately I want to use this library in an iOS project, so when I use the iPhone Simulator everything is fine with the library built with "-arch i386" (because this is the processor the simulator uses). If I now want to build the library with "-arch armv7" (or "-arch armv6") for my ARM-based iPhone device I get in Eclipse and in Xcode the same error message: (in Xcode:) llvm-gcc-4.2 failed with exit code 255 . Same exit code in Eclipse (255). With "i386" everything works.

Must I install anything in addition to my Xcode 4.2.1 on OSX Lion to make compile the lib for my ARM-Device?

The issue lies in the fact that Xcode 4 builds static libraries for each build rather than one unified universal build. So my guess is that you are just adding the build for debug-simulator and not for debug-device. Your best bet, add a script to your static library to build them all into one.

This post here on SO saved my life. Hopefully it will help you too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM