marchellodev / sharik

Sharik is an open-source, cross-platform solution for sharing files via Wi-Fi or Mobile Hotspot
MIT License
1.16k stars 103 forks source link

The app fails to launch with nvidia's closed source driver #26

Closed pitsi closed 3 years ago

pitsi commented 3 years ago

So, I discovered sharik today and I decided to give it a try. I first installed it on my android phone via the play store and then on my linux system with the provided deb package. But when I ran it on my pc, this showed up in the terminal

$ sharik 
GLFW: An invalid error was not accepted by the caller: FormatUnavailable: EGL: Failed to find a suitable EGLConfig
GLFW: Please report this bug in the Go package immediately.
panic: FormatUnavailable: EGL: Failed to find a suitable EGLConfig

goroutine 1 [running, locked to thread]:
github.com/go-gl/glfw/v3.3/glfw.acceptError(0xc0000cfb28, 0x2, 0x2, 0x0, 0x0)
    /go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20200707082815-5321531c36a2/error.go:178 +0x201
github.com/go-gl/glfw/v3.3/glfw.CreateWindow(0x1b8, 0x2a8, 0x9934b7, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0)
    /go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20200707082815-5321531c36a2/window.go:350 +0x1c1
github.com/go-flutter-desktop/go-flutter.(*Application).Run(0xc0000f0000, 0x0, 0x0)
    /go/pkg/mod/github.com/go-flutter-desktop/go-flutter@v0.41.2/application.go:148 +0x165
github.com/go-flutter-desktop/go-flutter.Run(0xc0000c6a10, 0x9, 0xe, 0x7, 0xc0000cff40)
    /go/pkg/mod/github.com/go-flutter-desktop/go-flutter@v0.41.2/application.go:26 +0x4d
main.main()
    /app/go/cmd/main.go:25 +0x188

Obviously I am missing something and that is not only the go language, which comes with the (meta)package golang, but what is it? If it helps, this is the version debian testing/unstable provides

$ go version
go version go1.15.6 linux/amd64
marchellodev commented 3 years ago

Does your linux distro have a desktop environment?

pitsi commented 3 years ago

Of course :) Plain openbox running under xorg with the nvidia 340 legacy driver. Please do not tell me it's the egl thing... I have seen a similar prompt when I tried to run a terminal emulator that for some reason needed the driver to support opengl newer than a version.

marchellodev commented 3 years ago

Can you please try appimage or snap and see if they work?

pitsi commented 3 years ago

Sure, I will try the appimage (because I really hate snaps) in the following days. I also tried the static binary (the one that comes in a zip), and the same things come up. I have also asked a friend who is more more experienced for any idea, but nothing yet.

---edit Same thing with appimage.

$ ./sharik_v2.5_linux.AppImage 
GLFW: An invalid error was not accepted by the caller: FormatUnavailable: EGL: Failed to find a suitable EGLConfig
GLFW: Please report this bug in the Go package immediately.
panic: FormatUnavailable: EGL: Failed to find a suitable EGLConfig

goroutine 1 [running, locked to thread]:
github.com/go-gl/glfw/v3.3/glfw.acceptError(0xc0000f1b28, 0x2, 0x2, 0x0, 0x0)
    /go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20200707082815-5321531c36a2/error.go:178 +0x201
github.com/go-gl/glfw/v3.3/glfw.CreateWindow(0x1b8, 0x2a8, 0x9934b7, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0)
    /go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20200707082815-5321531c36a2/window.go:350 +0x1c1
github.com/go-flutter-desktop/go-flutter.(*Application).Run(0xc000106000, 0x0, 0x0)
    /go/pkg/mod/github.com/go-flutter-desktop/go-flutter@v0.41.2/application.go:148 +0x165
github.com/go-flutter-desktop/go-flutter.Run(0xc0000e6a10, 0x9, 0xe, 0x7, 0xc0000f1f40)
    /go/pkg/mod/github.com/go-flutter-desktop/go-flutter@v0.41.2/application.go:26 +0x4d
