I'm quite new to Xcode and Iphone development and ran into the following problem:
I opened a new project and added *.h and a *.a files (which I recived from a certain device vendor).
I get the following warning:
ld: warning: ignoring file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a, missing required architecture i386 in file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a (2 slices)
If I ignore the warning, and try to instanciate the class that is given to me in the header file, I get these errors:
ld: warning: ignoring file [Path/FileName.a], missing required architecture i386 in file [Path/FileName.a] (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_HRMonitor", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
I've checked the Framework Search Pathes (as mantioned in many other posts) and it clear.
More info:
I'm Using Xcode 4.6.1
The files are currently located at project's root folder.
I'm using a Single View Application tamplate.
Appreciate any help
This warning means that you're trying to use library made for Device (ARM) with your Simulator (i386).
You can use this terminal command to create a universal library:
lipo -create lib_arm.a lib_i386.a -output lib_universal.a
More info about lipo command here.
Change your target's "Build Settings > Build Active Architectures Only" to "No"
This is doing the same thing as Dmitry Zhukov's answer but doing it thru Xcode instead of going around its back.
If you are working with a 3rd party code, keep in mind that some SDKs may not work on the simulator. The same build error I have encountered vanished, when I ran the project on the device.
Related
I Have added Addmob sdk in my project and even added all framework needed. But m getting below error for StoreKit framework even i have added it in my project but still getting error..
ld: warning: directory not found for option '- L/Users/company/Downloads/projectname/GoogleAdMobAdsSdkiOS-6.4.2/Add- ons/GoogleAnalyticsiOS_2.0beta4/Library'
ld: warning: directory not found for option '-L/Users/company/Downloads/projectname/GoogleAdMobAdsSdkiOS-6.4.2'
ld: warning: ignoring file /Users/company/Downloads/StoreKit.framework/StoreKit, missing required architecture i386 in file /Users/company/Downloads/StoreKit.framework/StoreKit (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SKStoreProductViewController", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADOpener.o)
"_SKStoreProductParameterITunesItemIdentifier", referenced from:
-[GADOpener openInAppStore:fallbackURLString:] in libGoogleAdMobAds.a(GADOpener.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I search a lot but in every post its sid to add Storkit.. but i have already added it but still getting error. even i have cleaned the project a lot of time.
Just ensure that you have added the following libraries,
1.AudioToolbox
2.MessageUI
3.SystemConfiguration
4.CoreGraphics
Also the frameworks,
1.MessageUI.framework
2.StoreKit.framework
3.SystemConfiguration.framework
According to your error message there is a problem with StoreKit.framework...Please verify that...
Refer: build error when add Admob in iOS app
Add AdSupport.framework, also make it as optional
It says that your StoreKit binary is not build for i386. This should not happen with the default one. Did you download if separately from somewhere? You can find the default here:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/StoreKit.framework
Use that.
I'm creating a static library with some class files, and the library is creating well but if I install to library to another new Xcode project it showing error and the error is as follows ,
ld: warning: ignoring file /Users/rajesh/Desktop/Quntiles/01-03-2013/ConnectionExample-1/libAVTEmployee.a, file was built for archive which is not the architecture being linked (armv7s): /Users/rajesh/Desktop/Quntiles/01-03-2013/ConnectionExample-1/libAVTEmployee.a
Undefined symbols for architecture armv7s:
"_OBJC_CLASS_$_AVTEmployee", referenced from:
objc-class-ref in XMLParser-E51A1142A3EEED70.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Can any one please help me, how can I fix this issue so that I can use the my static library in my new project ,
I'm using Xcode 4.6 version.
Thanks in advance.
Probably your static library was created or compiled using an older version of XCode that didn't support armv7s architecture. Open the static library project and make sure that Architectures contains armv7 and armv7s architectures and Build Active Architectures Only is set to No under Build Settings.
I was trying to make a sample code run download by the link
http://www.magtek.com/support/software/downloads/sw/99510108.zip
This is a card reader api ,here is a sample code.When I run this code I got the error:
ld: warning: ignoring file /Users/gaurav.garg/Downloads/99510108/SampleCode/Lib/libMTSCRA.a, missing required architecture i386 in file
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_MTSCRA", referenced from:
objc-class-ref in MagTekDemoAppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The class MTSCRA is only a header file,And the solution that I have cheked That we have to add the .m file in compiled source path of build build phase of target...but unfortunately I don't have the MTSCRA.m file.MTscra.h have the AudioToolBox and externalAccesory framework.
Actually the problem is that MagTek provides you two separate .a files.
If you look at the one in the Release-iphoneos and run the following command:
> lipo -info libMTSCRA.a
Architectures in the fat file: libMTSCRA.a are: armv7 (cputype (12) cpusubtype (11))
Likewise if you look at the one in Release-iphonesimulator...
> lipo -info libMTSCRA.a
input file libMTSCRA.a is not a fat file
Non-fat file: libMTSCRA.a is architecture: i386
So the real answer is to create a new libMTSCRA.a for DEBUG that is n-way FAT by combining the two using lib tool and then creating separate DEBUG and RELEASE library search paths.
To start you would go to the directory above where MagTek keeps the two different versions of libMTSCRA.a When you are there, you will run the following command:
libtool -static -o libMTSCRA_FAT.a Release-iphoneos/libMTSCRA.a Release-iphonesimulator/libMTSCRA.a
When you examine the output file, you should see:
>lipo -info libMTSCRA_FAT.a
Architectures in the fat file: libMTSCRA.a are: armv7 (cputype (12) cpusubtype (11)) i386
Then in your project, create two folders (aka groups) "debug" & "release" and then restructure the DEBUG and RELEASE Library Search Paths to use these respective directories.
Lastly, rename libMTSCRA_FAT.a to libMTSCRA.a and place it in the debug search path keeping the iOS (armv7 (cputype (12) cpusubtype (11))) in release. The reason we do this is because while it might be ok to use this newly created .a file in debug mode it is considered bad taste to push this into production because we have no way to confirm that the merged lib is 100% what we intended ( the merge of the archs ).
Et voilà !
Undefined symbols for architecture i386:
It means that the library you are linking against does not have symbols for i386. Which means you can not use the simulator. You will need to run the sample on the device or get the version of the library created for the simulator.
You need to make sure you are including all of the Frameworks that are required by that library.
I have the following failed code when i run my application on iPhone 5.1 simulator. My app runs smoothly before i add in the Facebook Connect into my application.
Undefined symbols for architecture i386:
"_FBCreateNonRetainingArray", referenced from:
-[FBSession initWithKey:secret:getSessionProxy:] in FBSession.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
May I know what can i do to get rid of this?
Thanks
2 things that usually get rid of that error.
1) go to: target > build phases > link binary with library -- make sure you've added the correct framework
2) go to: target > build phases > compile sources -- add any implementation files that are in your program but do not appear in that list.
Those two steps usually fix that kind of error.
i get this error when i am trying to use my compiled static library in my iphone aplication. I have no frigging idea what's wrong.
ld: warning: ignoring file /Users/rw/Library/Developer/Xcode/DerivedData/MSTicketingSaaS-gkznscznevvifjesoapzgwycbces/Build/Products/Debug-iphoneos/libMylib.a, file was built for archive which is not the architecture being linked (armv6)
Undefined symbols for architecture armv6:
"_OBJC_CLASS_$_AppData", referenced from:
It worked before upgrading to Xcode 4.0.2
I added the i386 architecture and now it compiles for the simulator but NOT for the device.
Check with lipo which is the architecture your lib has been built for:
lipo -info <path_to_lib>
If it does not contain "arm6" then you should go back to the library project and build it for the proper architecture. If this does not help, please, give more detail about the structure of your project(s).