Architecture linking error after Xcode 5.1 upgrade - objective-c

I am having these errors:
libGPUImage.a, file was built for archive which is not the architecture being linked (armv7s),
libPods.a, file was built for archive which is not the architecture being linked (armv7s)
and more...
These are my project settings:
Architectures:armv7,armv7s,arm64
Build Active Architectures Only:NO
Valid Architectures;armv6 armv7 armv7s arm64 i386
I didn't change anything except for downloading latest Xcode 5.1 with the iOS 7.1 SDK. This project worked fine with Xcode 5.0 and iOS 7.0 SDK. What could be the problem?

Got to Build Settings -> Architectures
You probably have Standard Architectures set, right?
As of Xcode 5.1 Standard Architectures includes arm64, which you are not ready to support.
Select Other..
doubleclick $(ARCHS_STANDARD) and change it to $(ARCHS_STANDARD_32_BIT)
Note: This is a temporary fix. You are probably using some static library that didn't come with a 64-bit slice. See if there is one available and then switch Architecture back to Standard Architectures.

I had a bunch of similar issues upgrading to Xcode 5.1. I resolved them by first updating CocoaPods:
gem update cocoapods
Then updating the pods in my project:
pod update
In my case, there was some corrupted stuff in my ~/.cocoapods directory which was causing pod to throw errors. Deleting everything in ~/.cocoapods then running pod update again got things working again.

We had this same thing happen to us, the problem is "Standard Architectures" under "Architectures" used to be armv7, armv7s, in Xcode 5.1 Apple changed "Standard Architectures" to be armv7, armv7s, arm64 so now you have to manually enter your own architectures instead of picking "Standard".

Open in some text editor (for instance SublimeText) your ./Pods/Pods.xcodeproj/project.pbxproj file. Usually with the following command in the terminal (keep in mine you have to be in your project directory) st ./Pods/Pods.xcodeproj/project.pbxproj and find and replace ONLY_ACTIVE_ARCH = YES with ONLY_ACTIVE_ARCH = NO. Also you can do the same with your {YOUR_PROJECT}.xcodeproj/project.pbxproj. And last Clean and Run from the Xcode!

In my case, it was fixed by changing _view to self.view.

Related

Bitcode signature failure in Xcode

