Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova Can't build from CLI but build from XCode xcworkspace works perfectly

I've recently added https://github.com/chemerisuk/cordova-plugin-firebase-messaging to my cordova project which has a framework dependency on

    <framework src="Firebase/Core" type="podspec" spec="~> 5.0"/>
    <framework src="Firebase/Messaging" type="podspec" spec="~> 5.2"/>

I was originally testing code and everything on Android and it works like a charm.

However, upon switching my efforts to test my changes on iOS I quickly ran into some issues when running cordova run android or any other build commands. They tend to fail with errors alluding to CocoaPods Linking issues. Such as:

platforms/ios/Pods/FirebaseCore/Firebase/Core/FIRNetwork.m:23:9: 
    fatal error: 'GoogleToolboxForMac/GTMNSData+zlib.h' file not found
#import <GoogleToolboxForMac/GTMNSData+zlib.h>

I have found various SO posts that mention to fix the Search Paths or to modify the .m files to reference the relative paths (which is a terrible idea and far too much work).

But here's the issue, I know the project is correct. If I open my .xcworkspace and run it from XCode it works perfectly! It only has issues when running from the commandline.

Installed platforms:
android 7.1.0
ios 4.5.5

$ cordova -version
8.0.0

Xcode 9.4.1
Build version 9F2000

$ pod --version
1.5.3

I am completely at a loss. Any help would be greatly appreciated!

My Podfile in case it helps

# DO NOT MODIFY -- auto-generated by Apache Cordova
platform :ios, '8.0'
target 'VeociSTAGE' do
        project 'VeociSTAGE.xcodeproj'
        pod 'Firebase/Core', '~> 5.0'
        pod 'Firebase/Messaging', '~> 5.2'
        pod 'GoogleToolboxForMac', '~> 2.1.4'
end

EDIT:

Podfile.lock

PODS:
  - Firebase/Core (5.2.0):
    - Firebase/CoreOnly
    - FirebaseAnalytics (= 5.0.1)
  - Firebase/CoreOnly (5.2.0):
    - FirebaseCore (= 5.0.3)
  - Firebase/Messaging (5.2.0):
    - Firebase/CoreOnly
    - FirebaseMessaging (= 3.0.2)
  - FirebaseAnalytics (5.0.1):
    - FirebaseCore (~> 5.0)
    - FirebaseInstanceID (~> 3.0)
    - "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
    - nanopb (~> 0.3)
  - FirebaseCore (5.0.3):
    - "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
  - FirebaseInstanceID (3.1.0):
    - FirebaseCore (~> 5.0)
  - FirebaseMessaging (3.0.2):
    - FirebaseCore (~> 5.0)
    - FirebaseInstanceID (~> 3.0)
    - GoogleToolboxForMac/Logger (~> 2.1)
    - Protobuf (~> 3.1)
  - GoogleToolboxForMac (2.1.4):
    - GoogleToolboxForMac/Core (= 2.1.4)
    - GoogleToolboxForMac/Defines (= 2.1.4)
    - GoogleToolboxForMac/GeometryUtils (= 2.1.4)
    - GoogleToolboxForMac/KVO (= 2.1.4)
    - GoogleToolboxForMac/Logger (= 2.1.4)
    - "GoogleToolboxForMac/NSData+zlib (= 2.1.4)"
    - "GoogleToolboxForMac/NSDictionary+URLArguments (= 2.1.4)"
    - "GoogleToolboxForMac/NSFileHandle+UniqueName (= 2.1.4)"
    - "GoogleToolboxForMac/NSScanner+JSON (= 2.1.4)"
    - "GoogleToolboxForMac/NSString+HTML (= 2.1.4)"
    - "GoogleToolboxForMac/NSString+URLArguments (= 2.1.4)"
    - "GoogleToolboxForMac/NSString+XML (= 2.1.4)"
    - "GoogleToolboxForMac/NSThread+Blocks (= 2.1.4)"
    - GoogleToolboxForMac/Regex (= 2.1.4)
    - GoogleToolboxForMac/StringEncoding (= 2.1.4)
    - GoogleToolboxForMac/SystemVersion (= 2.1.4)
    - GoogleToolboxForMac/URLBuilder (= 2.1.4)
  - GoogleToolboxForMac/Core (2.1.4):
    - GoogleToolboxForMac/Defines (= 2.1.4)
  - GoogleToolboxForMac/DebugUtils (2.1.4):
    - GoogleToolboxForMac/Defines (= 2.1.4)
  - GoogleToolboxForMac/Defines (2.1.4)
  - GoogleToolboxForMac/GeometryUtils (2.1.4):
    - GoogleToolboxForMac/Defines (= 2.1.4)
  - GoogleToolboxForMac/KVO (2.1.4):
    - GoogleToolboxForMac/Core (= 2.1.4)
    - GoogleToolboxForMac/DebugUtils (= 2.1.4)
  - GoogleToolboxForMac/Logger (2.1.4):
    - GoogleToolboxForMac/Defines (= 2.1.4)
  - "GoogleToolboxForMac/NSData+zlib (2.1.4)":
    - GoogleToolboxForMac/Defines (= 2.1.4)
  - "GoogleToolboxForMac/NSDictionary+URLArguments (2.1.4)":
    - GoogleToolboxForMac/DebugUtils (= 2.1.4)
    - GoogleToolboxForMac/Defines (= 2.1.4)
    - "GoogleToolboxForMac/NSString+URLArguments (= 2.1.4)"
  - "GoogleToolboxForMac/NSFileHandle+UniqueName (2.1.4)":
    - GoogleToolboxForMac/Defines (= 2.1.4)
  - "GoogleToolboxForMac/NSScanner+JSON (2.1.4)":
    - GoogleToolboxForMac/Defines (= 2.1.4)
  - "GoogleToolboxForMac/NSString+HTML (2.1.4)":
    - GoogleToolboxForMac/Core (= 2.1.4)
  - "GoogleToolboxForMac/NSString+URLArguments (2.1.4)"
  - "GoogleToolboxForMac/NSString+XML (2.1.4)":
    - GoogleToolboxForMac/Defines (= 2.1.4)
  - "GoogleToolboxForMac/NSThread+Blocks (2.1.4)":
    - GoogleToolboxForMac/Defines (= 2.1.4)
  - GoogleToolboxForMac/Regex (2.1.4):
    - GoogleToolboxForMac/Defines (= 2.1.4)
  - GoogleToolboxForMac/StringEncoding (2.1.4):
    - GoogleToolboxForMac/Defines (= 2.1.4)
  - GoogleToolboxForMac/SystemVersion (2.1.4):
    - GoogleToolboxForMac/Defines (= 2.1.4)
  - GoogleToolboxForMac/URLBuilder (2.1.4):
    - GoogleToolboxForMac/Core (= 2.1.4)
    - GoogleToolboxForMac/Defines (= 2.1.4)
    - "GoogleToolboxForMac/NSDictionary+URLArguments (= 2.1.4)"
    - "GoogleToolboxForMac/NSString+URLArguments (= 2.1.4)"
  - nanopb (0.3.8):
    - nanopb/decode (= 0.3.8)
    - nanopb/encode (= 0.3.8)
  - nanopb/decode (0.3.8)
  - nanopb/encode (0.3.8)
  - Protobuf (3.6.0)

