go-flutter-desktop / go-flutter

Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.
https://hover.build/
BSD 3-Clause "New" or "Revised" License
5.84k stars 286 forks source link

Flutter engine build failed for 3.0 #653

Closed niuhuan closed 2 years ago

niuhuan commented 2 years ago

https://github.com/go-flutter-desktop/engine-builds/runs/6481818948?check_suite_focus=true

niuhuan commented 2 years ago

Hover build not working for 3.0 because engine not release.

hover run had crash for 3.0 on my macmini (m1).

2022/05/18 11:51:48 PlatformError: Cocoa: Failed to find service port for display GLFW: An uncaught error has occurred: VersionUnavailable: NSGL: Failed to create OpenGL context GLFW: Please report this bug in the Go package immediately. 2022/05/18 11:51:49 PlatformError: Cocoa: Failed to find service port for display

pchampio commented 2 years ago

Does it work for other flutter version?

niuhuan commented 2 years ago

Does it work for other flutter version?

Using 3.0 is I want, not a must.

such ........

I am both use go-flutter and build go lib with go-mobile call with method channel .

I making a comic application, Some ios users prefer high frequency screen refresh, must use flutter 3. They waited for more days.

At this point I find some problems, Before building the desktop side, I need to set the dependency version equal to a certain version. The mobile side needs to be larger than this version. Otherwise they don't work.

If I want use flutter 2.10.x , must modify

  flutter_styled_toast: ^2.0.0
  another_xlider: ^1.0.1+2

to

  flutter_styled_toast: 2.0.0
  another_xlider: 1.0.1+2

then run pub get.

This will cumbersome us.

This is not a fatal problem for me, but is it better to be compatible with 3.0?

Go-flutter will support flutter 3 in the future? And have any probable?

pchampio commented 2 years ago

I want to know if this issue is due to the flutter 3, or the M1 mac, or something else.

The error reported here (copied below) is about GLFW, not the engine.

2022/05/18 11:51:48 PlatformError: Cocoa: Failed to find service port for display
GLFW: An uncaught error has occurred: VersionUnavailable: NSGL: Failed to create OpenGL context
GLFW: Please report this bug in the Go package immediately.
2022/05/18 11:51:49 PlatformError: Cocoa: Failed to find service port for display

The go-flutter-desktop/engine-builds affect hover build (release mode), not hover run (debug mode).
@jslater89 was the one to work on engine-builds, I actually don't know how to fix it.

Another question, are you running your MacOS in a virtualization environment ?

niuhuan commented 2 years ago

I want to know if this issue is due to the flutter 3, or the M1 mac, or something else.

Yeah, is a true machine.

hover run got "Failed to create OpenGL context" only in flutter 3 , not in flutter 2.10.x.

And "flutter run" works correctly (flutter 3)

I haven't tested on windows or Linux yet. Wait some minute

niuhuan commented 2 years ago

windows hover run with flutter 3

hover: Successfully compiled executable binary for windows
hover: Build finished, starting app...
hover: Running test in debug_unopt mode
hover: App 'test' exited with error: exit status 0xc0000005

linux hover run with flutter 3

hover: Successfully compiled executable binary for linux
hover: Build finished, starting app...
hover: Running test in debug_unopt mode
hover: App 'test' exited with error: signal: segmentation fault (core dumped)

Maybe the official interface has changed.

pchampio commented 2 years ago

I'll investigate this after my vacation. Thanks for the logs!

jslater89 commented 2 years ago

I did a little bit of work on trying to fix the engine build last week. It seems to be a missing-dependency problem, but I couldn't track down why it wasn't getting pulled.

zhuewizz commented 2 years ago

I also have this problem in win11 and flutter3.0 run ---hover run
hover: Successfully compiled executable binary for windows hover: Build finished, starting app... hover: Running msmk01 in debug_unopt mode hover: App 'msmk01' exited with error: exit status 0xc0000005

zhuewizz commented 2 years ago

today we flutter upgrade to flutter 3.0.2 hover run: D:\flutter-projrct\flutter-go\msmk01>hover run hover: Downloading engine for platform windows-debug_unopt at version f15f824b57476e369b5e656f53d4c431c5b04b9a... Download completed in 25.92s Download completed in 13.48s hover: Cleaning the build directory hover: ⚠ The go-flutter project tries to stay compatible with the beta channel of Flutter. hover: ⚠ It's advised to use the beta channel: flutter channel beta hover: Bundling flutter app Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source! Downloading windows-x64/font-subset tools... 1,384ms Running "flutter pub get" in msmk01... 316ms

Building with sound null safety

hover: Compiling 'go-flutter' and plugins hover: Successfully compiled executable binary for windows hover: Build finished, starting app... hover: Running msmk01 in debug_unopt mode hover: App 'msmk01' exited with error: exit status 0xc0000005

niuhuan commented 2 years ago

@zhuewizz

I think it's because of using old flutter engine

I am waiting for go-flutter engine to build recovery https://github.com/go-flutter-desktop/engine-builds

It is difficult to download the source code of flutter engine in Chinese mainland, I don't know how to set proxy in gclient.

bltavares commented 2 years ago

Hello there. I'm investigating the origin of the error, and I found that the opengl warning is actually a misleading error.

A fix has been proposed for the warning itself to avoid clutter the investigation around the Flutter 3.0 bump.

A second error that is misleading is the engine-builds CI error. The artifacts of those projects are only used on --release and --profile builds, while the official FlutterEmbedder.framework (for Mac hosts) is used for --debug builds. Another PR has been proposed to recover the CI build of those artifacts.

So far I’ve been able to pinpoint the segfault on hover when it initializes the engine crossing the Go/C bridge - and I’ve not been able yet to get a coredump.

It’s likely something has changed on the c engine that needs an update on the bridge during init. My next step will be to investigate if there were API changes on the flutter header files that need to be included on the embedder_proxy.go file.

bltavares commented 2 years ago

I've been able to get hover running once again after [updating the header files to match the Flutter 3.0 ABI]

Adding the following line to go.mod on your project, then running go mod download should unblock your project while the fix is merged.

# go.mod
replace github.com/go-flutter-desktop/go-flutter => github.com/bltavares/go-flutter fix-flutter-3-0
provokateurin commented 2 years ago

Awesome work @bltavares !

jslater89 commented 2 years ago

I'll take a look at the PR tonight and get it merged.

Thanks for submitting it!

jslater89 commented 2 years ago

Linux and MacOS builds seem to be back. The switches.cc patch failed on Windows; I'll dig into that tonight.

pchampio commented 2 years ago

Fixed in https://github.com/go-flutter-desktop/engine-builds/pull/5 by Ink-33

niuhuan commented 2 years ago

happy