Conditional compiling for armv6 and armv7

silvaric picture silvaric · Mar 7, 2012 · Viewed 7.6k times · Source

I have a published application which supports both amrv6 and armv7. Now I have an upgrade which is only compliant with armv7 (I added an external library which depends on armv7). When I try to submit the app to the store it I get the error detailed in

I understand the previous error and I need to change my app so it supports both architectures. My problem is that my code depends on a library which is only compliant with armv7. If I change the properties of my project to support both armv6 and armv7 I get a compilation error (details below). I need to be able to compile the code with support for both architectures: armv7 compiles using the library I depend on armv6 has a different code which does not depend on the library.

How can I achieve this?

Error details:

• the compile crash is in one Lib file (.a) and the error says : ld: warning: directory not found for option '-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/gcc/arm-apple-darwin10/4.0.1' ld: in /Users/.../(lib file).a, file is universal but does not contain a(n) armv6 slice for architecture armv6 Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1

Thanks in advance

Answer

silvaric picture silvaric · Mar 15, 2012

Well i realized my last answer in not the correct one... Apple said that is impossible but this is not really true... thanks to Jim, i search little more and i found one way to do it..

  1. Remove lib from "Build Phases"
  2. Add both architectures in "Other Linker Flags" (Build Settings) , for that you need click in + and add armv6 and armv7
  3. Add the lib in armv7.. with -l
  4. Don't forget #if defined _ARM_ARCH_7 in your code

This is like Jim answered but more detailed.