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

Recreate Podfile to start fix macOS build. #64

Merged
merged 13 commits into from
May 9, 2022
Merged

Conversation

Jonas-Sander
Copy link
Collaborator

Building macOS on main resulted in the following error

[!] No podspec found for `path_provider` in `Flutter/ephemeral/.symlinks/plugins/path_provider/macos`

This seems to come from an old macOS Podfile. When Flutter creates a new Podfile many lines of code are not existing that we had in the Podfile in main.

With this PR I:

  • Created a new Podfile by deleting the old one and letting Flutter create a new version (by running flutter pub get).
  • Add the build time fix for Firestore.
  • Update Firestore dependency (old version threw an error when running pod install)

With these fixes I can now build the macOS version again on my MacBook.

Copy link
Member

@nilsreichardt nilsreichardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not able to build for macOS from this branch:

2021-12-05 21:26:48.934 xcodebuild[53479:6180733]  DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-19450/DTDeviceKitBase/DTDKRemoteDeviceData.m:373
Details:  (null) deviceType from 00008110-00043848366A801E was NULL when -platform called.
Object:   <DTDKMobileDeviceToken: 0x7f7a0e754df0>
Method:   -platform
Thread:   <NSThread: 0x6000004b7a40>{number = 2, name = (null)}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:x86_64, id:8A753909-8D24-51E5-B3BB-8190B9B7B920 }
{ platform:macOS, name:Any Mac }
/Users/nils/.pub-cache/hosted/pub.dartlang.org/sign_in_with_apple-2.5.4/macos/Classes/SignInWithAppleError.swift:26:6: error: enum cases with associated values cannot be marked potentially unavailable with '@available'
    @available(iOS 13.0, macOS 10.15, *)
     ^
/Users/nils/.pub-cache/hosted/pub.dartlang.org/sign_in_with_apple-2.5.4/macos/Classes/SignInWithAppleError.swift:30:6: error: enum cases with associated values cannot be marked potentially unavailable with '@available'
    @available(iOS 13.0, macOS 10.15, *)
     ^

/Users/nils/.pub-cache/hosted/pub.dartlang.org/sign_in_with_apple-2.5.4/macos/Classes/SignInWithAppleError.swift:36:6: error: enum cases with associated values cannot be marked potentially unavailable with '@available'
    @available(iOS 13.0, macOS 10.15, *)
