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

5

20

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.

Module answered 12/9, 2017 at 10:14 Comment(3)
Possible duplicate of Duplicate Symbols for Architecture arm64Dolphin
Don't really know what to do with this...Module
@the4kman No it's not a duplicate.Noise
A
57

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.

Aili answered 21/9, 2017 at 12:35 Comment(1)
in case anyone's wondering how to remove plugin : cordova plugin remove FOLDER_PLUGIN_NAMEAmazonite
O
15

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

Optical answered 26/9, 2017 at 11:59 Comment(3)
Thank you so much for this answer. I tried everything so far! Nothing worked except for this. Thanks againStarve
This answer is working if you are using old cordova versions.Many thanksAssuan
As an Obj-C developer your process was my gut-sense but since we are using ionic for this project it is logically correct process was to remove the duplicate via cordova.Antilepton
R
10

The problem here is cordova-ios@latest.

And we could fixed this issues with:

  • Uninstall cordova-ios first, with npm uninstall cordova-ios
  • Install cordova-ios with npm install [email protected]
  • After that we should add platform with ionic cordova platform add [email protected]
  • The last one, run ionic cordova build ios, that open with xcode and build with your settings.
Rabaul answered 12/9, 2017 at 14:6 Comment(1)
This worked. I was at [email protected] to 4.4.0 and it worked.Barfuss
G
6

Since cordova IOS 4.5 they are including cordova-plugin-console, which results in the plugin being duplicated.
To fix just run:

cordova plugin rm cordova-plugin-console
Garibold answered 18/12, 2017 at 22:0 Comment(2)
Yes, but this is just a simple response with the command to run to solve the problem.Garibold
this works for me, if your using latest ios cordova-plugin-console should be removeTocharian
G
0

The solution @arunraj414 worked for me, from xcode you can solve it this way:

enter image description here

Delete either one

Gsuit answered 21/8, 2020 at 14:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.