armv7 not being added while creating static library - ios

I'm creating a static library in iOS. When I check for architecture of library using the command
lipo -info {LibraryName}.a
I'm getting only arm64 as the architecture for library. I also need armv7 to be included for this library so that I can integrate it with another app and archive it.
In the Architectures I've selected Standard architectures
(armv7, arm64) - $(ARCHS_STANDARD)
And for Valid architectures I've arm64 armv7 armv7s
please help me.

Also check your iOS deployment target. If it's 12.1 for example it won't include armv7.

Make sure that Build Active Architecture Only is set to No. (This is under Build Settings in the Architectures group).
I had a similar problem and this seems to fix it.
(Now I just need to understand why armv7s is no longer included and if it matters...)

In addition to making sure Build Active Architectures Only is set to No, check the format of Valid Architectures. I have accidentally typed armv7, arm64 – notice the comma – on multiple occasions now, and it does not give you an error or warning. It simply builds arm64 by default. Correct it by removing the comma, like this: armv7 arm64.

Related

Xcode 10 - invalid bitcode signature while archiving

After switching to Xcode 10, I've been getting invalid bitcode signature when I try to archive.
After hours of struggle, I stumbled upon this and was able to archive after removing armv7 from valid architectures.
I really cant release the app with armv7 removed since there are lot of users who uses iPhone 4s & will be in dark if I do this.
I use both static and dynamic frameworks in my application and all of them support armv7 architecture by default.
Did anyone else face this issue? Is there a workaround to include armv7 as valid architecture?
Set Build Active Architecture Only is Yes

What does warning "Mapping architecture arm64 to x86_64" mean?

After migrating my framework to Xcode 10 beta (10L176w) I started to get warnings like:
Mapping architecture arm64 to x86_64. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform.
... and:
Mapping architecture armv7 to i386. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform.
Despite these warnings the build and the unit tests all pass Ok. I'm using Swift 4.2.
Still, what are these warnings about?
Go to Build Settings and do as shown below
I was able to silence these warnings by changing my Valid Architectures setting to $(ARCHS_STANDARD) which matches my Architectures setting as well.
Oddly, this displayed as armv7 arm64 (in comparison to the default setting of armv7 armv7s arm64), but setting it to that value manually still caused the warnings. Not sure what the significance of that is, but I haven't noticed any problems in my testing yet.
You likely have the VALID_ARCHS ("Valid Architectures") build setting overridden, either for the target or for its project. This is a build setting that should get its value automatically based on which run destination you're building for. When you figure out where this override is coming from (the build setting will display in bold when overridden), select it and hit the delete key to restore it to the default value.
For the TARGET which report warnings, Change the "Valid Architecture" setting to:
$(VALID_ARCHS)
x86_64
Similar to other answers, I was able to remove the warning by changing $(VALID_ARCHS) (Valid Architectures) to $(ARCHS_STANDARD). From there, I cleared all Derived Data and restarted Xcode 10.0. This made the warning go away completely. Deleting everything from Valid Architectures just made a different warning appear ("No valid architectures found").
I am also facing the same problem. For resolution, I have just changed the build system from Standard to Legacy and that resolved the issue.
The solution is simpler: in Valid Architectures just replace arm64 with x86_64.
Had similar issue and the following three warnings in my project:
My Valid Archtectures originally were
Replacing:
armv7 with i386,
armv7s with i386,
and, arm64 with x86_64
(as mentioned in the Warnings) was my solution.
The result in the Valid Architecture setting was:
After the replacements my three warnings above disappeared.
More profound info about the Architectures can be found here:
https://docs.elementscompiler.com/Platforms/Cocoa/CpuArchitectures/
I think the formulation of this warning in Xcode is a bit confusion.
If you are facing problem in Flutter:
Delete the
Podfile,
Podfile.lock,
Pods folder,
Runner.xcworkspace, Flutter.framework.
Run flutter clean.
Run flutter build ios.
I was seeing this warning when I tried to compile code for both iOS and Mac OS.
I was able to get around it by first doing what Hassan Taleb suggested in his answer: clear out the architectures so that only valid iPhone architectures are in there. And then finally, to maintain being able to build for Mac OS, wave your mouse over the Valid Architectures so that a plus button appears. Click that and then you can add separate settings for different platforms as needed, including different CPU architectures. For macOS SDK, I can set my Valid Architectures to just x86_64 if I want.
I found the easiest way to resolve this was to open the project in my text editor, then find and delete all VALID_ARCHS lines.
I have seen the same warning as I building my framework.
After a while noticed these valid architecture values vary depending on the type of devices regardless the values in build settings.
Real devices-> arm64
Simulator devices ->x86-64
Go to Target > Build Settings > Architectures >Excluded Architectures
(x84_64) .. It is used to Run a Real device And Use (arm64) to Run a Simulator For (Any SDK).
If selected Excluded Architectures > Debug and Release
To solve this problem virtually and radically, you have to choose ( Any IOS Simulator SDK) instead of (Any SDK) and set value (arm64) In this case, you can make a build and a run together without having to change the values each time.
if your [build Settings] is armv7 armv7s arm64, please delete armv7s. the warning will be cancelled.

Make library support 32bit architecture and 64bit architecture ios

I created a objective-c library in Xcode 6.1. It supports 64 bit architecture. I added it to an old project with 32 bit support. It is crashing and giving me an error
ld: file is universal (3 slices) but does not contain a(n) armv7s slice
How can i update the library to support the old project?
Remove the support for any architecture armv7s from the project (target) -> Build Settings -> Valid Architectures:
Alternatively, you can set the flag for your debug configuration's
Change Build Active Architecure Only to Yes.
Hope this will work.
you can just add armv7s to the library's Target->Build Settings->Architectures along with ($_ARCHS_STANDARD)

App missing 64-bit support [duplicate]

I sent an app yesterday for review, with no problem. I then realized that I had a very little fix to do (changing the max zoom level of a map from 19 to 18, nothing else), so I removed the binary from iTunes Connect, and tried to resubmit.
Now I'm having this warning :
I don't understand why, as my architectures are :
architectures : armv7
valid architectures : armv6, armv7, armv7s, arm64
The app runs fine in the simulator. If I try to use the standard architectures (armv7, arm64) as recommended in the warning, then the app won't build and I get :
Undefined symbols for architecture x86_64
ld: symbol(s) not found for architecture x86_64
I'm using the lib route-me, and I set the same architecture settings.
Use "Standard architectures" like this:
Architecture: "Standard architectures" arm7, arm64
Valid Architectures: "arm64" , armv7...
Build Active Architecture Only - NO (specially... if your connected device is not arm64 compatible)
like this:
Additionally, unplugging iphones and ipads from the mac has been known to help, especially if they are 32-bit versions.
After confirming the correct architectures, make sure your device is NOT connected to your computer when ARCHIVING the final build to submit to the App Store.
The reason this warning appears is because the DEVICE you have connected is probably not arm64 compatible.
As Tony wrote, it's important to have in both lines those settings.
Since my (and obviously your) project was created yet before arm64 was added to standard, it is not reflected in "Valid Architectures" even if it is shown as Standard.
What I did:
I went to Project (vs. Target) configuration
Typed "arm64" in the Valid Architectures (it's automatically reflected in targets and schemas
After clean/build I even get some warnings about improper conversion of float to CGFloat, etc., so the settings obviously applied.
The validation warning disappeared too!
Unplug your physical device from Mac. In XCode on device list choose iOS Device and create Archive again. It worked for me.
Today I solve that problem with the following steps:
Building Settings:
Architectures: Standard architectures(arm7,arm64) - $(ARCH_STANDARD)
Valid Architectures: armv7 armv7s arm64
Clean and build your app with the iPhone connected
Disconnect your iPhone and check the top bar if is in "iOS Device"
Archive
Validate and Submit
Just Create a New Project using latest xCode version and find the Build settings. The new project created using latest version have 64 support by default.
Okay this was insane.
I tried every single answer. But it worked only when I placed arm64 before armv7 and armv7s in Valid Architectures.
P.S. : xcode version : 7.2
I solved the problem by changing,
Architectures: arm7,arm64
Valid architecture: arm7,arm64
Build active architecture only : Yes
I submitted success by config as the image:
(Archived with real device)
Got rid of every warning. Went through everything over and over. Found the one word answer here above.
"Build Active Architecture Only - NO (specially... if your connected device is not arm64 compatible)"
My iPad is not 64 bit. Put in NO for Build Active Architecture and my submission worked!
Change your iOS development target to at least 5.1.1 or alternatively delete the standard architectures setting and re-apply it. You might have seen a warning that arm64 is not compatible with your build target. On the overview page, check both the build and target "deployment target" settings. In my case, the target was 6.0, but the project was 5.0.
Also, check "Valid Architectures" in both your target and your project. I had the right settings on the project but not on the target. After this, it worked for me.
Switch between project/target on the overview page in the top left corner of the box.
Please check Build Active Architecture option. Set it to NO.
It works for me.

Getting Error : ld: file is universal (2 slices) but does not contain a(n) armv7 slice [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.

Resources