[Ionic 4] Can't build for iOS

Hello everyone,

I’m updating my ionic 3 app to ionic 4.0.0-rc0 and I’ve been struggling with building my app on iOS with cordova. I am getting the following error in xcode :

Ld /Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/myProject.app/myProject normal armv7
    cd /Users/charles/myProject/app4/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 armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk -L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos -L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/FirebaseAuth -L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/FirebaseCore -L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/FirebaseMessaging -L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/GTMSessionFetcher -L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/GoogleUtilities -L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/Protobuf -L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/nanopb -L/Users/charles/myProject/app4/platforms/ios/myProject/Plugins/cordova-plugin-google-analytics -F/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos -F/Users/charles/myProject/app4/platforms/ios/Pods/FirebaseAnalytics/Frameworks -F/Users/charles/myProject/app4/platforms/ios/Pods/FirebaseInstanceID/Frameworks -F/Users/charles/myProject/app4/platforms/ios/Pods/GoogleAppMeasurement/Frameworks -FmyProject/Plugins/cordova-plugin-facebook4 -FmyProject/Plugins/cordova-plugin-firebase -FmyProject/Plugins/cordova-plugin-googleplus -filelist /Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Intermediates.noindex/myProject.build/Debug-iphoneos/myProject.build/Objects-normal/armv7/myProject.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=9.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Intermediates.noindex/myProject.build/Debug-iphoneos/myProject.build/Objects-normal/armv7/myProject_lto.o -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -ObjC -ObjC -lFirebaseAuth -lFirebaseCore -lFirebaseMessaging -lGTMSessionFetcher -lGoogleUtilities -lProtobuf -lc++ -lnanopb -lsqlite3 -lz -framework FIRAnalyticsConnector -framework FirebaseAnalytics -framework FirebaseCoreDiagnostics -framework FirebaseInstanceID -framework Foundation -framework GoogleAppMeasurement -framework SafariServices -framework Security -framework StoreKit -framework SystemConfiguration /Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/libCordova.a -weak_framework ImageIO -framework CoreLocation -framework AVFoundation -framework QuartzCore -framework Bolts -framework FBSDKCoreKit -framework FBSDKLoginKit -framework FBSDKShareKit -framework Crashlytics -framework Fabric -framework GoogleAppMeasurement -framework MeasurementNanoPB -framework FirebaseCore -framework FirebaseAnalytics -framework GoogleUtilities -framework nanopb -framework FirebaseInstanceID -framework FirebaseCoreDiagnostics -framework GTMSessionFetcher -framework FirebaseAuth -framework FirebaseMessaging -framework GoogleToolboxForMac -framework FirebasePerformance -framework Protobuf -framework FirebaseRemoteConfig -framework FirebaseABTesting -lGoogleAnalyticsServices -lAdIdAccess -framework SystemConfiguration -framework CoreData -framework AdSupport -lz -lsqlite3 -framework GoogleAppUtilities -framework GoogleAuthUtilities -framework GoogleNetworkingUtilities -framework GoogleSignIn -framework GoogleSymbolUtilities -framework GoogleUtilities -weak_framework AddressBook -weak_framework CoreText -weak_framework SafariServices -weak_framework Security -weak-lz -weak_framework WebKit -Xlinker -dependency_info -Xlinker /Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Intermediates.noindex/myProject.build/Debug-iphoneos/myProject.build/Objects-normal/armv7/myProject_dependency_info.dat -o /Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/myProject.app/myProject

ld: warning: directory not found for option '-L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/FirebaseAuth'
ld: warning: directory not found for option '-L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/FirebaseCore'
ld: warning: directory not found for option '-L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/FirebaseMessaging'
ld: warning: directory not found for option '-L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/GTMSessionFetcher'
ld: warning: directory not found for option '-L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/GoogleUtilities'
ld: warning: directory not found for option '-L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/Protobuf'
ld: warning: directory not found for option '-L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/nanopb'
ld: library not found for -lFirebaseAuth
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I precise : I am opening the .xcworkspace file.

here is my cordova plugin list

cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-crop 0.3.1 "CropPlugin"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-facebook4 4.0.0 "Facebook Connect"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-firebase 2.0.5 "Google Firebase Plugin"
cordova-plugin-firebase-authentication 1.0.1 "cordova-plugin-firebase-authentication"
cordova-plugin-firebase-messaging 1.2.1 "FirebaseMessagingPlugin"
cordova-plugin-google-analytics 1.8.6 "Google Universal Analytics Plugin"
cordova-plugin-googleplus 6.0.0 "Google SignIn"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 2.3.1 "cordova-plugin-ionic-webview"
cordova-plugin-market 1.2.0 "Market"
cordova-plugin-screen-orientation 3.0.1 "Screen Orientation"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-toast 2.7.2 "Toast"
cordova-sqlite-storage 2.6.0 "Cordova sqlite storage plugin"
cordova-support-android-plugin 1.0.1 "cordova-support-android-plugin"
cordova-support-google-services 1.2.1 "cordova-support-google-services"
es6-promise-plugin 4.2.2 "Promise"

here is my ionic info


Ionic:

   ionic (Ionic CLI)             : 4.6.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.0-rc.0
   @angular-devkit/build-angular : 0.11.4
   @angular-devkit/schematics    : 7.1.4
   @angular/cli                  : 7.1.4
   @ionic/angular-toolkit        : 1.2.2

