linking static libraries in iOS5 - ios5

I am new to iOS 5.
Currently working with xcode 4.2,Base sdk iOS 5.0,Apple LLVM compiler 3.0,architechture armv7.
Whenever I try to link a static library the following warning comes up.
ld: warning: ignoring file /Users/shilpasurendran/Desktop/InputVal_aslib/InputVal_aslib/iCodeBlogsMathLibrary/libICodeMathUtils.a, file was built for archive which is not the architecture being linked (i386)
I even tried changing deployment targets and compiler,but of no use.
Please help.
Thanks in advance!!

You are trying to build for armv7 architecture which means you want to build for a real device not the simulator.
The library you are linking to is in i386 architecture meaning it is compiled for the simulator.
When using a third-party library there often is a structure like this:
Library
build
Release-iphoneos
Release-iphonesimulator
Release-universal
If there is a universal build you should use that one. Try using the one under Release-iphoneos otherwise.
Hope that helps

Related

TestFlight: Application executable contains unsupported architecture: armv7s

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?

Does not contain architecture information for i386

When I compile my project I get this error:
warning: (i386) /Users/Desktop/aug_9/iOSSample/SD_2.0.a(sdk743.o) object file '/Users/Desktop/aug_9/iOSSample/SD_2.0.a(sdk743.o)' doesn't contain architecture information for i386.
Do I need to add i386 in "Valid Architectures" in the build settings?
Can anyone advise me on how to fix this warning?
It would appear that you are trying to run in the simulator, and a library you are using does not support the simulator.
You might want to either check if the library has a build for the simulator, or just test your app on a real device.

Can't build iOS/iPhone app as anything other than i386

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.

Framework issues in Xcode

I'm running the latest version of Xcode and am try to create an app for IPhone with IAd integrated into it and I have tried to integrate it many ways, but I keep receiving this error every time, ld: warning: ignoring file /Users/mini/Desktop/TheDateGetter/iAd.framework/iAd, file was built for unsupported file format which is not the architecture being linked (i386) I'm guessing this is a framework issue, because all of the code and everything else it correct. All help will be appreciated, thanks!
Check under Build Phases for your target which frameworks are you linking against. You will need to remove then the iAd framework from /Users/mini/Desktop/TheDateGetter and link the correct one from the iOS SDK.

How to add boost thread library to an iPhone project?

I am trying to port an existing project to iPhone which needs Boost.Thread library, the project compiles without error but there are link errors:
"boost::thread::start_thread()", referenced from:
boost::thread::thread<(anonymous namespace)::ReadThread::Function>((anonymous namespace)::ReadThread::Function, boost::disable_if<boost::is_convertible<(anonymous namespace)::ReadThread::Function&, boost::detail::thread_move_t<(anonymous namespace)::ReadThread::Function> >, boost::thread::dummy*>::type)in ChessEngine.o
How can I add the required thread libs to the Xcode project?
p.s. the boost lib is in: /usr/local/lib/libboost_thread-mt.a
EDIT (library found, but got architecture error):
Following Linking to Boost.Signals using Xcode, after adding /usr/local/lib in Library Search Path and -lboost_thread-mt in Other Linker Flags, the library is found. However, there are new errors and warnings:
ld: warning: in /usr/local/lib/libboost_thread-mt.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
How can I have the lib working for iOS (4.0 or later)? Thanks!
I did some more searching and found this downloadable script that will build a multi-architecture iphone ready version of boost. Also check out this blog post about using it.
It sounds like you are trying to link in a library for an architecture (armv6,7) when you probably have the current target set as a device (i386 - the simulator). If thats correct I'd say you have downloaded the library built for the device. To run in the simulator you need the version of the library built for your computer (I386).
The easiest way to handle any external library is for the developer of it to produce a armv6/armv7/i386 static framework. Then it's a piece of cake to use. If it's as much trouble as this sounds like, I'd be looking elsewhere for the functionality :-)