DEPENDENCIES:
  - Firebase/Core (~> 5.0)
  - Firebase/Messaging (~> 5.2)
  - GoogleToolboxForMac (~> 2.1.4)

SPEC REPOS:
  https://github.com/cocoapods/specs.git:
    - Firebase
    - FirebaseAnalytics
    - FirebaseCore
    - FirebaseInstanceID
    - FirebaseMessaging
    - GoogleToolboxForMac
    - nanopb
    - Protobuf

SPEC CHECKSUMS:
  Firebase: 25ed0412036d7d008568d1fb4d2e9d81ea8a0a2c
  FirebaseAnalytics: b3628aea54c50464c32c393fb2ea032566e7ecc2
  FirebaseCore: a3c87242451633fff8490183898075ce77d168d2
  FirebaseInstanceID: 05d779cbb97bd5bd5c51a38a903fc9cfe1b2454a
  FirebaseMessaging: 6894b8fe0a0cf26c3b13dad729f1131654ae0bdb
  GoogleToolboxForMac: 91c824d21e85b31c2aae9bb011c5027c9b4e738f
  nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3
  Protobuf: 0fc0ad8bec688b2a3017a139953e01374fedbd5f

PODFILE CHECKSUM: 6a610b85e4adb104d20d7784dc2566b45be5418c

COCOAPODS: 1.5.3

EDIT

Here's the interesting thing I just ran xcodebuild -workspace Project.xcworkspace -scheme Project and it built successfully. I have a feeling that cordova is targeting the .xcodeproj as opposed to .xcworkspace. More investigation to come...

EDIT It's not targeting the xcodeproj and it is targeting the xcworkspace but there seems to be an issue with the .xcconfig that is specified in platforms/ios/cordova/lib/build.js

like image 228
James Gilchrist Avatar asked Nov 08 '22 03:11

James Gilchrist


1 Answers

This is a known issue.

The problem seems to be related to cordova build command using -xcconfig flag and that flag is causing the problems for some unknown reason. It's being investigated at the moment.

like image 172
jcesarmobile Avatar answered Nov 15 '22 04:11

jcesarmobile