Capacitor:

   capacitor (Capacitor CLI) : 1.0.0-beta.13
   @capacitor/core           : 1.0.0-beta.13

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.0.0, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.1, (and 18 other plugins)

System:

   ios-deploy : 2.0.0
   NodeJS     : v10.3.0 (/usr/local/Cellar/node/10.3.0/bin/node)
   npm        : 6.1.0
   OS         : macOS Mojave
   Xcode      : Xcode 9.4.1 Build version 9F2000

I would appreciate a hand with this problem.
Thanks for reading this far :slight_smile:

Edit :

after entering the following commands in platforms/ios

pod update
pod setup
pod install

this is the error i get :

Ld /Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/myProject.app/myProject normal armv7
   cd /Users/charles/myProject/app4/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 armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk -L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos -L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/FirebaseAuth -L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/FirebaseCore -L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/FirebaseMessaging -L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/GTMSessionFetcher -L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/GoogleUtilities -L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/Protobuf -L/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/nanopb -L/Users/charles/myProject/app4/platforms/ios/myProject/Plugins/cordova-plugin-google-analytics -F/Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos -F/Users/charles/myProject/app4/platforms/ios/Pods/FirebaseAnalytics/Frameworks -F/Users/charles/myProject/app4/platforms/ios/Pods/FirebaseInstanceID/Frameworks -F/Users/charles/myProject/app4/platforms/ios/Pods/GoogleAppMeasurement/Frameworks -FmyProject/Plugins/cordova-plugin-facebook4 -FmyProject/Plugins/cordova-plugin-firebase -FmyProject/Plugins/cordova-plugin-googleplus -filelist /Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Intermediates.noindex/myProject.build/Debug-iphoneos/myProject.build/Objects-normal/armv7/myProject.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=9.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Intermediates.noindex/myProject.build/Debug-iphoneos/myProject.build/Objects-normal/armv7/myProject_lto.o -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -ObjC -ObjC -lFirebaseAuth -lFirebaseCore -lFirebaseMessaging -lGTMSessionFetcher -lGoogleUtilities -lProtobuf -lc++ -lnanopb -lsqlite3 -lz -framework FIRAnalyticsConnector -framework FirebaseAnalytics -framework FirebaseCoreDiagnostics -framework FirebaseInstanceID -framework Foundation -framework GoogleAppMeasurement -framework SafariServices -framework Security -framework StoreKit -framework SystemConfiguration /Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/libCordova.a -weak_framework ImageIO -framework CoreLocation -framework AVFoundation -framework QuartzCore -framework Bolts -framework FBSDKCoreKit -framework FBSDKLoginKit -framework FBSDKShareKit -framework Crashlytics -framework Fabric -framework GoogleAppMeasurement -framework MeasurementNanoPB -framework FirebaseCore -framework FirebaseAnalytics -framework GoogleUtilities -framework nanopb -framework FirebaseInstanceID -framework FirebaseCoreDiagnostics -framework GTMSessionFetcher -framework FirebaseAuth -framework FirebaseMessaging -framework GoogleToolboxForMac -framework FirebasePerformance -framework Protobuf -framework FirebaseRemoteConfig -framework FirebaseABTesting -lGoogleAnalyticsServices -lAdIdAccess -framework SystemConfiguration -framework CoreData -framework AdSupport -lz -lsqlite3 -framework GoogleAppUtilities -framework GoogleAuthUtilities -framework GoogleNetworkingUtilities -framework GoogleSignIn -framework GoogleSymbolUtilities -framework GoogleUtilities -weak_framework AddressBook -weak_framework CoreText -weak_framework SafariServices -weak_framework Security -weak-lz -weak_framework WebKit -lPods-myProject -Xlinker -dependency_info -Xlinker /Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Intermediates.noindex/myProject.build/Debug-iphoneos/myProject.build/Objects-normal/armv7/myProject_dependency_info.dat -o /Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/myProject.app/myProject

ld: warning: Auto-Linking framework not found CoreServices
duplicate symbol _OBJC_CLASS_$_PodsDummy_nanopb in:
   /Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/nanopb/libnanopb.a(nanopb-dummy.o)
   myProject/Plugins/cordova-plugin-firebase/nanopb.framework/nanopb(nanopb-dummy.o)
[...]
duplicate symbol _OBJC_METACLASS_$_GPBInt32Value in:
   /Users/charles/Library/Developer/Xcode/DerivedData/myProject-fbvrdyyslmguorewsigbuivundlb/Build/Products/Debug-iphoneos/Protobuf/libProtobuf.a(Wrappers.pbobjc.o)
   myProject/Plugins/cordova-plugin-firebase/Protobuf.framework/Protobuf(Wrappers.pbobjc.o)
ld: 1769 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Fond the solution to my second and last problem : I had to remove the -ObjC in "other linker flags"in build settings of both Project and targets. I had a $(inherited) that I had to supress too.

Now it’s building !

Another solution to this, open “.xcworkspace” file, instead of “.xcodeproj” file.

source:
https://stackoverflow.com/questions/51020924/xcode-returns-linker-error-library-not-found-for-lfirebaseauth

2 Likes