Skip to content

πŸ› [firebase_messaging] iOS build error - fatal error: could not build module 'nanopb' #3840

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

Closed
seanmc86 opened this issue Oct 11, 2020 · 28 comments Β· Fixed by #4012
Closed
Labels
impact: crowd Affects many people, though not necessarily a specific customer with an assigned label. (P2) platform: ios Issues / PRs which are specifically for iOS. plugin: messaging type: bug Something isn't working

Comments

@seanmc86
Copy link

seanmc86 commented Oct 11, 2020

Bug report

Describe the bug
Using the latest firebase_messaging (7.0.3) in my Flutter project. On building:

Failed to build iOS app

Error output from Xcode build:
↳
** BUILD FAILED **

Xcode's output:
↳
While building module 'nanopb' imported from /Users/sean/Projects/drag_test/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from :1:
/Users/sean/Projects/drag_test/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:13:9: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb.h"
^~~~~~
<pb.h>
/Users/sean/Projects/drag_test/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:14:9: error: double-quoted include "pb_common.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb_common.h"
^~~~~~~~~~~~~
<pb_common.h>
While building module 'nanopb' imported from /Users/sean/Projects/drag_test/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from :1:
In file included from /Users/sean/Projects/drag_test/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:14:
/Users/sean/Projects/drag_test/ios/Pods/nanopb/pb_common.h:8:10: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#include "pb.h"
^~~~~~
<pb.h>
While building module 'nanopb' imported from /Users/sean/Projects/drag_test/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from :1:
/Users/sean/Projects/drag_test/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:15:9: error: double-quoted include "pb_decode.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb_decode.h"
^~~~~~~~~~~~~
<pb_decode.h>
While building module 'nanopb' imported from /Users/sean/Projects/drag_test/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from :1:
In file included from /Users/sean/Projects/drag_test/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:15:
/Users/sean/Projects/drag_test/ios/Pods/nanopb/pb_decode.h:9:10: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#include "pb.h"
^~~~~~
<pb.h>
While building module 'nanopb' imported from /Users/sean/Projects/drag_test/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from :1:
/Users/sean/Projects/drag_test/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:16:9: error: double-quoted include "pb_encode.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb_encode.h"
^~~~~~~~~~~~~
<pb_encode.h>
While building module 'nanopb' imported from /Users/sean/Projects/drag_test/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from :1:
In file included from /Users/sean/Projects/drag_test/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:16:
/Users/sean/Projects/drag_test/ios/Pods/nanopb/pb_encode.h:9:10: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#include "pb.h"
^~~~~~
<pb.h>
While building module 'nanopb' imported from /Users/sean/Projects/drag_test/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from :1:
/Users/sean/Projects/drag_test/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:17:9: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb.h"
^~~~~~
<pb.h>
/Users/sean/Projects/drag_test/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:18:9: error: double-quoted include "pb_decode.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb_decode.h"
^~~~~~~~~~~~~
<pb_decode.h>
/Users/sean/Projects/drag_test/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:19:9: error: double-quoted include "pb_common.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb_common.h"
^~~~~~~~~~~~~
<pb_common.h>
/Users/sean/Projects/drag_test/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:20:9: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb.h"
^~~~~~
<pb.h>
/Users/sean/Projects/drag_test/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:21:9: error: double-quoted include "pb_encode.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb_encode.h"
^~~~~~~~~~~~~
<pb_encode.h>
/Users/sean/Projects/drag_test/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:22:9: error: double-quoted include "pb_common.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]
#import "pb_common.h"
^~~~~~~~~~~~~
<pb_common.h>
13 errors generated.
In file included from /Users/sean/Projects/drag_test/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.c:20:
/Users/sean/Projects/drag_test/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:10: fatal error: could not build module 'nanopb'
#include <nanopb/pb.h>
~~~~~~~~^
14 errors generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description

Could not build the application for the simulator.

Steps to reproduce

Steps to reproduce the behavior:

  1. Add firebase_messaging: 7.0.3 to pubspec.yaml
  2. Add the following to the main.dart file prior to runApp:
    await Firebase.initializeApp();
  3. Build yields the above error

Upon inspecting the files mentioned in the error, many imports have been duplicated.


Additional context

Tried the following:

  1. Clean Xcode derived data, flutter clean & remove pods & podfile.lock
  2. Delete iOS folder entirely
  3. Try earlier firebase_messaging versions such as 7.0.0.

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel stable, 1.22.1, on Mac OS X 10.15.7 19H2, locale en-GB)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[βœ“] Xcode - develop for iOS and macOS (Xcode 12.0.1)
[βœ“] Android Studio (version 4.0)
[βœ“] IntelliJ IDEA Community Edition (version 2020.2.3)
[βœ“] VS Code (version 1.50.0)
[βœ“] Connected device (1 available)