I updated Xcode to the last version, and now when I'm trying to compile the project I'm getting an error "Invalid bitcode signature", hovewer, the bitcode for my project is disabled. How can I fix it? What should I change to sign my bitcode correctly?
My Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'MyProjectName' do
pod 'Realm'
pod 'CorePlot'
pod 'GoogleMaps'
end
I checked already, everything is fine with it.
I'm not sure if you have the same situation with me. I only have this issue when I tried to test with iPhone device. It turns out that the debug configuration with Build Active Architecture Only is set to NO. After I set to YES, I can test with my iPhone.
I experienced this error, but it happened only when building for an iOS 10.3 iPad (despite working on an iOS 10.3 iPhone and an iOS 11.0 iPad, and all the iOS 10.3 and 11.0 simulators). Through painful process of elimination (and creating a new project from scratch), I found that my Cocoapods weren't at fault, nor was my code signing settings, nor my AppExtension, nor my tests, nor my 'build for active architecture only' setting, nor any build setting related to the term 'bitcode'.
In my setup, I had a C++ Xcode project nested within my main Swift/iOS Xcode project. Because it was never intended specifically for use in iOS, the "iOS Deployment target" had never been set (it was left on 'default'). Upon setting it explicitly to 10.3, it worked without complaint.
Nested C++ app's project settings (set iOS deployment target to the lowest iOS version you support):
Nested C++ app's target settings (for reference):
If you using pod then please check the version of all libraries, some library may be not supporting in new version , you have to update pod files for that library.
In my case, I was trying to build for a device with an iOS version lower than the deployment target.
This kind of problem came up when I linked a new static library project to my workspace. In order to solve it I tried to set both the Build Active Architecture Only and the Bitcode settings of the library to NO but no luck. Then I got across the thing that the library's Deployment Target was set to 11.0 as Xcode set the latest value to all new projects. After fixing the setting to 5.0 the problem was solved.
On my case problem occured because of I was using a 3rd party static library with different files for each architecture
I fixed the problem by removing binaries of invalid architectures.
Instead I added a multi-arch FAT binary for the 3rd party static library
Hope helps
For my case, the solution was removing a c++ library.
I found that my issue was with using 'Modules'.
Just turned off modules (had to update some header files), but that resolved my issue.
Enable Modules In Settings
In my case, the widget included in the project was causing the bitcode error.
I changed my pod file from this:
target "App" do
pod 'A'
pod 'B'
end
target "App Widget" do
pod 'A'
end
to this:
target "App" do
pod 'A'
pod 'B'
target "App Widget" do
pod 'A'
end
end
To fix this issue, most answers recommend a workaround whereby you clean your Xcode workspace/project, close Xcode, delete your Derived Data folder (this is kept in the root directory of your project by default), then finally re-open your project.
However, the above steps may not work for you. This is a hint that your project structure is in error.
When the bitcode intermediary representation of your project was released with iOS 9.0, it was done so on the provision that your entire project, including dependencies, either totally agree to use bitcode or not. From my experience, it is vital to work through all of your Pods and included Libraries/Frameworks and ensure they all use the same setting; either Yes or No. By default, this selection is Yes.
If a single dependency does not match the intended bitcode setting, this error can be thrown.
When sanity checking your dependencies and overarching project, it is important to note that there is a Use Bitcode setting for both the Project and the Target settings, so be sure to check both perspectives of the Build Settings.
I was adding static library . I created fat binary of the same library including all architectures and included in my project. This resolved my issue
In my case, I am Using Cordova Project. While building it with Xcode had the same issue and Resolved by Removing and Adding the IOS platform.
cordova platform remove ios
cordova platform add ios
If you are using cocoa pods then do "pod update"
Targets -> Build Settings ->Build Active Architecture Only
Debug -> YES
Release -> NO to YES
I face the same problem only on archiving the app.
Who can tell me the reason? You can teach all developers. It's awesome.
This solution work for me. First, try to remove all pod using terminal command pod deintegrate and then reinstall pod using terminal command pod install.
This can also occur when building for the simulator if including a framework built for ARM only (and I assume vice-versa as well).

Xcode5 compiling 64-bit app error

I had an app works fine on Xcode5.0.2 with architecture armv7 & armv7s.But when I switch to "standard architecture" which plus arm64,it turns out all the third-party library managed by cocoapods went wrong,as shown below:
I'm wondering if anyone has encountered this kind of issue already,what is the solution to this,hopefully you could give me some instructions,thanks in advance.
The underlying issue here is that the CocoaPods you use have not been modified yet to support the ARM64 architecture thus they cannot be linked when you build them. Likely you cannot use those pods until they are updated to support ARM.
You can fix the linker error by going to project -> target of your project -> build settings and change architectures to default architectures (e.g. ARMv7, ARM7s), and valid architectures to ARMv7, ARMv7s.
Also try setting 'build active architectures only' to YES in release and then execute pod install again.

XCode won't compile due to armv7s slice error [duplicate]

