Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS cocoapods fail to compile #330

Closed
tom-hartz opened this issue Mar 5, 2020 · 6 comments
Closed

iOS cocoapods fail to compile #330

tom-hartz opened this issue Mar 5, 2020 · 6 comments
Labels
build issue An issue related to build process ios relates to iOS platform support Support is being requested but not a necessarily a bug

Comments

@tom-hartz
Copy link

tom-hartz commented Mar 5, 2020

Bug report

Current behavior:

I have a broken build in my CI machine (Mac Mini, macOS = 10.14.6 , XCode = 11.0). It is failing to link the cocoapods dependencies.

build	05-Mar-2020 13:55:16	While building module 'Firebase' imported from /Users/bamboo/bamboo-agent-home/xml-data/build-dir/ILSMBL-QAD2219-BD/platforms/ios/MYPROJECT/Plugins/cordova-plugin-firebasex/FirebasePlugin.h:3:
build	05-Mar-2020 13:55:16	In file included from <module-includes>:1:
build	05-Mar-2020 13:55:16	/Users/bamboo/bamboo-agent-home/xml-data/build-dir/ILSMBL-QAD2219-BD/platforms/ios/Pods/Headers/Public/Firebase/Firebase.h:15:9: fatal error: 'FirebaseCore/FirebaseCore.h' file not found
build	05-Mar-2020 13:55:16	#import <FirebaseCore/FirebaseCore.h>
build	05-Mar-2020 13:55:16	        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build	05-Mar-2020 13:55:16	1 error generated.
build	05-Mar-2020 13:55:16	In file included from /Users/bamboo/bamboo-agent-home/xml-data/build-dir/ILSMBL-QAD2219-BD/platforms/ios/MYPROJECT/Plugins/cordova-plugin-firebasex/FirebasePlugin.m:1:
build	05-Mar-2020 13:55:16	/Users/bamboo/bamboo-agent-home/xml-data/build-dir/ILSMBL-QAD2219-BD/platforms/ios/MYPROJECT/Plugins/cordova-plugin-firebasex/FirebasePlugin.h:3:9: fatal error: could not build module 'Firebase'
build	05-Mar-2020 13:55:16	#import "Firebase.h"
build	05-Mar-2020 13:55:16	 ~~~~~~~^~~~~~~~~~~~
build	05-Mar-2020 13:55:16	2 errors generated.
build	05-Mar-2020 13:55:16	


I think I saw this error initially on my development Macbook as well, but I tried some googling/troubleshooting steps, and after deleting Xcode DerivedData/ folders it seems to be fixed on my machine (MacBook Pro, macOS = 10.14.6, XCode = 11.0). It builds successfully now on my machine everytime, but even after doing those same steps on my Mac Mini, it is still failing there consistently. 😕

I've tried everything I can think of: switching to Legacy build system, manually adding header search paths, rebuilding in Debug configuration, and even tried setting the plugin.xml use_frameworks="false". Still get this error and failure to link to the firebase headers on my build agent.


Because of this issue, I am currently using a personal fork where I reverted the plugin to use your cordova-plugin-cocoapod-supportx plugin, instead of relying on cordova-ios to manage the pods.



https://github.com/tommy-hartz/cordova-plugin-firebasex/tree/test-pod-plugin



My personal fork solves the issue and builds successfully in my CI, but it is now far behind your repo and a maintenance issue for me. I'd like to move away from this and find a better long term solution. @dpa99c do you have any ideas here?

Expected behavior:

Build should link cocoapods headers and compile successfully via command line with xcodebuild.

Steps to reproduce:

  1. include latest release of this plugin in project
  2. compile project xcworkspace via command line with xcodebuild

Screenshots

