Crashlytics error: Undefined symbols for architecture arm64 - ios

After I updated Fabric Crashlytics in my app I cant anymore run it on my iOS device. On simulator it works fine. Error is:
Undefined symbols for architecture arm64:
"_gzopen", referenced from:
-[CLSPackageReportOperation compressFile:] in Crashlytics(CLSPackageReportOperation.o)
"_gzwrite", referenced from:
___42-[CLSPackageReportOperation compressFile:]_block_invoke in Crashlytics(CLSPackageReportOperation.o)
"_gzclose", referenced from:
-[CLSPackageReportOperation compressFile:] in Crashlytics(CLSPackageReportOperation.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Crashlytics and Fabric require you to link your target against the following:
Security.framework
SystemConfiguration.framework
libc++
libz
Just select your target -> Build Phases -> Link Binary with Libraries -> add the ones missing.
I hope it helped.

I solved this issue by just adding $(inherited) to other linker flags in Build Settings.

I run into a similar issue, when I was updating an app that was created before Xcode 5.
Since Xcode 5 new projects build with modules enabled by default. In my old app "Enable Modules" was set to "No". So this was the solution.

Solved. I removed Crashlytics.framework and reinstall it.

For me, the solution was Build Phases - Link Binary With Libraries add libc++ and works, in my legacy project.

My solution for this problem was:
Change "Build Active Architecture Only" to "Yes" also for "Release".
The setting can be found selecting your project > "Build Settings" > "Targets" (your target) > "Architectures"
do it in your project targets and also do it in your projectTest targets

Extending Ricardo's answer here. Select the “Build Phases” tab, click the “+” next to “Link Binary With Libraries” and add -
Security.framework
SystemConfiguration.framework
StoreKit.framework
libsqlite3.tbd
libz.tbd
libc++.tbd
As per Google, developers should use Crashlytics via Firebase. This worked for me as of Firebase v5.16.0 and Fabric v1.9.0 (Xcode 10.1).

I solved the issue by adding $(inherited) $(OTHER_LDFLAGS) -ObjC -l"sqlite3" -l"z" -l"c++" -framework "Crashlytics" -framework "Fabric" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" to other linker flags in Build Settings.

In Project(not target) Info tab set the configuration file to none and run pod install again

On M1 Mac
In Excluded Architectures Add "Any iOS Simulator SDK" - "arm64" in Target, Test, and all libraries you added.

I solved it by removing "library which causes the error" from other linker flags.

Related

Flutter build is iOs - Error (Xcode): Undefined symbol: _objc_msgSend$

Trying for several days to build my flutter project in iOs (flutter build IPA) and I always seem to receive the same errors :
"_objc_msgSend$setIOSHasWarnedLocationServicesOff:", referenced from:
+[LocationAuthorization run:onCancel:] in TSLocationManager(LocationAuthorization.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
There are a lot of them so I won't be putting all of them here but they're all related to _objc_msgSend$ and TSLocationManager.
I tried to add "-lc++" to Other Linker Flags in Build Settings (Runner Target)., related to this issue https://github.com/facebookarchive/pop/issues/25 but it still failing with more than 100 _objc_msgSend$ issues. I have frankly tried so many things and I'm quite out of clues.
Something I remarked is that when I build from Xcode (Product -» Build), it builds fine when I choose the Destination Device iPhone SE 3rd GEN, but I get the errors when the destination device into my physical device (which is plugged into my Mac).
When I hit flutter build IPA, it always fails.
^_^
First you can update your xcode to version14.0 above.
And the real reason is Apple Clang new optimization scheme._objc_msgSend stup support is not support on xcode13.
If you don't want upgrade your xcode version . You can follow next steps to change your private framework.
I guess you compiled a framework in xcode14 and then used it in xcode13
hh , now i saw you reply , make sure my answer
i'm using Xcode 13.4.1 and it's not having ARCHS_VALID as a build setting #editix –
Bertrand Gélinas
22 hours ago
By default, the clang in Xcode 14 will generate target files that cannot be understood by earlier native linkers.
In the future, it will be recommended to use Xcode14 and above for application package.
If you have private framework build by Xcode14.
Just add -fno-objc-msgsend-selector-stubs to your framework project target build settings other c flags, and build again, replace new framework to your other xcode project
or in your framework project chaneg your podspec file add xcconfig other c flags -fno-objc-msgsend-selector-stubs
or your own script build framework , you can before call xcodebuild command add a change , like thisxcodebuild -project xxx.xcodeproj build OTHER_CFLAGS="-fno-objc-msgsend-selector-stubs "
click on your target > build settings > VALID_ARCHS > and add the following :
arm64 arm64e armv7 armv7s x86_64
in case you didn't find the VALID_ARCHS do the following:
1- Click on the plus sign under the Build Settings.
2- Choose "Add user-defined settings" and it will add NEW_SETTING to you.
3- Rename the "NEW_SETTING" to "VALID_ARCHS" and add the following builds:
arm64 arm64e armv7 armv7s x86_64
if nothing fixed your issue please follow this you may find working answer:
Undefined symbols for architecture arm64

Error on Xcode with React native Could not find autolink framework

when I try to build my app that works fine in android I run into an error:
lib RNFirebase.a(RNFirebase AdMob.o) ld: symbol(s) not found for architecture arm64
What can I do to resolve this?
have you already tried to set $(inherited) in the Other Linker Flags?
You can search this under 'build settings' of your project in Xcode.

AFNetworking won't compile

I'm totally stuck trying to run a project on the simulator using AFNetworking. I've used this dependency before on other projects, so I don't understand what is going wrong here. First, the error when I try to run the project:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_AFHTTPSessionManager", referenced from:
_OBJC_CLASS_$_SharedNetworkObject in SharedNetworkObject.o
"_OBJC_CLASS_$_AFJSONResponseSerializer", referenced from:
objc-class-ref in SharedNetworkObject.o
"_OBJC_METACLASS_$_AFHTTPSessionManager", referenced from:
_OBJC_METACLASS_$_SharedNetworkObject in SharedNetworkObject.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'm sure that this is part of the problem, but I don't know how to resolve it:
This is the offending .h file:
#import <Foundation/Foundation.h>
#import <AFNetworking/AFNetworking.h>
#import "SharedSessionKey.h"
#interface SharedNetworkObject : AFHTTPSessionManager
+ (SharedNetworkObject *) sharedNetworkObject; // class method to return the singleton object
#end
It may be of interest to note that when I start typing the import line for AFNetworking, the line fills in after a few characters, so I know that there is some awareness of the presence of the AFNetworking dependency.
I installed the dependency using CocoaPods. Here is my Podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'WeRun' do
pod "AFNetworking", "2.5.2"
end
target 'WeRunTests' do
end
And, of course I am working in .xcworkspace (not .xcodeproj).
One more thing, my xcconfig file looks like this, which matches with other successful AFNetworking builds:
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking"
OTHER_LDFLAGS = -ObjC -l"Pods-MyApp-AFNetworking" -framework "CoreGraphics" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration"
OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS)
PODS_ROOT = ${SRCROOT}/Pods
I don't know what else to look for. I've completely removed the pod and reinstalled, only to find the exact same error. Can anyone help me figure this out? Thanks!
I spent a couple of hours fighting with this exact same issue, going through all the Google hits I could find. Building for the device was working, but building for the simulator was not.
Here are the steps that finally solved the issue for me:
Clear the XCode caches:
rm -rf ~/Library/Developer/Xcode/DerivedData/
Clear the CocoaPods caches and reinstall the dependencies:
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
Finally go to the "Pods" project and set the Build Active Architectures Only to No also for the "Debug" configuration.
I would suggest you to add the $(inherited) flag into the "Build settings".
Tap on the blue project icon
Select "Build settings" tab
Under "Linking" you'll find a setting called "Other Linker Flags"
add $(inherited) into the textfield
I had the same issue, when I had -lc++ already set on Other linker flags for cpp library usage purpose.
I added these two flags -ObjC -l"AFNetworking" on Other linker flags, which worked and compiled successfully. These are the two flags -ObjC and -l"AFNetworking". You scan add simultaneously -ObjC -l"AFNetworking".
Do not give version after AFNetworking in pod file. And try again. Make sure you remove the comma also.
Well, I resolved this, but I'm not sure why it worked. I was experimenting with the Other Linker Flags in the Build Settings. I deleted the flag that was put there by the CocoaPods installation (presumably) and replaced it by copying the flag from the .xcconfig file. Specifically, I added this text: -l"Pods-WeRun-AFNetworking" as the second flag right after -ObjC. It looks to me to be exactly what I had just deleted, so I really hesitate to suggest this as an 'answer', but it works now, so something must have changed.
If anyone can shed any light on this or tell me that I am fooling myself, please let me know. Thanks for the suggestions.
this happened to me too. and what I fixed it just one step:
Kill the Xcode, and right click the Xcode to show info, open it using Rosetta, then open the project to build. It works!!!
By the way, I am using M1-chip Mac Mini.
Before that, I tried everything I got from google, like: clean the cache, check the other linked flag, etc. they won't work for me.
I hope this can help you guys!
A simple method. Download the repository file. Drag and drop the contents of the AFnetworking folder (You can create groups if necessary) then use the library. (Use #import "AFnetworking.h" )

Undefined symbols when referencing PLCrashReporter 1.2 beta 2 in static library and build in client

I have created a static library and added an aggregated target to build a .framework static framework so I can release to the users.
I have to use PLCrashReporter to this static library so I downloaded the latest version 1.2 beta 2 since ARM64 support is added and added the .xcodeproj file in a group inside my static library. Added the User Header Search Paths in the build settings of the static library target, in build phases added in Target Dependencies the CrashReporter-iOS-Device (CrashReporter) static library and Link Binary With Libraries added the libCrashReporter-iphoneos.a static library.
My static library builds successfully all the targets with no problem, but when it comes to adding my .xcodeproj project as a dependency in a UI client test project or even adding directly the .framework that I generate, the build for the simulator breaks.
I can run it on a device and work properly but it is major to use it in a simulator too.
If I hit build I get the following errors.
Undefined symbols for architecture i386:
"std::terminate()", referenced from:
___clang_call_terminate in libReporter-iOS.a(PLCrashSignalHandler.o)
___clang_call_terminate in libReporter-iOS.a(PLCrashAsyncImageList.o)
"___cxa_begin_catch", referenced from:
___clang_call_terminate in libReporter-iOS.a(PLCrashSignalHandler.o)
___clang_call_terminate in libReporter-iOS.a(PLCrashAsyncImageList.o)
"___gxx_personality_v0", referenced from:
Dwarf Exception Unwind Info (__eh_frame) in libReporter-iOS.a(PLCrashSignalHandler.o)
Dwarf Exception Unwind Info (__eh_frame) in libReporter-iOS.a(PLCrashAsyncImageList.o)
Dwarf Exception Unwind Info (__eh_frame) in libReporter-iOS.a(PLCrashSignalHandler.o)
Dwarf Exception Unwind Info (__eh_frame) in libReporter-iOS.a(PLCrashAsyncImageList.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I miss something for sure here!
Thank you in advance.
It looks like the i386 architecture is missing from libCrashReporter-iphoneos.a (The name of that file also suggests that it's for device only). Try to run lipo -info libCrashReporter-iphoneos.a to see if all the required architectures are there, if the i386 (required for simulator) is not there, you have to find the lib for i386 (or build it if you are building it yourself) and use lipo -create lib-iphoneos.a lib-iphonesimulator.a -output lib-all.a to create a library with all required architectures.
P.S. I have just downloaded the latest build from https://www.plcrashreporter.org and it seems like the CrashReporter.framework in iOS Framework contains armv7, armv7s and i386, so you might try that if you don't require arm64 and x86_64.
EDIT: see this for arm64 support (it's a beta from September).
EDIT2: I didn't pay attention to the std::terminate() at first, so if all the required architectures are there you might have to add libstdc++ to the Linked Frameworks and Libraries.
By the way.. can be useful to others..
the same settings:
-lstdc++ in linker flags
may solve similar headache for using MySQL in C/C++ in Xcode in OSX.
in fact when you link against libmysqlclient.a or libmysqlclient.dylib, you get the same error.
It has been broken in respect to previous installation of mysql.
verify to have:
//:configuration = Debug
OTHER_LDFLAGS = -lstdc++
//:configuration = Distribution
OTHER_LDFLAGS = -lstdc++
//:completeSettings = some
OTHER_LDFLAGS
Hope this can help.

iOS compile library/framework linker flags issues compiling for device but not simulator

Background:
I'm trying to use a Phonegap with cocoapods. Phonegap already has issues compiling from command line so I'm just using Xcode with the generated project file (and assumably I'd have to do that anyway when using cocoapods).
I've pushed up on Github a reproduced empty project with my problem:
https://github.com/Dan2552/phonegap-reproducable-issue
You can see the steps I made after making a plain brand-new Phonegap app in the build_ios script in the root directory on the repo. But I've also pushed up the generated project files (platforms/ios) so anybody without Phonegap should be able to open the project.
Problem:
I'm having a weird issue with compiling. Probably issues with the pre-bundled Cordova library and cocoapods.
When building without doing anything after generating the project with Phonegap and adding in the cocoapods, I get the following errors:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_OTPublisher", referenced from:
objc-class-ref in libPods.a(OpenTokPlugin.o)
"_OBJC_CLASS_$_OTSession", referenced from:
objc-class-ref in libPods.a(OpenTokPlugin.o)
"_OBJC_CLASS_$_OTSubscriber", referenced from:
objc-class-ref in libPods.a(OpenTokPlugin.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Cocoapods warns:
[!] The target HelloWorld [Debug] overrides the OTHER_LDFLAGS build setting defined in `Pods/Pods.xcconfig'.
[!] The target HelloWorld [Debug - Release] overrides the OTHER_LDFLAGS build setting defined in `Pods/Pods.xcconfig'.
and therefore I tried deleting the OTHER_LDFLAGS ('Other Linker Flags' in Xcode) entry altogether. This successfully compiles on an iOS device, but not on the simulator, nor will the project build on archive.
Building for simulator will get the same error as before (Undefined symbols for architecture)
Building for archive will get
/Users/dan2552/projects/ReproducableProblems/OpenTokPhonegap/Classes/OpentokPlugin.h:9:9: 'Cordova/CDVPlugin.h' file not found
I've also tried putting $(inherited) in the OTHER_LDFLAGS which produces the same results as deleting them.
Your included framework has no Simulator (i386) slice:
$ xcrun -sdk iphoneos lipo -info Pods/OpenTokSDK-WebRTC/Opentok.framework/Versions/A/Opentok
Architectures in the fat file: Pods/OpenTokSDK-WebRTC/Opentok.framework/Versions/A/Opentok are: armv7 armv7s
So its classes can't be linked for the Simulator.
Also if you plan to use CocoaPods you could remove the Cordova project and static library entirely and add pod 'Cordova' to your Podfile.
I've seen similar issues before when trying to run the Xcode project, rather than the XCWorkspace. The issue you're having sounds like it's because you're not running the workspace.
Go to your taget Build Settings -> Other linker flags -> double click . Add $(inherited) to a new line .
. Try this

Resources