I upgraded Xcode version and when using external static libraries, I get this message:
ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /file/location for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is there any way to bypass this and add support to the library if the developer of the library hasn't updated their library yet?
If you want to remove the support for any architecture, for example, ARMv7-s in your case, use menu Project -> Build Settings -> remove the architecture from "valid architectures".
You can use this as a temporary solution until the library has been updated. You have to remove the architecture from your main project, not from the library.
Alternatively, you can set the flag for your debug configuration's "Build Active Architecture Only" to Yes. Leave the release configuration's "Build Active Architecture Only" to No, just so you'll get a reminder before releasing that you ought to upgrade any third-party libraries you're using.
I've simply toggled "Build Active Architecture Only" to "Yes" in the target's build settings, and it's OK now!
Try to remove armv7s from project's "Valid architecture" to release from this issue for iOS 5.1 phone
I just posted a fix here that would also apply in this case - basically, you do a hex find-and-replace in your external library to make it think that it's ARMv7s code. You should be able to use lipo to break it into 3 static libraries, duplicate / modify the ARMv7 one, then use lipo again to assemble a new library for all 4 architectures.
Flurry Support for iPhone 5 (ARMv7s)
As I mentioned in yesterday’s post, Flurry started working on a version of the iOS SDK to support the ARMv7s processor in the new iPhone 5 immediately after the announcement on Wednesday.
I am happy to tell you that the work is done and the SDK is now available on the site.
use menu Project -> Build Settings ->
then remove armv7s from the"valid architectures".
If standard has been chosen then delete that and then add armv7.
In case this happens to someone. I built my own library to use with a third party code. While I was building it to deliver, I accidentally left my iPhone 4S plugged in, and so Xcode built my library only for the plugged architecture instead of following the project settings. Remove any plugged in devices and rebuilt the library, link it, and you should be all right.
Hope it helps.
In my case, I was linking to a third-party library that was a bit old (developed for iOS 6, on XCode 5 / iOS 7). Therefore, I had to update the third-party library, do a Clean and Build, and it now builds successfully.

Zbar SDK is not working in iOS6

I was using ZBar for scanning in iOS5 and it was working well.
Now after updating to iOS6, its not working. It shows a following error.
ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/mac4/Desktop/my desktop/My app/MyApp name 20:09:12 /MyApp name/ZBarSDK/libzbar.a for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What is wrong in my side?
In Xcode, go to the settings of your target,
change 'Valid Architectures'
from
armv7,armv7s
to
armv7
This change means your app will not take advantage of possible optimizations the new iPhone5 processor has, but you don't have to wait for 3rd party libraries to upgrade or mess with a hex editor.
i recently faced the same issue. The problem seems to be that the ZBar SDK is not ready for the armv7s architecture.
I solved the problem this way:
Go to the ZBar homepage and navigate to the mercurial repository (direct link)
Download the zbar repository as zip.
Unzip the file and navigate to the subfolder named "iphone".
Open the XCode project.
Delete the "Examples" folder (the folder caused a build error on my machine).
Hit "CMD + B" and build the source.
Find your new libzbar.a file. (User/Library/Developer/Xcode/DerivedData/zbar...)
Replace the old libzbar.a file in your project with the new one.
Hit "CMD + R" and you are good to go.
The hg sources download/re-compilation tutorial is great, but you don't need to do all that.
Just browse to http://sourceforge.net/projects/zbar/files/iPhoneSDK/beta/ and download ZBarSDK-1.3.1.dmg, and everything will work out of the box for the latest architectures (in my case armv7, armv7s).
Update:
Some of you reported issues with ZBarSDK on XCode 5, iOS 7 or architectures arm64... well I went back to this project today and experienced similar issues and found that there is a ZBarSDK library that is compiled to work with iOS 7 at: http://www.nerdvision.net/app-development/ios/zbar-sdk. I Just replaced the old files with the new ones and my project compiled. Note that the Architectures in my project's Build Settings are set to amrv7, arm64 ($ARCHS_STANDARD), Base SDK is set to iOS 8.0 and I have the Build Active Architectures Only flag set to Yes.
There is a question here at SO about this: zbar SDK dont work for armv7s(iPad 4 iOS 7)
Thanks to #cdescours for the tip!
I have same problem but I just added armv6 and armv7 then it works for iOS6. Just insert armv6.
your binary library does not have code for armv7s. So you should recompile it for the current archtitectures.
Recompile the source, I download the source code for zbar and compile into new project. It's simple.
Clone the Mercurial repository and build with Xcode. It's very easy. Here's a link to the repository:
http://zbar.hg.sourceforge.net/hgweb/zbar/iphone/summary
Came here with the same problem after downloading the tutorial code RDC provided in his blog. Very useful post, but the most helpful answer here was posted by RacZo on 3/29. I just downloaded the original ZBarSDK-1.3.1.dmg image, removed the ZBarSDK from my project and replaced with the original. Done.
I am learning IOS development. After few days digging,
Here is the tutorial for installing ZBar SDK.
1, The accepted answer is correct, but with some limitations. (tried, works!)
2, The alternative solution is here. (tried, works!)
3, The best is to build the all different architectures separated then bind them using lipo: Great Solution (tried, brilliant!)
Some readings for understanding those architectures:
http://wanderingcoder.net/2010/07/19/ought-arm/
http://wanderingcoder.net/2011/09/25/compiling-armv7/