Environment information

  • Cordova CLI version

    • cordova -v
      9.0.0 (cordova-lib@9.0.1)
  • Cordova platform version

    • cordova platform ls
      Installed platforms:
      android 8.0.0
      browser 5.0.4
      ios 5.1.1
  • Plugins & versions installed in project (including this plugin)

    • cordova plugin ls
      cordova-plugin-advanced-http 2.1.1 "Advanced HTTP plugin"
      cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
      cordova-plugin-androidx-adapter 1.1.0 "cordova-plugin-androidx-adapter"
      cordova-plugin-cocoapod-supportx 1.7.3 "Cordova CocoaPods Dependency Support"
      cordova-plugin-device 2.0.2 "Device"
      cordova-plugin-email-composer 0.9.2 "EmailComposer"
      cordova-plugin-file 6.0.1 "File"
      cordova-plugin-firebasex 8.1.1 "Google Firebase Plugin"
      cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
      cordova-plugin-ionic-webview 4.1.1 "cordova-plugin-ionic-webview"
      cordova-plugin-network-information 2.0.2 "Network Information"
      cordova-plugin-secure-key-store 1.5.4 "SecureKeyStore"
      cordova-plugin-splashscreen 5.0.2 "Splashscreen"
      cordova-plugin-statusbar 2.4.2 "StatusBar"
      cordova-plugin-whitelist 1.3.3 "Whitelist"
      cordova-sqlcipher-adapter 0.4.1 "Cordova sqlcipher adapter"
      phonegap-plugin-mobile-accessibility 1.0.5-dev "Mobile Accessibility"
  • Dev machine OS and version, e.g.

    • OSX
      • sw_vers
        10.14.6

iOS build issue:

  • Node JS version
    • node -v
      v10.15.3
  • XCode version
    11.0

Console output

console output

build	05-Mar-2020 13:48:32	✔ Creating ./www directory for you - done!
build	05-Mar-2020 13:48:32	> cordova platform add ios --save

build	05-Mar-2020 13:48:56	Running command: pod install --verbose

build	05-Mar-2020 13:51:43	[!] The `MYPROJECT [Debug]` target overrides the `LD_RUNPATH_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-MYPROJECT/Pods-MYPROJECT.debug.xcconfig'. This can lead to problems with the CocoaPods installation
build	05-Mar-2020 13:51:43	
build	05-Mar-2020 13:51:43	[!] The `MYPROJECT [Release]` target overrides the `LD_RUNPATH_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-MYPROJECT/Pods-MYPROJECT.release.xcconfig'. This can lead to problems with the CocoaPods installation
build	05-Mar-2020 13:51:43	
build	05-Mar-2020 13:51:46	Adding cordova-plugin-firebasex to package.json
...
build	05-Mar-2020 13:52:09	Analyzing dependencies
build	05-Mar-2020 13:52:09	Downloading dependencies
build	05-Mar-2020 13:52:09	Generating Pods project
build	05-Mar-2020 13:52:09	Integrating client project
build	05-Mar-2020 13:52:09	Pod installation complete! There are 11 dependencies from the Podfile and 39 total pods installed.
build	05-Mar-2020 13:52:09	> ng run app:ionic-cordova-build:production --platform=ios

build	05-Mar-2020 13:54:08	> cordova build ios --release
...
build	05-Mar-2020 13:54:13	cordova-plugin-firebasex: Preparing Firebase on iOS
build	05-Mar-2020 13:54:15	No simulator found for ". Falling back to the default target.
build	05-Mar-2020 13:54:15	Building for "iPhone 11 Pro Max" Simulator (com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro-Max, iPhone-11-Pro-Max).
build	05-Mar-2020 13:54:15	Building project: /Users/bamboo/bamboo-agent-home/xml-data/build-dir/ILSMBL-QAD2219-BD/platforms/ios/MYPROJECT.xcworkspace
build	05-Mar-2020 13:54:15		Configuration: Release
build	05-Mar-2020 13:54:15		Platform: emulator
build	05-Mar-2020 13:54:15		Target: iPhone 11 Pro Max
build	05-Mar-2020 13:54:15	Running command: xcodebuild -workspace MYPROJECT.xcworkspace -scheme MYPROJECT -configuration Release -sdk iphonesimulator -destination platform=iOS Simulator,name=iPhone 11 Pro Max build CONFIGURATION_BUILD_DIR=/Users/bamboo/bamboo-agent-home/xml-data/build-dir/ILSMBL-QAD2219-BD/platforms/ios/build/emulator SHARED_PRECOMPS_DIR=/Users/bamboo/bamboo-agent-home/xml-data/build-dir/ILSMBL-QAD2219-BD/platforms/ios/build/sharedpch
...


