fluttercommunity / plus_plugins

Flutter Community Plus Plugins
BSD 3-Clause "New" or "Revised" License
1.62k stars 983 forks source link

[Bug]: fatal error 'FlutterMacOS/FlutterMacOS.h' file not found - macOS / iOS #3341

Open charneykaye opened 2 weeks ago

charneykaye commented 2 weeks ago

Platform

macOS Sonoma 14.7.1 building for iOS simulator or macOS desktop

XCode

16.1

Plugin

package_info_plus

Version

8.1.0

Flutter SDK

3.5.3

Steps to reproduce

I added the package_info_plus plugin to get the build number. I can build OK for Android or Windows desktop. However, attempting to build for iOS or macOS results in these errors.

Logs

Launching lib/main.dart on macOS in debug mode...
Building macOS application...
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00006000-001851E921D2801E }
{ platform:macOS, arch:x86_64, id:00006000-001851E921D2801E }
/Users/kaye375751/om/SpaceGame/macos/Pods/Target Support Files/package_info_plus/package_info_plus-umbrella.h:13:9: error: double-quoted include "FPPPackageInfoPlusPlugin.h" in framework header, expected angle-bracketed instead
/Users/kaye375751/.pub-cache/hosted/pub.dev/package_info_plus-8.1.0/macos/package_info_plus/Sources/package_info_plus/include/package_info_plus/FPPPackageInfoPlusPlugin.h:5:9: error: 'FlutterMacOS/FlutterMacOS.h' file not found
/Users/kaye375751/om/SpaceGame/build/macos/Build/Intermediates.noindex/Pods.build/Debug/package_info_plus.build/VerifyModule/package_info_plus_objective-c++_arm64-apple-macos10.14_gnu++20/Test/Test.framework/Headers/Test.h:1:9: error: (fatal) could not build module 'package_info_plus'
/Users/kaye375751/om/SpaceGame/build/macos/Build/Intermediates.noindex/Pods.build/Debug/package_info_plus.build/VerifyModule/package_info_plus_objective-c++_arm64-apple-macos10.14_gnu++20/Test/Test.mm:1:9: error: (fatal) could not build module 'Test'
/Users/kaye375751/om/SpaceGame/build/macos/Build/Intermediates.noindex/Pods.build/Debug/package_info_plus.build/VerifyModule/package_info_plus_objective-c_arm64-apple-macos10.14_gnu17/Test/Test.framework/Headers/Test.h:1:9: error: (fatal) could not build module 'package_info_plus'
/Users/kaye375751/om/SpaceGame/build/macos/Build/Intermediates.noindex/Pods.build/Debug/package_info_plus.build/VerifyModule/package_info_plus_objective-c_arm64-apple-macos10.14_gnu17/Test/Test.m:1:9: error: (fatal) could not build module 'Test'
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Flutter Assemble' from project 'Runner')
** BUILD FAILED **

Error: Build process failed

Flutter Doctor

[✓] Flutter (Channel stable, 3.24.4, on macOS 14.7.1 23H222 darwin-arm64, locale en-US)
    • Flutter version 3.24.4 on channel stable at /Users/kaye375751/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 603104015d (11 days ago), 2024-10-24 08:01:25 -0700
    • Engine revision db49896cf2
    • Dart version 3.5.4
    • DevTools version 2.37.3

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/kaye375751/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/to/macos-android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.2)
    • 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 17.0.9+0-17.0.9b1087.7-11185874)

[✓] IntelliJ IDEA Community Edition (version 2024.2.4)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • 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

[✓] Connected device (4 available)
    • iPhone 15 Pro (mobile)          • 8FF5D617-F961-441C-8340-D28C9D933B73 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-4 (simulator)
    • macOS (desktop)                 • macos                                • darwin-arm64   • macOS 14.7.1 23H222 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS 14.7.1 23H222 darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google Chrome 130.0.6723.92

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.


### Checklist before submitting a bug

- [X] I searched issues in this repository and couldn't find such bug/problem
- [X] I Google'd a solution and I couldn't find it
- [X] I searched on StackOverflow for a solution and I couldn't find it
- [X] I read the README.md file of the plugin
- [X] I'm using the latest version of the plugin
- [X] All dependencies are up to date with `flutter pub upgrade`
- [X] I did a `flutter clean`
- [X] I tried running the example project
selimb86 commented 2 weeks ago

I am having something close to this, the app builds and runs but when trying to deploy to App Store it shows the below error on the Validate stage.