iPhone/iPod Touch: application executable is missing a required architecture

I have an issue with xCode 4.2. I am getting this error when building:
2011-06-18 13:35:49.839 Validation[4110:607] *** Warning: Defaulting to the standard codesign tool
warning: iPhone/iPod Touch: application executable is missing a required architecture. At least one of the following architecture(s) must be present: armv6 (-19033)
Unable to validate your application. - (null)
I had a look at my project settings, and it has :
architectures: Standard (arm7) - ${ARCHS_STANDARD_32_BIT)
Build active architecture only : NO
Not sure what
For some reason the default architecture settings with xCode 4.2 is only for armv7.
Go to Target -> Build Settings -> Architectures -> Release
on value dropdown pick "Other...",
remove $(ARCHS_STANDARD_32_BIT), and add 2 rows
first with "armv6" and second "armv7"
Done
For Xcode 4.5, set the deployment target to at least iOS 4.3 and that will resolve it. Earlier versions of iOS are almost extinct.
Not the optimal solution, but I found that if I changed the Deployment Target to 4.3 (it was 4.0 before) it gets rid of the error.
For XCode 4.5
Had to set "Deployment Target" to 4.3, "Architectures" to armv6 armv7 armv7s as described above, AND "Build Active Architectures Only" to No.
This on a project that worked fine for several month before upgrading to XCode 4.5.
Note: Set the iOS Deployment Target to 4.3 or later in your project if you wish to drop ARM v6 support for your application. An ARM v7 processor is required to run versions of iOS later than 4.2.1.
My previous answer was deleted by the moderator because I didn't comply with their rules. So, answering again.
I faced the same issue and wasted 2 days on it. In my case an upgrade to XCode caused it. I downgraded XCode to the previous version and it got fixed for me. If this is your issue then uninstall new version, reboot and then install old version again. That should do it for you.
I have also added some screenshots and info to my blog about this issue here: http://iostipsntricks.wordpress.com/2011/06/24/solved-application-executable-is-missing-a-required-architecture-at-least-one-of-the-following-architectures-must-be-present-armv6/
Had absolutely the same problem with Xcode Version 4.2. and got also an other error:
There is no codesign:wrapper executable. Please reinstall the Xcode developer tools.
After downgrading the Xcode to an older version it fixed the problem.
Check this post, it is the right one with just adjust a setting in Xcode 4.2, just set "Build Active Architecture only" to NO:
iTunes Connect application is missing required architecture
My Answer may be solve your problem:
I had this problem even after following the accepted answer and found the following to work:
In your Info.plist, add an entry for Required Device Capabilities. This should be an array and will have two entries.
Item 0 : armv6
Item 1 : armv7
It will look like this:
Required device capabilities entry
Had the same problem, tried everything mentioned here - but still got the error on validate -
I tried armv6 and armv7 steps, tried to add that to info.plist and also tried regenerating the distribution certificate just in case.
Turns out the info.plist file must have ${EXECUTABLE_NAME} and ${PRODUCT_NAME} in the respective fields
ALSO the Product name in the Build Settings for that scheme+Target SHOULD match the scheme name
I made sure all the names matched exactly
EXECUTABLE_NAME, PRODUCT_NAME, Product Name in Target, binary name in build settings and info plist, and the deployable binary name - made sure they matched the Target name itself
Once all the names matched and the architecture matched, it worked. Until then it kept giving me error on validation.