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

"file was built for archive which is not the architecture being linked (i386):" #140

Open ort11 opened 10 years ago

ort11 commented 10 years ago

"file was built for archive which is not the architecture being linked (i386):

Xcode 4.6.3, any help would be appreciated and do have samples

jalakoo commented 10 years ago

Try editing your scheme to target an actual device in the "Destination" drop down + update your "Build Configuration" to the "Release" option. Wasn't necessary prior to Xcode 5, but I've found this helps now.

jafework-onescreen commented 10 years ago

I recently encountered this issue using Xcode 4.6.3 after updating to it from Xcode 4.5.x.

In case anyone else runs into this problem. In your framework project in xcode click on your project (blue icon). Then make sure to SELECT YOUR FRAMEWORK target from the list of targets. Next go to "Build Settings" Tab and set the Property "Build Active Architecture Only" = NO. Finally under the "Valid Architectures" property I added "armv7, armv7s, i386".

After this I built my framework, and seeded it into the project that was giving me the ""file was built for archive which is not the architecture being linked (i386):" error and it ran fine!

Note: Make sure you set the properties above on the framework target itself. It didn't work at first cause I was setting the properties on another target I had in that project.

thalmicMark commented 10 years ago

I'm running into the same issue. @jafework-onescreen I've checked both my frameworks and they have the settings you specified. There are a few things that might make my project different:

1) I've included the frameworks by embedding their projects in my app as sub projects. That way, I can modify them within my app's project.

2) I have two Real Frameworks in my app. Things were working fine when I had just one. As soon as the second framework was added to the project, archive started failing.

Anyone else having this issue?

jafework-onescreen commented 10 years ago

@thalmicMark go to the generated .framework files and CD into it via terminal. Go to MyFramework.framework/Versions/A/ In that folder you should see the generated binary file, it should be the same name as your framework. Run the command in terminal " lipo -info MyFrameworkBinaryName ". This should list the architectures that the binary was built for. If you don't see i386 or the architecture that is giving you the error listed you need to go back and configure your xcode settings because this means that the framework isn't being built with the specified architecture.

If you have 2 frameworks, do this for each framework and see if you see them listing the correct architectures.

thalmicMark commented 10 years ago

Checked both frameworks, and this is the output:

Architectures in the fat file: MyoKit-Internal are: armv7 armv7s arm64 i386 Architectures in the fat file: ThalmicKit are: armv7 armv7s arm64 i386

The build error I get when trying to archive my app is looking for armv7 architecture. What's quite odd is that it builds and runs fine on a device. Only when I go to archive do I get the error. This leads me to believe it has something to do with the release configuration. Which build setting on my frameworks should I be looking at?

thalmicMark commented 10 years ago

Actually, scratch that. I looked at the path supplied in the warning and the MyoKit-Internal framework that's being used for archive is in fact not fat (only i386). But, if I remove ThalmicKit and leave MyoKit-Internal, it archives fine. How is it that one framework affects another?

jafework-onescreen commented 10 years ago

@thalmicMark when using archive, if you go to ( Project -> Scheme -> Edit Scheme ) look at what it is set to for your Archive settings. By default it should use your Release Build Settings. Double check the framework which is giving you trouble has its correct architectures set for its Release Build Settings as well as Debug.

What your describing in your update seems a bit strange o_O. So are you able to run your app build on devices fine AND simulator, its just when you go to archive that things go sideways?

thalmicMark commented 10 years ago

The architectures for both my frameworks are set to Standard Architectures and valid architectures are set to armv7 armv7s i386 arm64 for both Debug and Release configurations.

Correct. I can build and run my app on simulator and real devices just fine, its just when I archive the error is thrown. Which leads me to believe its an error with my Release configuration... Any other settings I should check?

jafework-onescreen commented 10 years ago

@thalmicMark yeah it is starting to look like it may be your release configuration. Try switching your archive to use your debug configuration instead of release and see what happens.

EmperiorEric commented 10 years ago

I've opened a Stack Overflow question to track this issue because the suggestions here haven't fixed my issue. I'd love some guidance from any experts on this script. http://stackoverflow.com/questions/23480200/ios-universal-framework-not-build-i386