β€’ No issues found!

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand
Dart SDK 2.10.1
Flutter SDK 1.22.1
drag_test 1.0.0+1

dependencies:
- cupertino_icons 1.0.0
- firebase_messaging 7.0.3 [meta flutter firebase_core]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]

dev dependencies:
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]

transitive dependencies:
- async 2.5.0-nullsafety.1 [collection]
- boolean_selector 2.1.0-nullsafety.1 [source_span string_scanner]
- characters 1.1.0-nullsafety.3
- charcode 1.2.0-nullsafety.1
- clock 1.1.0-nullsafety.1
- collection 1.15.0-nullsafety.3
- fake_async 1.2.0-nullsafety.1 [clock collection]
- firebase 7.3.0 [http http_parser js]
- firebase_core 0.5.0+1 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
- firebase_core_platform_interface 2.0.0 [flutter meta plugin_platform_interface quiver]
- firebase_core_web 0.2.0 [firebase firebase_core_platform_interface flutter flutter_web_plugins meta js]
- flutter_web_plugins 0.0.0 [flutter characters collection meta typed_data vector_math]
- http 0.12.2 [http_parser path pedantic]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- js 0.6.2
- matcher 0.12.10-nullsafety.1 [stack_trace]
- meta 1.3.0-nullsafety.3
- path 1.8.0-nullsafety.1
- pedantic 1.9.2 [meta]
- plugin_platform_interface 1.0.3 [meta]
- quiver 2.1.3 [matcher meta]
- sky_engine 0.0.99
- source_span 1.8.0-nullsafety.2 [charcode collection path term_glyph]
- stack_trace 1.10.0-nullsafety.1 [path]
- stream_channel 2.1.0-nullsafety.1 [async]
- string_scanner 1.1.0-nullsafety.1 [charcode source_span]
- term_glyph 1.2.0-nullsafety.1
- test_api 0.2.19-nullsafety.2 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- typed_data 1.3.0-nullsafety.3 [collection]
- vector_math 2.1.0-nullsafety.3

@seanmc86 seanmc86 added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Oct 11, 2020
@long1eu
Copy link
Contributor

long1eu commented Oct 11, 2020

I also saw this in my ci jobs.

@marcotammaro
Copy link

I have the same problem

@leonalonso
Copy link

Same problem

@nhat108
Copy link

nhat108 commented Oct 11, 2020

please help

@ivanbandura
Copy link

help

@Dreako
Copy link

Dreako commented Oct 11, 2020

got same error, i tried deleting podfile then recreate, same output error

@Octet83
Copy link

Octet83 commented Oct 12, 2020

Hello, same error here, podfile cleared, flutter clean... already tried

@codjias
Copy link

codjias commented Oct 12, 2020

Same issue for both Firebase/Firestore and Firebase/Messaging from a clean install and after following to the 'T' the iOS app wizard from the Firebase console.

@ZZBHuang
Copy link

I update my cocoapods version to 1.10.0.rc.1 to solve this issue.

@marcotammaro
Copy link

marcotammaro commented Oct 12, 2020

I update my cocoapods version to 1.10.0.rc.1 to solve this issue.

It works, thanks.
(in order to install the 1.10.0.rc.1 version you can run: sudo gem install cocoapods --pre)

@krille-chan
Copy link

I update my cocoapods version to 1.10.0.rc.1 to solve this issue.

