Skip to content

'pb_encode.h' and 'pb_decode.h' Not Found When Using Firebase #329

@kroikie

Description

@kroikie

Whenever I try 'flutter run' on a project with anything Firebase-related as a dependency, I get an error saying I'm missing 'pb_encode.h' or 'pb_decode.h', and I'm not sure how to fix this.

Steps to Reproduce

A repo to the code can be found here :https://github.com/sunny-kim-92/flutter_firebase_pb_encode. But it's exactly the same as the default starter project while following the 'Firebase for Flutter' Codelab to step 4: https://codelabs.developers.google.com/codelabs/flutter-firebase/#3. I've encountered this error every time I've tried to add anything Firebase-related (including firebase_auth and firebase_core) as a dependency, including in other tutorials.

Logs

                    CompileC
                    /Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.b
                    uild/Objects-normal/x86_64/pb_decode.o nanopb/pb_decode.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
                        cd /Users/home/Code/flutters/baby_names/ios/Pods
                        export LANG=en_US.US-ASCII
                        export
                        PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/
                        bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/home/Code/flutter/flutter/bin"
                        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch x86_64 -fmessage-length=0
                        -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu11 -fmodules -gmodules
                        -fmodules-cache-path=/Users/home/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600
                        -fbuild-session-file=/Users/home/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation
                        -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module
                        -fmodule-name=nanopb -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type
                        -Wdocumentation -Wunreachable-code -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch
                        -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized
                        -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion
                        -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof
                        -DPOD_CONFIGURATION_DEBUG=1 -DDEBUG=1 -DCOCOAPODS=1 -DPOD_CONFIGURATION_DEBUG=1 -DDEBUG=1 -DPB_FIELD_32BIT=1 -DPB_NO_PACKED_STRUCTS=1
                        -DPB_ENABLE_MALLOC=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk
                        -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -mios-simulator-version-min=8.0 -g -Wno-sign-conversion -Winfinite-recursion -Wcomma
                        -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -Wunguarded-availability -iquote
                        /Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nano
                        pb.build/nanopb-generated-files.hmap
                        -I/Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/na
                        nopb.build/nanopb-own-target-headers.hmap
                        -I/Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/na
                        nopb.build/nanopb-all-non-framework-target-headers.hmap -ivfsoverlay
                        /Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/all-product-headers.yaml
                        -iquote
                        /Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nano
                        pb.build/nanopb-project-headers.hmap -I/Users/home/Code/flutters/baby_names/build/ios/Debug-iphonesimulator/nanopb/include
                        -I/Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/na
                        nopb.build/DerivedSources-normal/x86_64
                        -I/Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/na
                        nopb.build/DerivedSources/x86_64
                        -I/Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/na
                        nopb.build/DerivedSources -F/Users/home/Code/flutters/baby_names/build/ios/Debug-iphonesimulator/nanopb -fno-objc-arc -fno-objc-arc -include
                        /Users/home/Code/flutters/baby_names/ios/Pods/Target\ Support\ Files/nanopb/nanopb-prefix.pch -MMD -MT dependencies -MF
                        /Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nano
                        pb.build/Objects-normal/x86_64/pb_decode.d --serialize-diagnostics
                        /Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nano
                        pb.build/Objects-normal/x86_64/pb_decode.dia -c /Users/home/Code/flutters/baby_names/ios/Pods/nanopb/pb_decode.c -o
                        /Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nano
                        pb.build/Objects-normal/x86_64/pb_decode.o
                    /Users/home/Code/flutters/baby_names/ios/Pods/nanopb/pb_decode.c:17:10: fatal error: 'pb_decode.h' file not found
                    #include "pb_decode.h"
                             ^~~~~~~~~~~~~

                    CompileC
                    /Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nanopb.b
                    uild/Objects-normal/x86_64/pb_encode.o nanopb/pb_encode.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
                        cd /Users/home/Code/flutters/baby_names/ios/Pods
                        export LANG=en_US.US-ASCII
                        export
                        PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/
                        bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/Code/flutter/flutter/bin"
                        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch x86_64 -fmessage-length=0
                        -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu11 -fmodules -gmodules
                        -fmodules-cache-path=/Users/home/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600
                        -fbuild-session-file=/Users/home/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation
                        -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module
                        -fmodule-name=nanopb -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type
                        -Wdocumentation -Wunreachable-code -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch
                        -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized
                        -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion
                        -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof
                        -DPOD_CONFIGURATION_DEBUG=1 -DDEBUG=1 -DCOCOAPODS=1 -DPOD_CONFIGURATION_DEBUG=1 -DDEBUG=1 -DPB_FIELD_32BIT=1 -DPB_NO_PACKED_STRUCTS=1
                        -DPB_ENABLE_MALLOC=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.4.sdk
                        -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -mios-simulator-version-min=8.0 -g -Wno-sign-conversion -Winfinite-recursion -Wcomma
                        -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -Wunguarded-availability -iquote
                        /Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nano
                        pb.build/nanopb-generated-files.hmap
                        -I/Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/na
                        nopb.build/nanopb-own-target-headers.hmap
                        -I/Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/na
                        nopb.build/nanopb-all-non-framework-target-headers.hmap -ivfsoverlay
                        /Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/all-product-headers.yaml
                        -iquote
                        /Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nano
                        pb.build/nanopb-project-headers.hmap -I/Users/home/Code/flutters/baby_names/build/ios/Debug-iphonesimulator/nanopb/include
                        -I/Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/na
                        nopb.build/DerivedSources-normal/x86_64
                        -I/Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/na
                        nopb.build/DerivedSources/x86_64
                        -I/Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/na
                        nopb.build/DerivedSources -F/Users/home/Code/flutters/baby_names/build/ios/Debug-iphonesimulator/nanopb -fno-objc-arc -fno-objc-arc -include
                        /Users/home/Code/flutters/baby_names/ios/Pods/Target\ Support\ Files/nanopb/nanopb-prefix.pch -MMD -MT dependencies -MF
                        /Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nano
                        pb.build/Objects-normal/x86_64/pb_encode.d --serialize-diagnostics
                        /Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nano
                        pb.build/Objects-normal/x86_64/pb_encode.dia -c /Users/home/Code/flutters/baby_names/ios/Pods/nanopb/pb_encode.c -o
                        /Users/home/Library/Developer/Xcode/DerivedData/Runner-eewkthfbitvfthecrdxuppfmqydd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/nano
                        pb.build/Objects-normal/x86_64/pb_encode.o
                    /Users/home/Code/flutters/baby_names/ios/Pods/nanopb/pb_encode.c:7:10: fatal error: 'pb_encode.h' file not found
                    #include "pb_encode.h"
                             ^~~~~~~~~~~~~
                    1 error generated.