build	05-Mar-2020 13:54:17	Build settings from command line:
build	05-Mar-2020 13:54:17	    CONFIGURATION_BUILD_DIR = /Users/bamboo/bamboo-agent-home/xml-data/build-dir/ILSMBL-QAD2219-BD/platforms/ios/build/emulator
build	05-Mar-2020 13:54:17	    SDKROOT = iphonesimulator13.0
build	05-Mar-2020 13:54:17	    SHARED_PRECOMPS_DIR = /Users/bamboo/bamboo-agent-home/xml-data/build-dir/ILSMBL-QAD2219-BD/platforms/ios/build/sharedpch
build	05-Mar-2020 13:54:17	
build	05-Mar-2020 13:54:22	note: Using new build system
build	05-Mar-2020 13:54:22	note: Planning build
build	05-Mar-2020 13:54:23	note: Constructing build description


...
build	05-Mar-2020 13:55:16	While building module 'Firebase' imported from /Users/bamboo/bamboo-agent-home/xml-data/build-dir/ILSMBL-QAD2219-BD/platforms/ios/MYPROJECT/Plugins/cordova-plugin-firebasex/FirebasePlugin.h:3:
build	05-Mar-2020 13:55:16	In file included from <module-includes>:1:
build	05-Mar-2020 13:55:16	/Users/bamboo/bamboo-agent-home/xml-data/build-dir/ILSMBL-QAD2219-BD/platforms/ios/Pods/Headers/Public/Firebase/Firebase.h:15:9: fatal error: 'FirebaseCore/FirebaseCore.h' file not found
build	05-Mar-2020 13:55:16	#import <FirebaseCore/FirebaseCore.h>
build	05-Mar-2020 13:55:16	        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build	05-Mar-2020 13:55:16	1 error generated.
build	05-Mar-2020 13:55:16	In file included from /Users/bamboo/bamboo-agent-home/xml-data/build-dir/ILSMBL-QAD2219-BD/platforms/ios/MYPROJECT/Plugins/cordova-plugin-firebasex/FirebasePlugin.m:1:
build	05-Mar-2020 13:55:16	/Users/bamboo/bamboo-agent-home/xml-data/build-dir/ILSMBL-QAD2219-BD/platforms/ios/MYPROJECT/Plugins/cordova-plugin-firebasex/FirebasePlugin.h:3:9: fatal error: could not build module 'Firebase'
build	05-Mar-2020 13:55:16	#import "Firebase.h"
build	05-Mar-2020 13:55:16	 ~~~~~~~^~~~~~~~~~~~
build	05-Mar-2020 13:55:16	2 errors generated.
build	05-Mar-2020 13:55:16	

build	05-Mar-2020 13:55:16	
error	05-Mar-2020 13:55:16	** BUILD FAILED **
error	05-Mar-2020 13:55:16	
error	05-Mar-2020 13:55:16	
error	05-Mar-2020 13:55:16	The following build commands failed:
error	05-Mar-2020 13:55:16		CompileC /Users/bamboo/Library/Developer/Xcode/DerivedData/MYPROJECT-bfzezejkntgllwhjxafgsgkjsopn/Build/Intermediates.noindex/MYPROJECT.build/Release-iphonesimulator/MYPROJECT.build/Objects-normal/x86_64/FirebasePlugin.o /Users/bamboo/bamboo-agent-home/xml-data/build-dir/ILSMBL-QAD2219-BD/platforms/ios/MYPROJECT/Plugins/cordova-plugin-firebasex/FirebasePlugin.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
error	05-Mar-2020 13:55:16	(1 failure)
error	05-Mar-2020 13:55:16	xcodebuild: Command failed with exit code 65
error	05-Mar-2020 13:55:16	[ERROR] An error occurred while running subprocess cordova.
error	05-Mar-2020 13:55:16	        
error	05-Mar-2020 13:55:16	        cordova build ios --release exited with exit code 65.



