Conditional compiling for armv6 and armv7
Asked Answered
S

6

9

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

Sham answered 7/3, 2012 at 12:1 Comment(1)
You might want to tag your question with iOS and xcode. It is more of a question on how to produce universal binaries with this toolchain than a question of rolling your own architecture dependent dispatcher in ARM assembly.Succulent
S
4

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.

Sham answered 15/3, 2012 at 10:18 Comment(0)
S
2

I received this answer from Apple:

You cannot conditionally build your app for either armv6 or armv7. Your static library must be built for both armv6 and armv7 since your application supports both of these architectures...You can drop support for armv6 by setting your iOS deployment target to 4.3 or higher.

Basically i need to ask the developer of the library to build for both of there architectures ( =/ ) or i set my minimum target to 4.3 and only armv7

Sham answered 9/3, 2012 at 11:26 Comment(0)
B
1

In your build settings, if you hover over a setting, a + appears that you can click on to scope a setting to a particular architecture. You'll have to remove the library from the normal list of libraries and add it in by passing the -L argument manually only for armv7. You'll probably also have to add in a preprocessor definition so you can put #ifdefs around the code that calls the library.

Edit: Thinking about it, you might be able to do it in a simpler way by marking the library as optional in the build phases section.

Bosk answered 7/3, 2012 at 15:32 Comment(2)
Thanks! but i don't understand where/what is "remove the library from the normal list of libraries" , I changed "Library Search Paths" and "Other Linker Flags", with the + I create two lines with armv6 and armv7. But now i have new error and the details says "..not found l(lib).a" ..something is calling the Lib.. i remove all evidences in code and also "optional" in build phases section... so probably i need to remove it in "normal list" like you said.Sham
I gave you two alternatives. You shouldn't try to do both at once.Bosk
T
0

I'm sorry, I pasted the wrong thing from clipboard.

I meant to say:

Simply remove the bad architecture from Valid Architectures in Target Aguilar Settings and you're good to go :)

Tadtada answered 13/9, 2012 at 2:29 Comment(0)
L
0

I had the same problema so I switched: "Build Activate Architecture Only" to yes (in the Target -> Build Settings"

This works...for now.

I imagine my app will not work on an iPhone 5, but I will have to wait till the supplier of the static library I am using builds it for armv7/armv7s

Leonardoleoncavallo answered 17/9, 2012 at 12:42 Comment(0)
R
0

I had this problem for the Google Analytics iOS SDK. Merely replacing the library with the latest version is what resolved this problem for me.

Rowdyish answered 26/12, 2012 at 17:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.