Hello I'm using a library in my project, and basically it's working on real devices, but not on simulator.
I would like to know how to add compatibility with simulator also.
I've search around, and I found some answers that should have solved my problem, but they're not doing it. (Maybe I'm doing things wrong, but still not working).
I'm getting this error:
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_Library",
referenced from:
objc-class-ref in class.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code
1 (use -v to see invocation)
I tried it on xcode7 and xcode8.
Thanks.
Maybe you're using a framework or library which was only built for ARM architecture. In that case you'll have to create fat binary which will include code for all platforms (x86 for simulator, ARM and ARM64 for iOS devices).
Related
Undefined symbols for architecture x86_64:
"_BROADCAST_MODE_IBEACON", referenced from:
-[MainViewController tableView:cellForRowAtIndexPath:] in MainViewController.o
"_OBJC_CLASS_$_TZBeaconSDK", referenced from:
objc-class-ref in MainViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I take that error when I want to use simulator. There is no problem when I build it on iPhone. There is only problem when I use simulator. I have tried to change Architectures from Build settings, error text changes as i386 but problem is same.
I use that sdk; TZBeacon
Is there any problem with sdk? Could you help me to solve that problem?
Your library does not support simulator. Run this command line to see which architecture that it supports:
lipo -info libTZBeaconSDK.a
the result is: Architectures in the fat file: libTZBeaconSDK.a are: armv7 arm64
So, you have to test in a device, not in simulator!
Typically you get that error in the simulator if the architecture of the framework is built for the device. You need to use a version of the framework that is built for the simulator to run it on the simulator. This is something that should be provided by the framework vendor.
If they don't provide one then look into only including that framework when building to the device and not to the simulator. There is another SO answer here to point you in the right direction: How to only include a framework when building for device, not iOS Simulator?
Simple trick here: Go -> Go To Folder "/Library/Developer/Xcode"
delete Derived data next clean your project then Run .
I made my own framework and everything was fine. But when Apple releases 64bit architecture when another project uses 64-bit architecture my framework doesn't want to compile.
When I changed architecture of project just armv7 and armv7s - it complies good but when i changed architecture back to arm64 - it produces error -
(null): "_OBJC_CLASS_$MYFramework", referenced from:
objc-class-ref in RWAppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
So I've changed architecture of framework to include arm64, but error in my project still there
Is there another way to support arm64?
I added a screenshot of support architectures of framework
From error description you provided I can see that:
During linking phase for Intel 64bit architecture _OBJC_CLASS_$MYFramework symbol was not found. Which is quite strange as you sure you compiling for arm architecture. Maybe you should revise Makefiles of your framework?
Have a look here Shell you make target IOS7 32bit?
I am new to Xcode.
I am adding some features on the old(iOS 3.2) xcode game project. This code never touched for more than a year until I touched.
It worked fine until I tried to make an .iap file. it ran ok and all my changes didn't make any error.
So I changed target device from iPhone 6.0 Simulator -> iOS Device, and tried archive. Unfortunately it generated bunch of errors:
ld: warning: ignoring file lib/libegn_neutron_http_Release_iphoneos.a, file was built for archive which is not the architecture being linked (armv7): lib/libegn_neutron_http_Release_iphoneos.a
Undefined symbols for architecture armv7:
"_EGN_setPollingInMenu", referenced from:
ExitGamesCreateSession(sLibraryData*) in exitgames.o
"_EGN_Neutron_New", referenced from:
ExitGamesInit(sLibraryData*) in exitgames.o
"_EGN_setServerUrl", referenced from:
ExitGamesCreateSession(sLibraryData*) in exitgames.o
......similar 34 errors continued
"_EGN_NeutronCls_Release", referenced from:
ExitGamesShutDown(sLibraryData*) in exitgames.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This project uses some "exitgames" library which supports social features.
Also this project have some wrapping part of "Brew" c++ codes.
I don't know which part has the problem. tried to figure out and searched a whole day but still couldn't get a clue.
Can anybody give me an advice?
Thank you.
Try running lipo -info exitgames.a from the command line, it should tell you what architectures the framework is made to support.
I created a static library with Xcode I have compiled selecting a device.
I added this to my library test project in Xcode 4.6
but I always have 2 errors during the linking...
I followed this tutorial: Static Library iOS Tutorial
if I download the sample code I have the same errors:
ld: warning: ignoring file /Users/Downloads/ICodeBlogStaticLibrarySample/MathTest/Classes/iCodeBlogsMathLibrary/libICodeMathUtils.a, missing required architecture i386 in file /Users/Downloads/ICodeBlogStaticLibrarySample/MathTest/Classes/iCodeBlogsMathLibrary/libICodeMathUtils.a (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_MathFunctions", referenced from:
objc-class-ref in MathTestAppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I had once made a static lirary , I had the same problem .
Solution was to "Run the app on device " not on simulator , it works fine then !!!
Hope this helps...
I followed this step by step tutorial:
Tutorial
in particular I had to add these flags: -ObjC and -all_load
You must have selected iOS simulator while building the project. Select iOS device and it should be fine.
Do read and try to understand the error message, it's a meaningful English phrase.
symbol(s) not found for architecture i386
So there's no compiled code for the i386 architecture in the library. This means that either it's compiled for ARM only (for actual iOS devices, like iPhone or iPad), or for the 64-bit simulator (x86_64). Use otool to find out the architectures present in the library.
Thanks for going through this. I successfully integrated Zebra Printer working in xcode and got the label printer successfully from simulator, but the problem raises the moment i tried to debug it on my device saying
"ld: warning: ignoring file /Users/MYSystem/Desktop/MYProject/libZSDK_API.a, file was built for archive which is not the architecture being linked (armv7)
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_ZebraPrinterFactory", referenced from:
objc-class-ref in MyViewController.o
"_OBJC_CLASS_$_TcpPrinterConnection", referenced from:
objc-class-ref in MyViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)".
What would went wrong, please help me out from this..Thanks in advance
You need to include the library for the device, not the simulator. If you look at your install folder the lib folder has a Device and a Simulator directory. Link against the library in the Device directory.
The problem is the library is built for ios simulator which is using mac osx architecture which is i386 but ios device is based on ARM v6/v7 architecture that's why you are getting this error. Try to compile library for ios device.