main.main()
    /app/go/cmd/main.go:25 +0x188
marchellodev commented 3 years ago

That is really weird. However, I plan on building build the next version of Sharik using Flutter's official desktop implementation. Hope it will fix this issue.

I am not sure how to fix this, maybe it has something to do with version of your OS? I had some issues with that before (#6), you can try running this version instead

https://github.com/marchellodev/sharik/releases/download/v2.2/sharik_v2.2_linux4.AppImage

It was built on older version of Ubuntu

marchellodev commented 3 years ago

Oh, by the way, it has nothing to do with your version of Golang, since it is already compiled to the native code

pitsi commented 3 years ago

As it seems, the problem is not related to go at all, because I get the same errors even with go removed! It seems to be related to some opengl version that depends on the xorg driver and/or the hw... Thus, I will change the title once I find what is the real cause

So, my friend tested it on his old laptop and got the same error. That laptop runs on debian unstable + xorg + xfce and its intel gpu supports opengl up to 2.1 (as he says). As a workaround, he lauched sharik with env LIBGL_ALWAYS_SOFTWARE=true sharik that forces software rendering for app, and it launched as it should! He then tried it on a (vmware) virtual machine with debian unstable + wayland + gnome and it worked with no issues!

As for me, I am still trying to understand what version of opengl I can really run. This is the output of glxinfo | grep OpenGL from my system https://paste.debian.net/1182038/

Brb, I am trying that old appimage...

---edit That one segfaults instantly :D

$ ./sharik_v2.2_linux4.AppImage 
Segmentation fault

I will try some other ones.

---re-edit I tried them all! Excluding 2.2 that segfaults, I get the same error as above for 2.1, 2.3 and 2.4. On 2.0 there are some extra bits, but still no luck

$ ./sharik_v2_linux.AppImage 
GLFW: An invalid error was not accepted by the caller: FormatUnavailable: EGL: Failed to find a suitable EGLConfig
GLFW: Please report this bug in the Go package immediately.
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x7f96372d0480 pc=0x7f96372d0480]

runtime stack:
runtime.throw(0x699bdf, 0x2a)
    /usr/local/go/src/runtime/panic.go:774 +0x72
runtime.sigpanic()
    /usr/local/go/src/runtime/signal_unix.go:378 +0x47c

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x5de620, 0xc0000bf978, 0x0)
    /usr/local/go/src/runtime/cgocall.go:128 +0x5b fp=0xc0000bf948 sp=0xc0000bf910 pc=0x42742b
github.com/go-gl/glfw/v3.2/glfw._Cfunc_glfwTerminate()
    _cgo_gotypes.go:1990 +0x41 fp=0xc0000bf978 sp=0xc0000bf948 pc=0x54a0b1
github.com/go-gl/glfw/v3.2/glfw.Terminate()
    /home/markon/go/pkg/mod/github.com/go-gl/glfw@v0.0.0-20200222043503-6f7a984d4dc4/v3.2/glfw/glfw.go:50 +0x25 fp=0xc0000bf988 sp=0xc0000bf978 pc=0x54bbe5
runtime.call32(0x0, 0x69d210, 0x0, 0x0)
    /usr/local/go/src/runtime/asm_amd64.s:539 +0x3b fp=0xc0000bf9b8 sp=0xc0000bf988 pc=0x47b15b
panic(0x643d00, 0xc000088280)
    /usr/local/go/src/runtime/panic.go:679 +0x1b2 fp=0xc0000bfa48 sp=0xc0000bf9b8 pc=0x4508b2
github.com/go-gl/glfw/v3.2/glfw.acceptError(0xc000044b10, 0x2, 0x2, 0x0, 0x0)
    /home/markon/go/pkg/mod/github.com/go-gl/glfw@v0.0.0-20200222043503-6f7a984d4dc4/v3.2/glfw/error.go:178 +0x201 fp=0xc0000bfae0 sp=0xc0000bfa48 pc=0x54ba91
