Apple Mach-O Linker Error - Undefined Symbols for architecture arm64 - ios

I have an issue while Running my unity project on xcode. I get over 78 Apple Mach-O Linker Errors. I have implemented a bunch of Plugins as well. However I have included all the frameworks that are required for those plugins to run.Now I am not sure why I keep getting these issues. I have attached an image of some of the Mach-o linking errors im getting. Im trying to deploy the build for iPhone 6 running 8.2 and it Xcode 6.2.
http://i.stack.imgur.com/eZoY8.png
Thanks

Related

Build fails due to architecture deprecation error

I am building a Unity project to my device on Xcode. I started using cocapods to fix another issue.
Now I am getting this error:
The armv7 architecture is deprecated. You should update your ARCHS build setting to remove the armv7 architecture.
What does this error mean and how to get rid of it?

Unable to build Xcode Project: clang error: linker command failed

I have a Unity project which I have successfully built for Android without issue. When trying to build for iOS I am encountering an issue once the project is in Xcode.
Unity compiles without any errors and creates an Xcode project.
Upon opening the Xcode project I have NO simulators available. I can get these simulators by selecting ios in the Supported Platforms section, at which point simulators become available - originally Supported Platforms is set to iphoneos. This seems extremely odd behaviour to me, and suggests something larger going wrong.
After getting a simulator to select I get the following error when trying to compile/run/build:
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The full error is available on Pastebin (too large to post directly on here):
https://pastebin.com/3fYR8fE3
I'm really at a loss on what I can do. I have tried a number of things, including:
Building from Unity as Debug and Release
Building from Unity with 'Symlink Unity Libraries' on and off
Building from Unity with .Net 3.5 and .Net 4.* flavours
Manually adding the libiconv.2.dylib file in the linked frameworks tab as the .tbd equivalent
Setting the target minimum version of iOS to 9.0 (negates the need for libiconv.2.dylib entirely)
I am using latest versions of everything:
Unity 2018.2.17f1
Xcode 10.1
It seems like you have the library il2cpp built for another architecture, have you tried to change your target's "Build Settings > Build Active Architectures Only" to "No"?
However I made some researches and it seems that Unity for iPhone doesn't deploy on simulator. It only works on device or in the Unity editor. Check this link out

Linker error on the new xcode (ios 8.2 simulator) in cocos2d-x

I've recently updated xcode to the last version. So now my simulator have 8.2 ios version. My cocos2d-x projects are still working on devices (tested on ipad2 and iphone5s), but I can't compile them for simulator. I'm getting huge number of linker errors:
Undefined symbols for architecture x86_64:
"_AVAudioSessionCategoryAmbient", referenced from:
-[CDAudioManager setMode:] in libcocos2d iOS.a(CDAudioManager.o)
-[CDAudioManager applicationWillResignActive] in libcocos2d iOS.a(CDAudioManager.o)
...
few hundred lines more
...
ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed
with exit code 1 (use -v to see invocation)
Showing first 200 notices
only Showing first 200 errors only
Generally there are errors of all frameworks I use as well as cocos2d-x library itself. Before getting there most frameworks was highlighted red, but I fixed that making a symlink to:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
using this:
sudo ln -s iPhoneOS.sdk iPhoneOS8.1.sdk
I'm of course using cocos2d-x 3.4.
edit:
After migrating to v. 3.5, setting valid architectures to: armv7, armv7s, i386, x86_64, setting build active architecture only to no (in both main and cocos2d_libs project) with various settings variations now I'm getting:
Undefined symbols for architecture i386:
And other's the same. Doesn't work on any simulator. I even downloaded 8.1 simulators and it doesn't work there too. This is some stupid linker error and I can't figure it out.
I've also noticed that fresh project builds fine. In my project I also have few objC classes (for other stuff like admob), which are using ARC. So I had to add "-fobjc-arc" in few places in build phases->compile sources. Problem is it's only simulator-related problem and appeared when I've updated ios sdk from 8.1 to 8.2.
Regards

Xcode 6 Error - "Missing Required Architecture i386" When Building for iOS Simulator

I have created a custom Objective-C framework. I would like to import it into any given iOS project and use its provided functionality on both the iOS Simulator and an actual device. To import the framework, I link it using the Build Phases > Link Binary With Libraries setting in the app's target. I'm then able to import it into one of my classes with this statement:
#import <CustomFramework/CustomFramework.h>
I can instantiate my framework's classes just fine, but when I try to run my project on a device, I get the following error message:
dyld: Library not loaded: #rpath/CustomFramework.framework/CustomFramework
Referenced from: /var/mobile/Applications/A61E882D-481A-4C0B-B4FD-69F5D24968BF/TestApp.app/TestApp
Reason: image not found
And if I try to run it on the simulator, I get a different error message:
ld: warning: ignoring file /Users/user/Desktop/CustomFramework.framework/CustomFramework, missing required architecture i386 in file /Users/user/Desktop/CustomFramework.framework/CustomFramework (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CustomFramework", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This occurs when I instantiate a class from the framework. If I import the framework but don't actually use it, my app builds successfully. It just errors whenever I instantiate a class from the framework for some reason.
To get the app to build on a device, I followed this SO answer. Instead of linking the framework, I added a new Copy Files phase in the target's Build Phases setting, set the Destination to Framework, and added my framework.
That works great; however, I'd like to test my app on the iOS Simulator as well. When I try to run my app on the simulator, I still get the "missing required architecture i386" error. I've tried the solutions proposed at just about every related SO topic I could find, and nothing has helped me resolve this issue.
Please note that I am trying to use my custom framework in a new Xcode project, so none of the app/build settings have been changed from their defaults.
How can I fix this error so that I can run my app on both the iOS Simulator and a device with my framework included in the project? Any insight would be greatly appreciated!
The issue was that the framework was not compiled for the iOS Simulator's architecture, which is i386. Xcode only compiles a framework for the target architecture, so if I built the framework for the iOS Simulator, it wouldn't work on a device, and if I built the framework for a device, it wouldn't work on the iOS Simulator.
I created my framework from scratch with help from this tutorial: http://www.raywenderlich.com/65964/create-a-framework-for-ios
The multi-architecture build script is what allowed my framework to run on both the iOS Simulator and a device.
I encountered this same problem with Xcode 7.1 when trying to build for the simulator.
Someone else said it worked for them under Xcode 8.2.1, so I tried building/running there and it worked. I didn't have to change targets or anything in my project.
So try upgrading your Xcode if you can, you will presumably get additional bug fixes as well.

Soundcloud Apple Mach-O Linker error when running from Iphone device

My program runs fine when i use the simulator however, when i try run it on an ios Device i get the apple mach-o linker error. This only started to happen when i added the soundcloud api
This is the error I'm getting:
This means the library you are linking against (Soundcloud) was not built for arm64. It looks like some of your other dependancies (like JSONKit) were also not built for arm64.
If you change your build architectures to only build for the architectures you can support (armv7, armv7s), that is one way of fixing the problem.

Resources