[ +133 ms] Could not build the application for the simulator.
[   +6 ms] Error launching application on iPhone Xʀ.
[   +6 ms] "flutter run" took 41,107ms.

#0      throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:477:7)
<asynchronous suspension>
#2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:490:18)
#3      _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#4      _rootRunUnary (dart:async/zone.dart:1132:38)
#5      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#6      _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#7      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#8      Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#9      Future._completeWithValue (dart:async/future_impl.dart:522:5)
#10     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:30:15)
#11     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:288:13)
#12     RunCommand.usageValues (package:flutter_tools/src/commands/run.dart)
#13     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#14     _rootRunUnary (dart:async/zone.dart:1132:38)
#15     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#16     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#17     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#18     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#19     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#20     Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:552:7)
#21     _rootRun (dart:async/zone.dart:1124:13)
#22     _CustomZone.run (dart:async/zone.dart:1021:19)
#23     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#24     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#25     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#26     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#27     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13)
#28     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173:5)
[✓] Flutter (Channel stable, v1.9.1+hotfix.2, on Mac OS X 10.14.4 18E226, locale en-US)
    • Flutter version 1.9.1+hotfix.2 at /Users/home/Code/flutter/flutter
    • Framework revision 2d2a1ffec9 (2 weeks ago), 2019-09-06 18:39:49 -0700
    • Engine revision b863200c37
    • Dart version 2.5.0


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/home/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.3, Build version 10G8
    • CocoaPods version 1.7.5

[✓] Android Studio (version 3.4)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 39.0.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[✓] VS Code (version 1.38.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.4.1

[✓] Connected device (1 available)
    • iPhone Xʀ • 69C0122D-2C83-4928-A5B2-B023F107FC65 • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-4 (simulator)

I've tried manually adding pb_encode.h and pb_decode.h, and reinstalling Cocoapods because I noticed 'Running pod install' took unusually long. I changed the build system to legacy. When I complete further steps in the Codelabs tutorial, including creating a Firebase project and adding the google-json.plist, I get the same error.

One thing that may be a factor is I don't have a provisioning profile for iOS development, because I don't have an iPhone available to register as my device. I apologize if I'm way off the mark, I'm not familiar with nanopd and am relatively new to Flutter. But projects without Firebase work without issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions