"Undefined symbols for architecture arm64" appearing after Unity FB SDK Update - ios

Unity Version: 2020.3.25f1
XCode Version: 13.2.1
Unity FB SDK: Migrating from 11.+ to 14.0.0
After resisting updating the Facebook Unity SDK due to editor/ide related issues introduced in 13.2, was working to update to Unity Facebook SDK version 14.0.0. After resolving the standard issues to be in compliance with FB's updates (including client token in the FB Settings specifically and setting the DLLs to the correct build architecture), I had been able to build webgl and android without issue, but have encountered an iOS build fail.
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_ACAccountStore", referenced from:
objc-class-ref in Util.o
"_ACFacebookAppIdKey", referenced from:
_Util_getNativeFBPermissionStatus in Util.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Reading through the various other issues hitting a similar Undefined symbols for architecture blah makes me think I might either be missing something in my linker settings, or potentially missing a framework I need to reference. Originally I had assumed it was something happening during archiving, but the same error shows when just trying to build the xcode project. The pod file builds successfully and resolves without issue, so the xcode workspace is being built.
EDIT: Adding a little more info, I had already done the dll import settings solution suggested.

This is solved by: https://github.com/facebook/facebook-sdk-for-unity/wiki/FAQ---Troubleshooting-Unity-SDK-14.0.0
Your issue is "Issue 2: dlls misconfiguration"--for completion's sake, below is the solution in its entirety. I'm leaving the misspellings and bad grammar below just to emphasize how sloppy these guys are.
"Solution:
This is an indication of mis-configuration of dlls in Unity. When Unity SDK is imported into Unity, unfortunately Unity reconfigures all dlls to 'All Platforms' and this causes an issue when building on a particular platform. The way to resolve this, is to reconfigure the dlls. You will find them in Unity under FacebookSDK -> Plugins and all the dlls are under their various platform folders such as Android / Canvas / Editor / iOS etc. Click on them and an inspector will appear (attached screenshot). The example attached shows the configuration for an Android dll. Uncheck All Platforms (if needed) and select Android. Do the same for the rest:
Android.DLL to Android platform
IOS Dll to iOS platform
Canavs to webgl"
Edit: As noted additionally below if you aren't building for Windows (or any of the other platforms), just delete those folders. Regardless you will HAVE to delete the Windows x86 folder if you want your build to work on mobile.

After getting some input from an engineer that had worked on this project in the past, managed to find that the missing symbol was related to some old FB Code no longer supported, and it was not in use by our app anymore. Because of this, was able to cleanly remove the old code and resolve the build issue. Things appeared to be working as intended. For visibility, we had an internal class using some extern methods to bridge between our app code and the native code pertaining to platform. iOS had a method getNativeFBPermissionStatus that was part of a Util.m class.

Related

Getting error: ld: framework not found Fabric for architecture armv7 in App

I have build a iOS framework eg: abc.framework. Now in abc.framework I have added FirebaseDatabase and FirebaseMessaging. The abc.framework compiles and builds properly. However when I add the abc.framework and abc.bundle in my iOS project eg: xyz.project then it is giving error "framework not found Fabric for architecture armv7". I have not added Fabric in abc.framework and not in my xyz.project. However when I remove the Firebase from the abc.framework then the error disappears from xyz.project and the project compiles and run without errors.
If anyone has encountered the same issue then please let me know how should I solve the issue. I have to integrate Firebase in abc.framework and that framework will be added in xyz.project
Nested frameworks are not allowed in IOS , it's only allowed in MacOSX , to create a frameWork it must be of a pure code , fabric is in Firebase , also framework must support all architecture armv7,64 and soon on this configured when you build it, I encountered the same situation posted in Apple forums and find that
If CocoaPods is an option for you, the recent CocoaPods 1.4.0 release has added the static framework podspec option, which enables the definition of static frameworks that allow depending upon other static frameworks like Fabric.

Upgrading Google Mobile Ads iOS SDK from 5.0.5 to 6.4.2 results in linker errors

I have an existing iOS app that is using Google Mobile Ads SDK (v 5.0.5, I believe). I need to upgrade it to the latest version for DoubleClick support. However, I'm getting linker errors.
My steps were as follows:
Remove file references for previous SDK from project
Remove previous libGoogleAdMobAds.a linked library
Follow the setup instructions (to the letter, including the required frameworks, including only the specific files, as well as adding the Other Linker Flag)
The specific error is:
Undefined symbols for architecture i386:
"_CGSizeFromGADAdSize", referenced from
or
"_kGADAdSizeBanner", referenced from
What else am I missing?
Maybe you need the -all_load linker flag option too? According to this article it's obsolete for newer ARM7 targets, but perhaps you have an old target?
http://vntin.com/feeds.feedburner.com/blogspot/LTiVe
See under this section: "Support for armv7s"
"If you’re targeting the armv7s architecture, you will not need to add the -all_load linker flag to your projects anymore. "
[Update]
You can try to verify what's in the lib*.a file by using the nm command.
nm -U libGoogleAdMobAds.a | grep kGADAdSizeBanner
Also, clicking on the Log Navigator may provide some additional information. Select the last icon then your last build in the left nav.
[Update 2]
Someone on this site also complained about a linker problem with the new API. Might have to make small changes to your code.
http://www.monkeycoder.co.nz/Community/posts.php?topic=1246
Something has changed in the latest AdMob SDK. I get the same linker error. I can use an older version of the SDK and this all works fine. Anyone know what could have changed with Ad sizes?
EDIT: Found the problem. There were some name changes to constants :)
https://developers.google.com/mobile-ads-sdk/docs/ios/intermediate
Change the GAD_ ad sizes with:
kGADAdSizeBanner.size.width and kGADAdSizeBanner.size.height