Other information:
Troubleshooting steps attempted:

  • switching to Legacy build system ❌
  • manually adding header search paths ❌
  • rebuilding in Debug configuration ❌
  • fork the plugin and set use_frameworks="false" ❌
  • fork the plugin and manage pods via cordova-plugin-cocoapod-supportx ✅
@dpa99c
Copy link
Owner

dpa99c commented Mar 5, 2020

@dpa99c dpa99c added build issue An issue related to build process ios relates to iOS platform support Support is being requested but not a necessarily a bug labels Mar 5, 2020
@tom-hartz
Copy link
Author

tom-hartz commented Mar 5, 2020

Thanks for the quick response! 👏

  • Yep, I have build hooks to perform pod repo update and pod install
        <hook src="scripts/update_pods.sh" type="before_platform_add" />
        <hook src="scripts/run_pods.sh" type="after_platform_add" />
  • following the test project build directions verbatim, getting this error:
PhaseScriptExecution [CP]\ Copy\ Pods\ Resources /Users/tom.hartz/Library/Developer/Xcode/DerivedData/FirebaseTest-apvxxgtspybxurelfylntqsyvisg/Build/Intermediates.noindex/FirebaseTest.build/Debug-iphonesimulator/FirebaseTest.build/Script-9BEF38D1E54D09D436A1E083.sh (in target 'FirebaseTest' from project 'FirebaseTest')
    cd /Users/tom.hartz/Documents/firebasex-test/cordova-plugin-firebasex-test/platforms/ios
    /bin/sh -c /Users/tom.hartz/Library/Developer/Xcode/DerivedData/FirebaseTest-apvxxgtspybxurelfylntqsyvisg/Build/Intermediates.noindex/FirebaseTest.build/Debug-iphonesimulator/FirebaseTest.build/Script-9BEF38D1E54D09D436A1E083.sh
error: Resource "/Users/tom.hartz/Library/Developer/Xcode/DerivedData/FirebaseTest-apvxxgtspybxurelfylntqsyvisg/Build/Products/Debug-iphonesimulator/FirebaseInAppMessaging/InAppMessagingDisplayResources.bundle" not found. Run 'pod install' to update the copy resources script.

** BUILD FAILED **

I tried cd platforms/ios && pod install to no avail...

  • No dice. Still getting the same results, build fails using CLI. It actually fails on my machine now as well after a hard clean.

I pinned my package.json and config.xml to "cordova-plugin-firebasex": "8.0.1"

hard clean, deleted platforms/ and plugins/

npm i
ionic cordova build ios

result:

/Users/tom.hartz/MYPROJECT/platforms/ios/MYPROJECT/Plugins/cordova-plugin-firebasex/FirebasePlugin.h:3:9: fatal error: 
      'Firebase.h' file not found
#import "Firebase.h"
        ^~~~~~~~~~~~

@dpa99c
Copy link
Owner

dpa99c commented Mar 5, 2020

Same as #326 - please see for details

@AbdullaevTimur
Copy link

AbdullaevTimur commented Mar 30, 2020

Hi. I have the same issue when try to build from XCode. And then I try use "cordova-plugin-firebasex@9.0.1-cli" version, but in this case i recive also:

"~/platforms/ios/{Project}/Plugins/cordova-plugin-firebasex/AppDelegate+FirebasePlugin.h:7:119: Cannot find protocol declaration for 'ASAuthorizationControllerPresentationContextProviding'"

@dpa99c
Copy link
Owner

dpa99c commented Mar 30, 2020

@AbdullaevTimur please try building the example project to diagnose whether it's specific to your project vs dev env.
e.g. could be caused by a conflict with another plugin.

@eliesner
Copy link

Good night people,
I found a post that there is a solution, which may work for some.
It didn't work for me.
https://stackoverflow.com/questions/57218066/build-failed-xcode-10-cordova-firebase-project/64054820#64054820

The difficult thing is that in all forums the dpa99c is putting an example project link but it seems that it is not concerned with solving the issues that are appearing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build issue An issue related to build process ios relates to iOS platform support Support is being requested but not a necessarily a bug
Projects
None yet
Development

No branches or pull requests

4 participants