/Users/nils/.pub-cache/hosted/pub.dartlang.org/sign_in_with_apple-2.5.4/macos/Classes/SignInWithAppleError.swift:82:13: warning: switch must be exhaustive
            switch code {
            ^
/Users/nils/.pub-cache/hosted/pub.dartlang.org/sign_in_with_apple-2.5.4/macos/Classes/SignInWithAppleError.swift:82:13: note: do you want to add missing cases?
            switch code {

            ^
Command CompileSwiftSources failed with a nonzero exit code
Command CompileSwiftSources failed with a nonzero exit code
Command CompileSwiftSources failed with a nonzero exit code
Command CompileSwiftSources failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in parallel
/Users/nils/Desktop/Projects/sharezone/sharezone-app/app/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.6, but the range of supported deployment target versions is 10.9 to 12.0.99. (in target 'FMDB' from project 'Pods')
** BUILD FAILED **

When I add this lines in the macos/Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_macos_build_settings(target)
    target.build_configurations.each do |bc|
      bc.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.14'
    end
  end
end

I'm getting a different error:

--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:x86_64, id:8A753909-8D24-51E5-B3BB-8190B9B7B920 }
{ platform:macOS, name:Any Mac }
/Users/nils/.pub-cache/hosted/pub.dartlang.org/sign_in_with_apple-2.5.4/macos/Classes/SignInWithAppleError.swift:26:6: error: enum cases with associated values cannot be marked potentially unavailable with '@available'
    @available(iOS 13.0, macOS 10.15, *)
     ^
/Users/nils/.pub-cache/hosted/pub.dartlang.org/sign_in_with_apple-2.5.4/macos/Classes/SignInWithAppleError.swift:30:6: error: enum cases with associated values cannot be marked potentially unavailable with '@available'
    @available(iOS 13.0, macOS 10.15, *)
     ^
/Users/nils/.pub-cache/hosted/pub.dartlang.org/sign_in_with_apple-2.5.4/macos/Classes/SignInWithAppleError.swift:36:6: error: enum cases with associated values cannot be marked potentially unavailable with '@available'
    @available(iOS 13.0, macOS 10.15, *)
     ^
/Users/nils/.pub-cache/hosted/pub.dartlang.org/sign_in_with_apple-2.5.4/macos/Classes/SignInWithAppleError.swift:42:6: error: enum cases with associated values cannot be marked potentially unavailable with '@available'
/Users/nils/.pub-cache/hosted/pub.dartlang.org/sign_in_with_apple-2.5.4/macos/Classes/SignInWithAppleError.swift:82:13: warning: switch must be exhaustive
            switch code {
            ^

/Users/nils/.pub-cache/hosted/pub.dartlang.org/sign_in_with_apple-2.5.4/macos/Classes/SignInWithAppleError.swift:82:13: note: do you want to add missing cases?
            switch code {
            ^

Command CompileSwiftSources failed with a nonzero exit code
Command CompileSwiftSources failed with a nonzero exit code
Command CompileSwiftSources failed with a nonzero exit code
Command CompileSwiftSources failed with a nonzero exit code
Command CompileSwiftSources failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in parallel
** BUILD FAILED **

Exception: Build process failed

I had a slimier issue with the fix-ios-build. An upgrade to the newest sign_in_with_apple fixed it for me. But I think I will come into another error loop, similar to iOS, where I need to upgrade other packages. So I think I will continue the work on the fix-ios-build branch (upgrading the packages) and then try again to build for macOS.

Copy link
Member

@nilsreichardt nilsreichardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

After merging main into this branch, it's working again for me :)

@Jonas-Sander
Copy link
Collaborator Author

@nilsreichardt Can you check again if it works for you? I updated the podfile.lock

Right now I get this error: firebase/flutterfire#7558 btw just out of nowhere... If it works for you then you can merge this PR.

@nilsreichardt
Copy link
Member

@nilsreichardt Can you check again if it works for you? I updated the podfile.lock

Right now I get this error: FirebaseExtended/flutterfire#7558 btw just out of nowhere... If it works for you then you can merge this PR.

I tried it but, got an error with sign_in_with_apple package. Need to investigate in the next days, to find out more information.

@github-actions
Copy link

github-actions bot commented Apr 23, 2022

Visit the preview URL for this PR (updated for commit 720dc5f):

https://sharezone-test--pr64-fix-macos-build-dk3v9218.web.app

(expires Mon, 16 May 2022 14:47:13 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@nilsreichardt nilsreichardt self-assigned this Apr 23, 2022
@nilsreichardt
Copy link
Member

For it's working again 👍

But the macoOS instantly crashes after opening:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRESTORE INTERNAL ASSERTION FAILED: Failed to open DB: Internal: Failed to open LevelDB database at /Users/nils/Library/Containers/de.codingbrain.sharezone.app/Data/Library/Application Support/firestore/__FIRAPP_DEFAULT/sharezone-c2bd8/main: LevelDB error: IO error: lock /Users/nils/Library/Containers/de.codingbrain.sharezone.app/Data/Library/Application Support/firestore/__FIRAPP_DEFAULT/sharezone-c2bd8/main/LOCK: Resource temporarily unavailable (expected created.ok())'

Reading through firebase/firebase-ios-sdk#5423 I think this is an issue with M1. I would suggest fixing in another PR (I would try to update all of our Firebase Packages).

@Jonas-Sander Can you try, if you can build for macOS with Intel?

@Jonas-Sander
Copy link
Collaborator Author

For it's working again 👍

But the macoOS instantly crashes after opening:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRESTORE INTERNAL ASSERTION FAILED: Failed to open DB: Internal: Failed to open LevelDB database at /Users/nils/Library/Containers/de.codingbrain.sharezone.app/Data/Library/Application Support/firestore/__FIRAPP_DEFAULT/sharezone-c2bd8/main: LevelDB error: IO error: lock /Users/nils/Library/Containers/de.codingbrain.sharezone.app/Data/Library/Application Support/firestore/__FIRAPP_DEFAULT/sharezone-c2bd8/main/LOCK: Resource temporarily unavailable (expected created.ok())'

Reading through firebase/firebase-ios-sdk#5423 I think this is an issue with M1. I would suggest fixing in another PR (I would try to update all of our Firebase Packages).

@Jonas-Sander Can you try, if you can build for macOS with Intel?

It builds, the application Sharezone app window shows up but the app itself is not shown. The window content stays gray though. Additionally the "Building macOS application...." dialog in VS Code never disappears.

I get these logs:

First try

(112) embedder.cc (1506): 'FlutterEngineSendPointerEvent' returned 'kInvalidArguments'. Engine handle was invalid.
embedder.cc (1506): 'FlutterEngineSendPointerEvent' returned 'kInvalidArguments'. Engine handle was invalid.
embedder.cc (1593): 'FlutterEngineSendKeyEvent' returned 'kInvalidArguments'. Engine handle was invalid.
embedder.cc (1684): 'FlutterPlatformMessageCreateResponseHandle' returned 'kInvalidArguments'. Engine handle was invalid.
2022-04-24 15:28:14.930 Sharezone[11752:136643] Failed to create a FlutterPlatformMessageResponseHandle (2)
embedder.cc (1593): 'FlutterEngineSendKeyEvent' returned 'kInvalidArguments'. Engine handle was invalid.
embedder.cc (1684): 'FlutterPlatformMessageCreateResponseHandle' returned 'kInvalidArguments'. Engine handle was invalid.
2022-04-24 15:28:15.089 Sharezone[11752:136643] Failed to create a FlutterPlatformMessageResponseHandle (2)

Second try

2022-04-24 15:29:45.721 Sharezone[13279:144393] [Firebase/Crashlytics] Version 8.9.0
2022-04-24 15:29:45.735 Sharezone[13279:144393] Failed to find path for "flutter_assets"
2022-04-24 15:29:45.736 Sharezone[13279:144393] Failed to find path for "flutter_assets"
embedder.cc (912): 'FlutterEngineInitialize' returned 'kInvalidArguments'. The assets path in the Flutter project arguments was missing.
2022-04-24 15:29:45.736 Sharezone[13279:144393] Failed to initialize Flutter engine: error 2
2022-04-24 15:29:45.785 Sharezone[13279:144393] Der Vorgang konnte nicht abgeschlossen werden. (OSStatus-Fehler 13.)

@Jonas-Sander Jonas-Sander changed the title Update macOS Podfile to fix macOS build. Recreate Podfile to start fix macOS build. Apr 24, 2022
@Jonas-Sander
Copy link
Collaborator Author

Jonas-Sander commented Apr 24, 2022

@nilsreichardt Look at the test action failing. Something is not right with the firebase dependencies even inside Flutter/Dart I guess?
(Also happens for me locally)

Comment on lines 19 to 21
sdk: flutter
firebase_crashlytics: ^2.0.7
firebase_crashlytics: ^2.5.1

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is not compatible with our Flutter version?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's looks like that. I needed to upgrade firebase_crashlytics, because they fixed in 2.5.1 a macOS bug. Should I open a new PR where we upgrade to the latest Flutter version (if possible)?

@MatthewCoetzee
Copy link

We are also facing this same issue. We are running a Firebase App and users apps are crashing in our latest iOS release.
Here are the logs from the Firebase Crashlytics:

Fatal Exception: NSInternalInconsistencyException FIRESTORE INTERNAL ASSERTION FAILED: Failed to open DB: Internal: Failed to mark persistence directory as excluded from backups: You can’t save the file “main” because the volume “Data” is out of space. (errno 28: No space left on device) (expected created.ok())

Did updating the firebase_crashlytics to ^2.5.1 fix the issue?

@nilsreichardt
Copy link
Member

@MatthewCoetzee No, at the moment couldn't solve the issue yet 😞 My plan is to first merge this PR (scope of this PR to get our macOS app building again without build errors) and then I want to try to fix this issue in a different PR the Firestore issue.

@MatthewCoetzee
Copy link

@nilsreichardt Awesome! 👍

@nilsreichardt
Copy link
Member

@MatthewCoetzee I just saw that we have two different issues with Firestore (see error message). My issue just gone by running flutter clean.

@Jonas-Sander So my previous comment is out to date. I can build for macOS and use the app (no instant crash) 👍

@Jonas-Sander
Copy link
Collaborator Author

Jonas-Sander commented Apr 24, 2022

@MatthewCoetzee I just saw that we have two different issues with Firestore (see error message). My issue just gone by running flutter clean.

@Jonas-Sander So my previous comment is out to date. I can build for macOS and use the app (no instant crash) 👍

So you don't face the same problem as me?

Does flutter test throw errors for you locally?

@MatthewCoetzee
Copy link

@MatthewCoetzee I just saw that we have two different issues with Firestore (see error message). My issue just gone by running flutter clean.

@Jonas-Sander So my previous comment is out to date. I can build for macOS and use the app (no instant crash) 👍

Our app is in production. Is it possible that the released version was built with an outdated library?

@nilsreichardt
Copy link
Member

nilsreichardt commented May 9, 2022

@Jonas-Sander After merging #153 this branch now passes the CI :) I think we can merge this branch

@Jonas-Sander
Copy link
Collaborator Author

Somehow I still had the same errors when building again but after trying it more times time it worked.... Idk 🤷‍♂️.
Gonna merge this.

@Jonas-Sander Jonas-Sander merged commit 99e84a6 into main May 9, 2022
@Jonas-Sander Jonas-Sander deleted the fix-macos-build branch May 9, 2022 16:10
@nilsreichardt
Copy link
Member

Maybe I will get the same error when continue working on #162. Let's see

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

3 participants