ld: library not found for -lgcc_s.1 when creating AIR iOS package with native extension

I'm trying to create an AIR native extension for iOS, but when try create the package to deploy to my device, I'm getting the following error:
ld: library not found for -lgcc_s.1
Compilation failed while executing : ld64
Its working when I try to create the app for the simulator. I've tried many combinations of adding libgcc_s.1 to my platform.xml file, creating just a package for iOS, creating a fat binary for both the simulator and the phone, etc.
I'm not sure why it needs the libgcc_s.1 package since I'm not referencing it in my extension. I tried adding it manually to the "Link Binary With Libraries" list in xcode, and at that point it won't build, telling me that libgcc_s.1.dylib doesn't exist on my system.
Do other people have this lib on their system? Does anybody know why it's being added if I didn't ask for it?
I finally solved this after days of searching and testing. Remove the -platformsdk option when packaging for device.

App crashes on iOS 6: Symbol not found: ___sync_fetch_and_add_4

I have an application that works perfectly with iOS4 and iOS5. It uses a statically compiled version of the zeromq library, targeted for ARM. Apple denied my application because they claim it crashes under iOS 6 (yet unreleased..wth?)
After trying it with the iOS 6 GM I can confirm it does crash when we initialize the ZeroMQ socket. Here is the crash messages:
dyld: lazy symbol binding failed: Symbol not found: ___sync_fetch_and_add_4
Referenced from: /var/mobile/Applications/00EDEEDA-0068-4061-9188-01D627F9A6D6/OpenAir.app/OpenAir
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: ___sync_fetch_and_add_4
Referenced from: /var/mobile/Applications/00EDEEDA-0068-4061-9188-01D627F9A6D6/OpenAir.app/OpenAir
Expected in: /usr/lib/libSystem.B.dylib
I understand the __sync_fetch_add_4 symbol is a compiler atomic builtin. I know that ZeroMQ is using mutexes for it's internal locking. I have been searching everywhere to try to figure out what changed in iOS6 that could cause these symbols not to be present.
Using Xcode 4.5 and iOS6 GM, the library will not even compile with the same type of message:
Undefined symbols for architecture armv7:
"___sync_fetch_and_add_4", referenced from:
zmq::socket_base_t::unregister_session(std::basic_string<unsigned char, std::char_traits<unsigned char>, std::allocator<unsigned char> > const&)in libzmq.a(libzmq_la-socket_base.o)
Is there a way to disable atomic builtins in the Apple compilers to try to bypass this problem altogether?
Make sure you aren't targeting any iOS below 4.3. Same goes for your static library, you will need to rebuild these. Also, make sure to remove armv6 from Archs and add armv7s is it does not exist.
After upgrading to Xcode 4.5, I tried everything for 2 days, and nothing worked. I finally gave up and went back to using Xcode 4.2.1
open -a /Developer/Applications/Xcode.app
Just to clarify. I've run my app on iOS 6 by building using the iOS 5 SDK. so unless you need iOS 6 functionality immediately, that works.
It shouldn't really be necessary to downgrade to an early version of iOS. I think the key is to use the extra bindings that are available for C and objective C development:
http://czmq.zeromq.org/
http://www.zeromq.org/bindings:objc
I used the czmq ones and can confirm these build with xcode in an iOS 6 project. I spent some time trying to get these to work as there's not much documentation on using them with iOS SDKs, but found the easiest method was to:
Download zeromq from http://download.zeromq.org/zeromq-3.2.2.tar.gz, extract, configure and build from the command line.
Download czmq from the link above and extract.
Import the src and include paths from the above into an xcode project.
Add -lstdc++ to the 'Other Linker Flags' section under 'Build Settings' for your target project
Import "czmq.h"
The libraries should successfully link together, then you should be good to go!

How to link an Adobe AIR3 Native Extension for iOS against an iOS framework?

I’m working on an app with an AIR3 iOS native extension that uses Accelerate.framework
Followed the first steps mentioned in the tutorials, successfully created an .ane file etc.
When I run the final packaging command (adt -package -target ipa-test ...), I get the following errors:
ld warning: unexpected srelocation type 9
ld warning: unexpected srelocation type 9
... (repeating several times)
Undefined symbols:
"_vDSP_vsdiv", referenced from: ...
"_vDSP_vsmul", referenced from: ...
... several more like this
ld: symbol(s) not found
Compilation failed while executing : ld64
I guess this is because when I created the .a file in xcode, it couldn’t really link it statically to the Accelerate.framework.
I suppose I need to tell adt to link it somehow? Probably in the phase I’m creating the .ane file? Or maybe I should change my extension.xml file?
No idea. Couldn’t really find it...
Please advise.
UPDATE: This seems like a bug on the Adobe side specifically with Accelerate.framework. I'll keep updating here in case other guys stumble upon this one.
Make sure you are using the latest Flex 4.6 SDK. If that doesn't solve it, ensure you have specified the Apple iOS SDK correctly under the Native Extensions tab of your Apple iOS build packaging in your project settings. It should be
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk
if you installed Xcode into the default folder
I've had this "srelocation" error, because the included libraries (in my case AudioToolBox/ OpenAL) were treated as shared libraries by XCode: They were not included in my library build (even when it's static). I've had to set "Enable Linking With Shared Libraries" under Build Settings to NO, and then the errors have been gone. Maybe this will solve your problem too...

Resources