cordova-ios: cocoapods cordova build ios fails with linker issues (works pefectly in Xcode UI)

I have been debugging and investigating this issue for almost three days. I am at my wits end and hopefully I have enough information now so you can give me an appropriate answer or we can identify an actual.

First and foremost, I started with SO to do a bunch of research before I came here and posted my own question: https://stackoverflow.com/questions/51772407/cordova-cant-build-from-cli-but-build-from-xcode-xcworkspace-works-perfectly

Here’s what I’m finding:

cordova build ios fails with the following

/Users/jpgilchrist/Development/github/soschat/soschat-mobile-3.0/VeociSTAGE/platforms/ios/Pods/FirebaseCore/Firebase/Core/FIRNetwork.m:23:9: fatal error: 
      'GoogleToolboxForMac/GTMNSData+zlib.h' file not found
#import <GoogleToolboxForMac/GTMNSData+zlib.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
** BUILD FAILED **


The following build commands failed:
	CompileC /Users/jpgilchrist/Library/Developer/Xcode/DerivedData/VeociSTAGE-awzedsneagcsyzbvjuozwzgwilon/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FirebaseCore.build/Objects-normal/x86_64/FIRNetwork.o FirebaseCore/Firebase/Core/FIRNetwork.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler

However, if you actually open the .xcworkspace and then build/run from Xcode it works perfectly! This got me to thinking and a started down a deep rabbit hole. Eventually I tried xcodebuild -workspace VeociSTAGE.xcworkspace -scheme VeociSTAGE and it worked there as well!

This started me down a very deep rabbit hole learning way more about the innards of the cordova build process then I really needed to know (but, hey knowledge is knowledge and I’m happy I know it now).

I found platforms/ios/cordova/Api.js and eventually the xcodebuildArgs and I deduced that a custom xcconfig is being used and I have no idea what in the xcconfig is causing it, but running it with the xcconfig causes my issues. Without it builds.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 24 (12 by maintainers)

Commits related to this issue

Most upvoted comments

@erisu looks like your PR was merged 👍

I’ve confirmed this fixes the problem for me as well. It’s merged to master, but not 4.5.x branch. Do we know what the release schedule is for the next ios platform version? If 4.5.6 - I think this should be merged to that branch also. If 4.6 with a new branch from master, then it will be included without additional merging.

In the meantime:

  • I’ve downloaded the raw file as ios-updated-build.js in root of my project
  • verified it’s the only diff from the current default 4.5.5 ios version
  • added a resource-file line to my config.xml under ios platform and that’s got my local project building again
<platform name="ios">
     <resource-file src="ios-updated-build.js" target="../../cordova/lib/build.js" />
     ...

https://github.com/apache/cordova-ios/pull/398 has been released in cordova-ios@5.0.0.

@jpgilchrist I just submitted a PR but will finalize tomorrow.

What I mean by removing, as I said previously, I only commented out the xcconfig option that is declared in the build.js

You can see the changes here: https://github.com/apache/cordova-ios/pull/398

Confirmed it with plugin cordova-plugin-firebase-messaging:

/Users/shaz/Desktop/foo/platforms/ios/Pods/FirebaseCore/Firebase/Core/FIRLogger.m:18:9: fatal error:
      'GoogleUtilities/GULAppEnvironmentUtil.h' file not found
#import <GoogleUtilities/GULAppEnvironmentUtil.h>

Doesn’t build with cordova build but builds properly with the workspace.

Hello I am using cordova-plugin-firebase-dynamiclinks. During the build process, I ran into the problem described in this issue. After fix build.js build was success. But If I run application via dynamic link I get error. Please see image below

2018-11-14 21 25 08

Perhaps error is related to this issue

@shazron sorry I was on vacation. So what is the recommended course of action? Is it safe to build w/o the xcconfig defined in Cordova? Or will there be issues with that? I really can’t afford to build/export this thing manually from xcode each time.