That does not help for me. :-( Still the same problem.

@LSambo02
Copy link
Contributor

LSambo02 commented Oct 12, 2020

I update my cocoapods version to 1.10.0.rc.1 to solve this issue.

That does not help for me. :-( Still the same problem.

After running the update command I ran flutter clean as well and worked

Steps to go through:

  1. sudo gem install cocoapods --pre
  2. flutter clean
  3. build/run project

@krille-chan
Copy link

I update my cocoapods version to 1.10.0.rc.1 to solve this issue.

That does not help for me. :-( Still the same problem.

After running the update command I ran flutter clean as well and worked

Steps to go through:

1. `sudo gem install cocoapods --pre`

2. `flutter clean`

3. build/run project

Still not working for me. :-( I can now build the app in xcode but when I try to run it with flutter drive it has the same errors.

@LSambo02
Copy link
Contributor

LSambo02 commented Oct 12, 2020

It's not the same issue but the solution for this #3272 might help

@leonalonso
Copy link

I update my cocoapods version to 1.10.0.rc.1 to solve this issue.

That does not help for me. :-( Still the same problem.

After running the update command I ran flutter clean as well and worked
Steps to go through:

1. `sudo gem install cocoapods --pre`

2. `flutter clean`

3. build/run project

Still not working for me. :-( I can now build the app in xcode but when I try to run it with flutter drive it has the same errors.

Also for me the same, I have one folder with integrated Firebase and the other without.
The one without works perfectly, the other with the integration always gives me error.
It is not possible to continue.

@JtheSaw
Copy link

JtheSaw commented Oct 12, 2020

Hi this solution helped me.

I also found out that I was using Xcode's Legacy build system. Which I changed to the recommended one.
File -> Workspace Settings -> Build System -> New Build System (Default)

Hope this helps.

@dackers86
Copy link
Member

Closing as solutions provided

@KholofeloMoyaba
Copy link

KholofeloMoyaba commented Oct 15, 2020

If running this in CI/CD pipeline, you might need to manually force the correct version of cocoapods. I'm using AppCenter and added the below code to the post-clone script (ios/appcenter-post-clone.sh).
I do this before installing flutter:

See below a sample ios/appcenter-post-clone.sh:

#!/usr/bin/env bash

# fail if any command fails
set -e
# debug log
set -x

cd ..

# https://github.com/FirebaseExtended/flutterfire/issues/3840
# https://stackoverflow.com/questions/60749496/flutter-ios-build-on-the-app-center-fails-with-error-invalid-podfile-file-gen
# TODO: remove this once issue is fixed with cocoapods 
echo "Re-install coacoa pods with version 1.10.0.rc.1"
sudo gem uninstall cocoapods --all --executables
sudo gem install cocoapods --pre
echo "Done re-installing coacoa pods with version 1.10.0.rc.1"


# install flutter
git clone -b 1.22.1 https://github.com/flutter/flutter.git
export PATH=`pwd`/flutter/bin:$PATH

flutter channel stable
flutter doctor

echo "Installed flutter to `pwd`/flutter"

flutter build ios --release --no-codesign

Hopefully, there will soon be a non-pre version for coacoapods that will solve this issue.

Inspired by below:
https://stackoverflow.com/questions/60749496/flutter-ios-build-on-the-app-center-fails-with-error-invalid-podfile-file-gen

I update my cocoapods version to 1.10.0.rc.1 to solve this issue.

@julrach
Copy link

julrach commented Oct 19, 2020

Closing as solutions provided

^ solutions provided but still outstanding issue.

can we reopen this? im still getting this error and currently using bitrise for my ci tool

@JtheSaw
Copy link

JtheSaw commented Oct 20, 2020

I have faced the same issue using fastlane. My script is doing a flutter clean before each build and it seems like flutter clean is resetting the value of Quoted Include In Framework Header to YES again. Also I think after each build the setting is also back at YES.

As I am building with fastlane locally on my machine I had the chance to set the value to NO manually before the build process which is obviously not the sense of CI but maybe a workaround until this is truly fixed.

Maybe you can include something in your script to overwrite the environment variable from CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES to CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO in the Pods project file. Make sure that it is the Pods project file and not the Runner project.

Hope this works for you.

@julrach
Copy link

julrach commented Oct 20, 2020

I have faced the same issue using fastlane. My script is doing a flutter clean before each build and it seems like flutter clean is resetting the value of Quoted Include In Framework Header to YES again. Also I think after each build the setting is also back at YES.

As I am building with fastlane locally on my machine I had the chance to set the value to NO manually before the build process which is obviously not the sense of CI but maybe a workaround until this is truly fixed.

Maybe you can include something in your script to overwrite the environment variable from CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES to CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO in the Pods project file. Make sure that it is the Pods project file and not the Runner project.

Hope this works for you.

Amazing, this worked @JtheSaw. Now I guess we just wait for an actual stable fix but for now, this works! Cheers!

@Sockerjam
Copy link

I have faced the same issue using fastlane. My script is doing a flutter clean before each build and it seems like flutter clean is resetting the value of Quoted Include In Framework Header to YES again. Also I think after each build the setting is also back at YES.

As I am building with fastlane locally on my machine I had the chance to set the value to NO manually before the build process which is obviously not the sense of CI but maybe a workaround until this is truly fixed.

Maybe you can include something in your script to overwrite the environment variable from CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES to CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO in the Pods project file. Make sure that it is the Pods project file and not the Runner project.

Hope this works for you.

Damn, thank you. Was trying to make it work for ages by deleting the workspace file, pod folder, etc and re-installing without luck.

@julrach
Copy link

julrach commented Oct 20, 2020

Closing as solutions provided

Can you reopen this @dackers86? Although there are workarounds, the real issue isn't stably resolved yet.

@stepanzalis
Copy link

@julrach Have the same issue, can you please provide more info how did you fix that with the script? πŸ™

@julrach
Copy link

julrach commented Oct 20, 2020

@julrach Have the same issue, can you please provide more info how did you fix that with the script? πŸ™

@stepanzalis Here is what I added into my Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      # workaround until the following issue is resolved: https://github.com/FirebaseExtended/flutterfire/issues/3840
      config.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] = 'NO'
    end
  end
end

@dackers86 dackers86 reopened this Oct 21, 2020
@TahaTesser TahaTesser added plugin: messaging impact: crowd Affects many people, though not necessarily a specific customer with an assigned label. (P2) platform: ios Issues / PRs which are specifically for iOS. and removed Needs Attention This issue needs maintainer attention. labels Oct 21, 2020
@TahaTesser
Copy link

TahaTesser commented Oct 21, 2020

I can confirm pod version 1.10.0.rc.1 has no issues on iOS 14

logs
[βœ“] Flutter (Channel master, 1.24.0-2.0.pre.98, on Mac OS X 10.15.7 19H2
    darwin-x64, locale en-GB)
    β€’ Flutter version 1.24.0-2.0.pre.98 at /Users/tahatesser/Code/flutter_master
    β€’ Framework revision a4ac7cce82 (8 hours ago), 2020-10-21 00:46:59 -0400
    β€’ Engine revision c2c74ed708
    β€’ Dart version 2.11.0 (build 2.11.0-240.0.dev)

[βœ“] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    β€’ Android SDK at /Users/tahatesser/Code/sdk
    β€’ Platform android-30, build-tools 30.0.2
    β€’ ANDROID_HOME = /Users/tahatesser/Code/sdk
    β€’ Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    β€’ Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)
    β€’ All Android licenses accepted.

[βœ“] Xcode - develop for iOS and macOS (Xcode 12.1)
    β€’ Xcode at /Applications/Xcode.app/Contents/Developer
    β€’ Xcode 12.1, Build version 12A7403
    β€’ CocoaPods version 1.10.0.rc.1

[βœ“] Chrome - develop for the web
    β€’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[βœ“] Android Studio (version 4.1)
    β€’ Android Studio at /Applications/Android Studio.app/Contents
    β€’ Flutter plugin can be installed from:
      πŸ”¨ https://plugins.jetbrains.com/plugin/9212-flutter
    β€’ Dart plugin can be installed from:
      πŸ”¨ https://plugins.jetbrains.com/plugin/6351-dart
    β€’ Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)

[βœ“] VS Code (version 1.50.1)
    β€’ VS Code at /Applications/Visual Studio Code.app/Contents
    β€’ Flutter extension version 3.15.1

[βœ“] Connected device (5 available)
    β€’ RMX2001 (mobile)       β€’ EUYTFEUSQSRGDA6D          β€’ android-arm64  β€’
      Android 10 (API 29)
    β€’ Taha’s iPhone (mobile) β€’ 00008020-001059882212002E β€’ ios            β€’ iOS
      14.1
    β€’ macOS (desktop)        β€’ macos                     β€’ darwin-x64     β€’ Mac
      OS X 10.15.7 19H2 darwin-x64
    β€’ Web Server (web)       β€’ web-server                β€’ web-javascript β€’
      Flutter Tools
    β€’ Chrome (web)           β€’ chrome                    β€’ web-javascript β€’
      Google Chrome 86.0.4240.80

β€’ No issues found!

@bawantha
Copy link

bawantha commented Nov 2, 2020

I have faced the same issue using fastlane. My script is doing a flutter clean before each build and it seems like flutter clean is resetting the value of Quoted Include In Framework Header to YES again. Also I think after each build the setting is also back at YES.

As I am building with fastlane locally on my machine I had the chance to set the value to NO manually before the build process which is obviously not the sense of CI but maybe a workaround until this is truly fixed.

Maybe you can include something in your script to overwrite the environment variable from CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES to CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO in the Pods project file. Make sure that it is the Pods project file and not the Runner project.

Hope this works for you.

littery dont understand what you are saying

@PeterPaulez
Copy link

I update my cocoapods version to 1.10.0.rc.1 to solve this issue.

That does not help for me. :-( Still the same problem.

After running the update command I ran flutter clean as well and worked

Steps to go through:

  1. sudo gem install cocoapods --pre
  2. flutter clean
  3. build/run project

Thanks so much!!! I did it and everything works fine!

@firebase firebase locked and limited conversation to collaborators Dec 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
impact: crowd Affects many people, though not necessarily a specific customer with an assigned label. (P2) platform: ios Issues / PRs which are specifically for iOS. plugin: messaging type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.