kstenerud / iOS-Universal-Framework

An XCode project template to build universal frameworks (arm7, arm7s, and simulator) for iOS / iPhone.
2.95k stars 473 forks source link

Add armv7s support to target iPhone5 #101

Closed dodikk closed 11 years ago

dodikk commented 11 years ago

I am unable to use a framework produced by the template to target iPhone5. Please add support for this feature.

See the error below for details: ld: file is universal (2 slices) but does not contain a(n) armv7s slice: /Path/To/Your/FrameworkBinary.framework/FrameworkBinary for architecture armv7s

dodikk commented 11 years ago

So far, my binary seems to contain armv7s slice but it is not recognized by the linker http://www.galloway.me.uk/2012/09/hacking-up-an-armv7s-library/

file MyFramework MyFramework: Mach-O universal binary with 3 architectures MyFramework (for architecture armv7): current ar archive random library

MyFramework (for architecture cputype (12) cpusubtype (11)): current ar archive random library

MyFramework (for architecture i386): current ar archive random library

Linker error :

ld: file is universal (2 slices) but does not contain a(n) armv7s slice: <path/to/framework>

shagedorn commented 11 years ago

You can build iPhone 5 apps without armv7s support. Just remove armv7s from your project/target and it will still run fine on iPhone 5. I know sooner or later you should add armv7s support, but it's not too urgent...

dodikk commented 11 years ago

Thanks, @shagedorn .

You can build iPhone 5 apps without armv7s support. Just remove armv7s from your project/target and it will still run fine on iPhone 5.

Does the application run in "compatibility mode" or it fills the entire screen as expected?

Anyway, it does not make sense for me since my product is a framework itself, rather than an application. "File" command says I have armv7s symbols in the framework. However, I'm unable to link it with my application. And I would not like to force my customers disable avmv7s architecture due to this issue.

However, I still have no iPhone5 to test against. There is a tiny possibility that plugging in the device may fix my build errors.

shagedorn commented 11 years ago

It will fill the entire screen if you add a 4 inch launch image to your project (which you have to do with or without armv7s support). You may encounter a slight performance penalty, but I don't believe you will ever be able to measure it unless you do really sophisticated computing stuff. Haven't tried it out though.

But I see your point... see if you have these build settings in both your app target and your framework target:

Architectures: $(ARCHS_STANDARD_32_BIT) (resolves to armv7 and armv7s if you use Xcode 4.5) Build Active Architectures Only: NO Valid Architecture: same as Architectures, armv7 and armv7s

i386 may also be in the framework settings for compatibility with the simulator. armv6 shouldn't be in there as Xcode 4.5 does not support it anymore.

yamaguh1 commented 11 years ago

Please help.

if somebody point out what we have to change, i will give it try, but i have no idea. Removing armv7s is not my option because i have a library that does floating point calculations. I have to include armv7s in the framework for iPhone5.

iosdeveloper commented 11 years ago

When will this be fixed?

kstenerud commented 11 years ago

Still looking into this, but I haven't had enough free time recently.

yamaguh1 commented 11 years ago

I just made it work. Actually you don’t have to do anything special to make it work. In the build settings of your project, set ‘No’ to ‘Build Active Architecture only’. Then, you can just build your project. After the build completed, go to the ‘Version/A’ folder on your Terminal window. Type ‘file ’. You will see three architectures, armv7, i386 and ‘cputype (12) cpusubtype (11)’. The last architecture is actually armv7s. This is it. You can add your framework to other project and build an app for iPhone5. Good luck and enjoy.

dodikk commented 11 years ago

Dear @yamaguh1 , I had those mentioned slices when I posted the issue.

MyFramework (for architecture cputype (12) cpusubtype (11)): current ar archive random library

I had some issues while linking the framework into the application. In my opinion, the case is that armv7s slice was recognized incorrectly.

ld: file is universal (2 slices) but does not contain a(n) armv7s slice:

I still have not solved it since I have no iPhone5 to test against yet.

dodikk commented 11 years ago

Finally managed to build properly.

"cputype (12) cpusubtype (11)" works like a charm. It is armv7s indeed.

I had an obsolete path in FRAMEWORK_SEARCH_PATHS. That's why linker was attempting to use an incorrect binary.

Thanks everyone for your time. P.S. Sorry for a stupid mistake. And be careful.

hlung commented 10 years ago

I typed 'file ' in that A folder but it just shows the correct usage of the command. Is that command correct?

SOLUTION: type file [name-of-the-no-extension-file], the file next to the header folder.