Asset validation failed Bad CFBundleExecutable. Cannot find executable file that matches the value of CFBundleExecutable in the nested bundle device_info_plus_privacy [ai.noqta.app.pkg/Payload/app.app/Contents/Frameworks/device_info_plus.framework/Versions/A/Resources/device_info_plus_privacy.bundle] property list file. (ID: a03c52ed-8d6c-4ff5-a812-3844d8ce792a)

miquelbeltran commented 2 weeks ago

The error may give some hints:

/Users/kaye375751/.pub-cache/hosted/pub.dev/package_info_plus-8.1.0/macos/package_info_plus/Sources/package_info_plus/include/package_info_plus/FPPPackageInfoPlusPlugin.h:5:9: error: 'FlutterMacOS/FlutterMacOS.h' file not found

It's weird that it cannot find that dependency. I think your pods file/folder may be in a bad state, reruning pod install and/or nucking the whole podfile.lock and folders may help too.

You can try sharing your podfile as well it may have something wrong in it.

Our CI builds correctly: https://github.com/fluttercommunity/plus_plugins/actions/runs/11562661071/job/32184333275?pr=3337

charneykaye commented 2 weeks ago

Thanks @miquelbeltran - I have tried these steps to nuke the Podfile to no avail (for the macos desktop build)

$ rm macos/Podfile
$ rm macos/Podfile.lock 
$ cd macos && pod cache clean --all && cd ..
$ flutter clean
$ flutter pub get

I will next try rebooting my laptop 🧐 and maybe setup a CI build based on that workflow you shared, to see if it has better luck.

charneykaye commented 2 weeks ago

Here's what I tried next:

  1. Create a new Flutter project with flutter create demo
  2. Build & run the new project for macOS desktop -- builds OK
  3. Add package_info_plus and use it in the app to show the version number
  4. Repeat step 2 -- fails!
  5. Create a public repository with this demo project with a GitHub actions runner trying to reproduce the failure I'm seeing locally -- builds OK

So, something is going wrong in my local environment.

Chip Memory macOS XCode
Apple M1 Pro 16 GB 14.7.1 (23H222) Xcode 16.1 Build version 16B40
Launching lib/main.dart on macOS in debug mode...
Running pod install...
Building macOS application...
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00006000-001851E921D2801E, name:My Mac }
{ platform:macOS, arch:x86_64, id:00006000-001851E921D2801E, name:My Mac }
/Users/kaye375751/om/demo/macos/Pods/Target Support Files/package_info_plus/package_info_plus-umbrella.h:13:9: error: double-quoted include "FPPPackageInfoPlusPlugin.h" in framework header, expected angle-bracketed instead
/Users/kaye375751/.pub-cache/hosted/pub.dev/package_info_plus-8.1.0/macos/package_info_plus/Sources/package_info_plus/include/package_info_plus/FPPPackageInfoPlusPlugin.h:5:9: error: 'FlutterMacOS/FlutterMacOS.h' file not found
/Users/kaye375751/om/demo/build/macos/Build/Intermediates.noindex/Pods.build/Debug/package_info_plus.build/VerifyModule/package_info_plus_objective-c++_arm64-apple-macos10.14_gnu++20/Test/Test.framework/Headers/Test.h:1:9: error: (fatal) could not build module 'package_info_plus'
/Users/kaye375751/om/demo/build/macos/Build/Intermediates.noindex/Pods.build/Debug/package_info_plus.build/VerifyModule/package_info_plus_objective-c++_arm64-apple-macos10.14_gnu++20/Test/Test.mm:1:9: error: (fatal) could not build module 'Test'
/Users/kaye375751/om/demo/build/macos/Build/Intermediates.noindex/Pods.build/Debug/package_info_plus.build/VerifyModule/package_info_plus_objective-c_arm64-apple-macos10.14_gnu17/Test/Test.framework/Headers/Test.h:1:9: error: (fatal) could not build module 'package_info_plus'
/Users/kaye375751/om/demo/build/macos/Build/Intermediates.noindex/Pods.build/Debug/package_info_plus.build/VerifyModule/package_info_plus_objective-c_arm64-apple-macos10.14_gnu17/Test/Test.m:1:9: error: (fatal) could not build module 'Test'
** BUILD FAILED **

Error: Build process failed
charneykaye commented 2 weeks ago

Posted to https://stackoverflow.com/questions/79159889/package-info-plus-error-fluttermacos-fluttermacos-h-file-not-found