it's me again with my iOS trouble. I've finally managed to build the master branch of this XML-RPC framework https://github.com/eczarny/xmlrpc which produced an XMLRPC.framework for me. I managed to include that framework in my iOS project, all good, but when I build it...
ld: warning: ignoring file /Users/kovshenin/Library/Developer/Xcode/DerivedData/XMLRPC-emidbddzjlofthfgowywcfscewgd/Build/Products/Development/XMLRPC.framework/XMLRPC,
file was built for unsupported file format which is not the architecture being linked (i386)
So I went back to the XMLRPC project and tried to select different Base SDKs and Architectures for the target, but with no luck, seems like it's only building it for 64-bit Intel. Even tried the iOS SDK which gives me a "The selected run destination is not valid for this action." error.
Sorry again for my "newbish" talk, but the official dev forums can't seem to help me out. Thanks!
P.S. I'm using Xcode 4.
Architecture is related to the processor on which you are running your code. If you are building for the simulator, then you are building for your Mac, which is Intel, i386. If you are building for a physical iOS device, then you are building for arm6 or arm7, depending on how new the devices are. Fourth generation iPhone 4 and iPad were the first arm7 devices.
As far as setting the build settings, I'd recommend taking a look at the build settings. In Xcode. Here's a screenshot:
Click on your project, then on your build. Under the architectures section, you can configure your architectures as necessary. You should note though, that the original developer would have to have built it for the simulator as well as the device, or you won't be able to run it on the simulator.
It looks as though the library may not fat meaning it'll only build for the device, and not for the simulator. Connect your device and select it in the drop down, then build again and see if the error disappears.
Related
Our iOS app relies on a commercial third-party static-lib currently only available for armv6+armv7. For this reason, I can't build our app for armv7s. Only armv6+armv7+simulator.
Our builds are deployed for and run on the iPhone-5 without a problem - it runs armv7 code.
However, I cannot find a way to debug directly on the iPhone 5. When I connect the iPhone-5 and try to build for debugging, I get linker errors like this:
"No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=armv7s, VALID_ARCHS=armv7)."
Initially,I thought that maybe my "Build only active architecture" setting for debug configuration caused Xcode not to try to build for armv7 when the iPhone-5 (armv7s) was connected.
But when I set this to "NO" (have Xcode build for ALL SUPPORTED ARCHITECTURES all the time) I get a whole other bunch of build errors (excerpt below --- we have many targets and each emits similar errors).
=== BUILD NATIVE TARGET ASPCommon OF PROJECT ASPCommon WITH CONFIGURATION Debug ===
Check dependencies
No architectures to compile for (ARCHS=i386, VALID_ARCHS=armv7).
** BUILD FAILED **
The following build commands failed:
Check dependencies
(1 failure)
Command /bin/sh failed with exit code 65
This target has NO dependencies, it only builds against iOS SDK frameworks, and builds fine when any device other than iPad 4/iPhone 5 is connected.
Finally my question: Is it at all possible to directly debug armv7 code on armv7s device? If it is possible, when Am I doing wrong in my build settings to break this?
Thanks!
Short answer: No. I believe what you are attempting to do just isn't possible! The third party static lib needs to be rebuilt for armv7s. Keep hounding them until they update their library.
Oh, I forgot I posted this question…
Eventually I was able to debug on all iOS devices, as the source of the problem was neither in the armv7-only library, or my project/target settings.
The problem was in an iOS Xcode Template I was using to create iOS "Framework" targets. (an old version of iOS Universal framework from Karl Stenerud).
Our code-base is big, and many of its main blocks serve MacOS and iOS versions of the application, plus we want to encapsulate these main blocks as "SDK"s, including library, header, resources and documentation. So --- we've been using Framework targets for this. Since there's no internal "Framework" target template for iOS - we used a 3rd-party template.
This template users build-scripts, that had a bug, that omitted platforms from the build in certain situation, hence causing our build errors, and inability to debug.
Last word --- an update of the template removed the issue.
I'm trying to build an ad-hoc build with test flight.
I have the OS Device selected and am trying to create an archive.
However I get the following warning.
(null): iPhone/iPod Touch: application executable contains unsupported
architecture(s): armv7s (-19031)
I have the following settings for my test flight target.
I can build fine for release.
It looks like you're using an old version of the TestFlight library.
The iPhone 5 uses a new processor (A6), with a modified instruction set (AMRv7s).
Since you are building your app with that architecture too, all linked libraries also needs to support it.
TestFlight provides a new version (1.1) of its library, with support for that specific architecture.
So simply download the new version of the library, link against that, and you'll be fine.
Your "Release" target is compiling and linking fine, because no symbol from the TestFlight library is actually used. But if you need TestFlight support for the iPhone 5, just update to the latest version of the library.
This warning is perfectly normal when you use an armv7 device to archive your application.
Think about it, you make an archive that includes the armv7s architecture (which is what we want) and the warning tells you that your armv7 device does not support that architecture (which totally makes sense).
To prove that even further, just hook up an iPhone 5 and try archiving and you will see that the warning will go away.
As far as I can tell Xcode 4.5 will not currently allow you to create Archive builds that include armv7s.
My project uses two 3rd party libraries (Dropbox and Flurry) and I reverified I had the latest iOS 6 builds included. I verified that all my other frameworks (and libsqlite3.0.dylib) were all located in the iOS 6.0 area. None of this helped.
I then created a brand new empty project from scratch and attempted an Archive build and received the exact same error. So after wasting 6 hours trying to fix this, I am tentatively concluding it is not possible to get rid of the warning.
Based on comments else where, apparently, it is not necessary to build for armv7s to run on an iPhone 5.
Any information to the contrary of anything I have posted here would be appreciated.
All you need to do is remove armv7s from the valid architectures.
Same question has been asked several ties I think.
I was displayed the same warning message when I archived in preparation for Ad-Hoc testing.
(null): iPhone/iPod Touch: application executable contains unsupported
architecture(s): armv7s (-19031)
I have removed armv7s as recommended above and the warning went away. What repercussion are there in doing this? What is armv7s supporting?
With semingly no changes to any settings or code from yesterday, what may have caused this warning to pop up?
I am completely new to the iOS/iPhone/XCode world, so if you guess is between something rather complex and something so simple that everyone should know, I'd go with the simple answer. :-)
Okay, so I have inherited an iPhone project that we had outsourced to another company. My only objective right now is to be able to build the dang thing. I set up XCode 4.2 and installed the proper SDKs. I loaded up the project and everything seems good to this point. However, when I build, I get errors from what I believe to be the linking stage of the build. I'm not entirely sure because the statuses change quickly when building. The error I get is the following:
From what I have been able to find online, it seems that one of the libraries I am using was not compiled for the i386 platform. To start, this doesn't make sense to me because the libraries that I am using (where these errors are coming from) are currently included as sub-projects and produce .a files which I thought were arch-independent (am I wrong here??). Also, I can't find anywhere in the project where I've instructed XCode to build to an i386 architecture. This is what I've done so far:
Made sure that the file in which these errors arose was included into the "Compile Sources" section of the Build Phase tab (the .m file)
Set my architectures to armv6 and armv7 and set the Build Active Architecture Only to no. (See images below)
Main Project Config
Sub-Project Config
Event when I build using the release configuration, I still get this error and I'm not sure why. Everything that I am looking at in my build config seems to indicate that I should be building everything in an arm architecture.
You are getting errors because you messed with the architecture settings. You should not fix those towards ARM code but allow i386 as well.
Right now, one of more of your (sub)-projects build ARM code only, resulting into a linker error once you try to build a simulator version. That is happening because your Architecture settings are not as they should be.
Note your setting for Any iOS SDK, that one is incorrect as it builds only ARM code. Remove those settings entirely by using the backspace key on your keyboard after selecting that specific setting (single-click).
And this is how it should be:
$(ARCHS_STANDARD_32_BIT) resolves to ARMV7 when building device specific code and i386 when building simulator specific code. Including ARMV6 code as per my screenshot is only needed if you plan to serve the results to older iOS devices (iPhone 3G and below).
Once those settings are active in all (sub)-projects, everything should work smoothly.
For creating a universal library out of a project, useful if you plan to distribute a static library to other developers, use LIPO.
Example:
lipo input_library_1.a input_library_2.a -create -ouput output_library.a
Lets say input_library_1 was i386 specific (simulator) and input_library_2 was ARM specific (device), this will join them into a universal version usable for both simulator and device.
It seems like you have been trying to link to static library built for devices(armv6 or armv7). When your building for the simulator the architecture will be i386. So you getting all these nasty linking errors. Solution is to include the library compiled for simulator as well in your project.
I've created a iPhone static library project with two targets like this
Project
--> Library (Device) target
--> Library (simulator) target
The device target has the SDK set to the device so it produces an armv6/7 library and the simulator target is set to the simulator SDK so it produces an i386 library.
The issue I'm having is that the SDK settings on the targets keep getting overridden by the XCode active target setting. i.e. if I build the device target, but the XCode window is showing the active SDK as being the simlulator, XCode will build a simulator library instead of a device library, ignoring the settings of the target. Although it will put it into the *-iphoneos/ directory in the build directories!
I originally had the same issue with another static library project, and after a lot of playing around got everything to work correctly. i.e. The targets ignore the XCode active SDK because they have their own specifications of what to build.
The problem is that I don't know what made it work in that project and I have not been able to reproduce the issue in it either.
Does anyone have any ideas as to what is going on?
ciao
Derek
OK, I think I've figured it out.
Set the project SDK to the general setting, ie. Simulator SDK so that you get the APIs and libraries correct during coding.
Set each target to the SKD it needs to build. ie. device SDK or simulator SDK.
Leave XCodes SDK set to current SDK, effectively telling it to not override the targets.
I have searched for hours however I still have no clue what is wrong with my configuration.
My project uses a self-written libray (myLib). This library is compiled to work only for simulator and it works perfectly there.
What do have to change so it compiles for my iPhone Device as well?
This is my current warning:
ld: warning: in /.../myLib.a, file is not of required architecture
This is my configuration (of myLib.a)
I found a lot of articles explaining the reason for this error however I could not find a solution:
The simulator runs on an x86
architecture, while the device uses an
ARM architecture.
What do I have to change to get my library working on my iPhone?
Thanks
Edit:
What I did so far:
Cleaned both projects
Set library to 'Device' (3.1)
Built the library
Dragged the .a file of my library into my application
Result:
This works in simulator but setting the active sdk to device still raises a file is not of required architecture error.
I also tried mahboudz ( thanks for your support) link.
It explains howto built the project using a shell script.
However XCode keeps complaining that the library file is of the wrong architecture and the build fails.
This has to be a really stupid beginners mistake.
You need to add both .a files,the one built for the device (build/$config-iphoneos)and the one built for the sim (build/$config-iphonesimulator) to the new project. Make sure you name them differently before dropping them in. This is how admob and similar offering ship their static libs.
You need to compile your library for Intel so the Simulator can use it (which I gather you have done already), and then compile it for ARM, so it can run on the iPhone. Then you have to merge the two libraries. There are different ways to accomplish that, or make it more automatic.
Here are some links to help you:
http://blog.stormyprods.com/2008/11/using-static-libraries-with-iphone-sdk.html
http://www.clintharris.net/2009/iphone-app-shared-libraries/
I've met the same problem too. But seems you don't need to drag two .a files into the app project to solve this problem. This is what I did:
Drag the static library project into app project's framework group
"Get Info" for the target in app project
Set the direct dependency of static library
Make clean all unnecessary builds(for example the simulator build) in the static library project
Build in the app project