Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Ionic 3 app on iPhone throws error: 2 duplicate symbols for architecture arm64

Tags:

I am opening .xcworkspace of my Ionic 3 project and trying to run it on my device but I suddenly get the following error in Xcode:

Ld /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos/MyApp.app/MyApp normal arm64
    cd /Users/manuel/Documents/MyApp/dev/copernic4-ion2/galilei/platforms/ios
    export IPHONEOS_DEPLOYMENT_TARGET=9.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk -L/Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos -L/Users/manuel/Documents/MyApp/dev/copernic4-ion2/galilei/platforms/ios/MyApp/Plugins/cordova-plugin-google-analytics -F/Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos -F/Users/manuel/Documents/MyApp/dev/copernic4-ion2/galilei/platforms/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework -FMyApp/Plugins/com.googlemaps.ios -filelist /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/MyApp.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=9.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/MyApp_lto.o -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -ObjC -ObjC -framework OneSignal -framework SystemConfiguration -framework UIKit -framework UserNotifications /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos/libCordova.a -framework Accelerate -framework CoreData -framework CoreLocation -framework CoreText -framework GLKit -framework ImageIO -lc++ -lz -framework OpenGLES -framework QuartzCore -framework SystemConfiguration -framework UIKit -framework GoogleMapsBase -framework GoogleMaps -framework GoogleMapsCore -framework EventKit -framework EventKitUI -framework AVFoundation -lGoogleAnalyticsServices -lAdIdAccess -framework AdSupport -lsqlite3 -weak_framework WebKit -lz -Xlinker -dependency_info -Xlinker /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/MyApp_dependency_info.dat -o /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos/MyApp.app/MyApp

duplicate symbol _OBJC_CLASS_$_CDVLogger in:
    /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/CDVLogger.o
    /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos/libCordova.a(CDVLogger.o)
duplicate symbol _OBJC_METACLASS_$_CDVLogger in:
    /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/CDVLogger.o
    /Users/manuel/Library/Developer/Xcode/DerivedData/MyApp-awaxbzztsgokklgptpuoufwcwmkt/Build/Products/Debug-iphoneos/libCordova.a(CDVLogger.o)
ld: 2 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I don't understand what is duplicated... any help would be really appreciated.

like image 930
Manuel RODRIGUEZ Avatar asked Sep 12 '17 10:09

Manuel RODRIGUEZ


People also ask

How do I Run and debug Ionic apps on iOS?

This guide covers how to run and debug Ionic apps on iOS simulators and devices using Capacitor or Cordova. iOS apps can only be developed on macOS with Xcode installed. There are two workflows for running Ionic apps on iOS: The Xcode approach is generally more stable, but the Ionic CLI approach offers live-reload functionality.

Why am I getting 158 duplicate symbols for architecture ARMv7?

I was able to resolve this error which said "158 duplicate symbols for architecture armv7, 158 duplicate symbols for architecture arm64" --- If this is what you are getting too, then it means you are trying to compile a file which is importing or inheriting a framework or static library having references to C++ code or files.

What is the difference between Xcode and ionic CLI?

The Xcode approach is generally more stable, but the Ionic CLI approach offers live-reload functionality. Xcode is the IDE for creating native iOS apps. It includes the iOS SDK and Xcode command-line tools. Xcode can be downloaded for free with an Apple account or it can be installed through the App Store.

How to fix ARM64 errors in Xcode?

I would recommend dragging the project from xcode itself as opposed to from your file explorer... Had over 450 of these arm64 errors... Select Project -> Target -> Build phase -> Compile source -> search for the file which is mentioned in the 3rd last error line (In your case BFAppLinkReturnToRefererView.o ).


2 Answers

To solve the problem please have a look over this blog post from Cordova iOS 4.5. http://cordova.apache.org/announcements/2017/09/08/ios-release.html

You need to remove plugin "cordova-plugin-console" that is installed by default when generating a new Ionic project. Now this is in core part of cordova for iOS.

like image 152
Ionut Movila Avatar answered Sep 17 '22 20:09

Ionut Movila


Since duplicate symbols are there, just removed "-ObjC" from both Targets and Project:

Build Settings -> Linking -> Other linker flags.

also try to remove any unwanted libraries from

Targets -> Build Phases -> Link Binary with Libraries

like image 35
arunraj770 Avatar answered Sep 16 '22 20:09

arunraj770