github.com/go-gl/glfw/v3.2/glfw.CreateWindow(0x1a4, 0x280, 0x68a271, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/markon/go/pkg/mod/github.com/go-gl/glfw@v0.0.0-20200222043503-6f7a984d4dc4/v3.2/glfw/window.go:289 +0x1c1 fp=0xc0000bfb80 sp=0xc0000bfae0 pc=0x54d591
github.com/go-flutter-desktop/go-flutter.(*Application).Run(0xc0000b0000, 0x0, 0x0)
    /home/markon/go/pkg/mod/github.com/go-flutter-desktop/go-flutter@v0.35.3/application.go:131 +0x12b fp=0xc0000bfe98 sp=0xc0000bfb80 pc=0x5731db
github.com/go-flutter-desktop/go-flutter.Run(0xc0000ae000, 0x9, 0xe, 0x7, 0xc000044f40)
    /home/markon/go/pkg/mod/github.com/go-flutter-desktop/go-flutter@v0.35.3/application.go:27 +0x4d fp=0xc0000bfec8 sp=0xc0000bfe98 pc=0x572a0d
main.main()
    /home/markon/Desktop/marchello/new/sharik/go/cmd/main.go:24 +0x188 fp=0xc0000bff60 sp=0xc0000bfec8 pc=0x5ce488
runtime.main()
    /usr/local/go/src/runtime/proc.go:203 +0x21e fp=0xc0000bffe0 sp=0xc0000bff60 pc=0x45270e
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc0000bffe8 sp=0xc0000bffe0 pc=0x47ce71
marchellodev commented 3 years ago

lol this is really weird

marchellodev commented 3 years ago

I am going to compile Sharik using Flutter's official desktop embedding system. Most of the functions will not work (I have not migrated them yet), but at least we will be able to check whether it launches :)

marchellodev commented 3 years ago

Can you please check if this build will work? https://drive.google.com/file/d/1YWW5z2ZRybKZWpKo5BrtX4vVkiN0gaKk/view?usp=sharing

Also, can you please send me your neofetch output so that I can try to recreate the issue?

pitsi commented 3 years ago
$ neofetch 
       _,met$$$$$gg.          x@x
    ,g$$$$$$$$$$$$$$$P.       ---------- 
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux bullseye/sid x86_64 
 ,$$P'              `$$$.     Model: P35-DS3R 
',$$P       ,ggs.     `$$b:   Kernel: 5.10.0-1-amd64 
`d$$'     ,$P"'   .    $$$    Uptime: 6 mins 
 $$P      d$'     ,    $$P    Packages: 1284 (dpkg) 
 $$:      $$.   -    ,d$$'    Shell: bash 5.1.4 
 $$;      Y$b._   _,d$P'      Resolution: 1280x1024 
 Y$$.    `.`"Y$$$$P"'         DE: lightdm-xsession 
 `$$b      "-.__              WM: Openbox 
  `Y$$                        WM Theme: Numix 
   `Y$$.                      Theme: Numix [GTK2/3] 
     `$$b.                    Icons: Numix [GTK2/3] 
       `Y$$b.                 Terminal: urxvt 
          `"Y$b._             CPU: Intel Core 2 Duo E4500 (2) @ 2.200GHz 
              `"""            GPU: NVIDIA GeForce 210 
                              Memory: 806MiB / 3931MiB 

There you go.

As for the build, it just opens a blank/transparent 1280*720 window that gets "garbled" when i move it around and these show up in the terminal

$ ./sharik 

** (sharik:2920): WARNING **: 16:31:55.296: Failed to start Flutter renderer: Failed to create EGL contexts using configuration (EGL_CONFIG_ID=7 EGL_BUFFER_SIZE=32 EGL_COLOR_BUFFER_TYPE=EGL_RGB_BUFFER EGL_TRANSPARENT_TYPE=EGL_NONE EGL_LEVEL=0 EGL_RED_SIZE=8 EGL_GREEN_SIZE=8 EGL_BLUE_SIZE=8 EGL_ALPHA_SIZE=8 EGL_DEPTH_SIZE=0 EGL_STENCIL_SIZE=0 EGL_SAMPLES=0 EGL_SAMPLE_BUFFERS=0 EGL_NATIVE_VISUAL_ID=0x2c EGL_NATIVE_VISUAL_TYPE=0x8002 EGL_NATIVE_RENDERABLE=EGL_FALSE EGL_CONFIG_CAVEAT=EGL_NONE EGL_BIND_TO_TEXTURE_RGB=EGL_FALSE EGL_BIND_TO_TEXTURE_RGBA=EGL_FALSE EGL_RENDERABLE_TYPE=EGL_OPENGL_ES_BIT|EGL_OPENGL_ES2_BIT|EGL_OPENGL_ES3_BIT EGL_CONFORMANT=EGL_OPENGL_ES_BIT|EGL_OPENGL_ES2_BIT|EGL_OPENGL_ES3_BIT EGL_SURFACE_TYPE=EGL_PBUFFER_BIT|EGL_PIXMAP_BIT|EGL_WINDOW_BIT|0xc00 EGL_MAX_PBUFFER_WIDTH=8192 EGL_MAX_PBUFFER_HEIGHT=8192 EGL_MAX_PBUFFER_PIXELS=67108864 EGL_MIN_SWAP_INTERVAL=0 EGL_MAX_SWAP_INTERVAL=200): Bad Allocation

It works with no workarounds at my friend's laptop, the one with intel gpu. If this is an issue that only affects my system, we can leave it and I will accept my "fate". I also have windows (7) on the same system, so maybe I will be able to use sharik there. Problem is i rarely use windows nowadays.

marchellodev commented 3 years ago

No this a really curious case. I am going to try to recreate the same system in vmware and see if it will face the same error.

Thank you for your feedback!

pitsi commented 3 years ago

There was a thought that nvidia's driver is causing all that issue, so I wanted to check how it behaves with nouveau. I tried booting to partedmagic's live enviroment and it failed, so I could not test it. I have no other live cd isos right now so as to test.

On the other hand, my friend says he is certain that the nvidia driver is to blame, and showed me these as proof https://github.com/flutter/flutter/issues/59738 https://github.com/flutter/flutter/issues/59960

I think you should stop trying to troubleshoot it and just accept it won't work. Just mention it in the main page, change the title of this report to something appropriate, e.g. "Issues with flutter and the nvidia driver", and close it. Your call. I have just accepted my "fate".

pitsi commented 3 years ago

I tried it on a vm with kde neon (kernel 5.4, mesa 20.0, vmware's gpu) and it worked as it was supposed to. So it is definitely the nvidia driver that is causing the issue, for me at least. I am changing the title to something relevant. Feel free to close this anytime you want.

pitsi commented 3 years ago

I am... torturing myself with nouveau since yesterday, trying to pin down a hw issue that was caused by a recent kernel update here in debian, so I decided to retry sharik. And it lauches (and works) perfectly under nouveau, so nvidia's drive is definitely to blame. Now that I found the reason behind all that, allow me to close that issue. Thank you for your interest.

pitsi commented 3 years ago

Same behavior with sharik 3.0, but with different output in the terminal.

$ ./sharik_v3.0_linux.AppImage 
[FATAL:flutter/shell/gpu/gpu_surface_gl_delegate.cc(50)] Check failed: gl_version_string. The GL proc resolver's glGetString(GL_VERSION) failed
Aborted
marchellodev commented 3 years ago

Yeah, I also couldn't launch Sharik on the discrete nvidia GPU. I believe flutter apps do not yet work with nvidia