Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

Freeze on Linux #6

Closed
ryanheise opened this issue Sep 23, 2021 · 12 comments
Closed

Freeze on Linux #6

ryanheise opened this issue Sep 23, 2021 · 12 comments

Comments

@ryanheise
Copy link

The Flutter example produces this error on Linux:

$ cd flutter/example
$ flutter run -d linux
Launching lib/main.dart on Linux in debug mode...
libwinmedia - 0.0.2
-------------------
Building on Linux against GTK 3.0 & WebKit2 4.0
C++ Standard: 17
Enabled Dart VM NativePorts callbacks.
/home/ryan/projects/libwinmedia/flutter/example/linux/flutter/ephemeral/.plugin_symlinks/libwinmedia/.master/linux/player.hpp:12:10: fatal error: '../external/webview/webview.h' file not found
Building Linux application...
Exception: Build process failed

Do I need to copy or symlink some files into external?

@alexmercerind
Copy link
Member

Hey there! Apologies for the late reply.

You need to clone with the --recursive flag or fetch the submodules of the repositories. They are inside the external directory.

@ryanheise
Copy link
Author

Ah, thanks. This now builds, although the UI freezes the moment I click the "open" button. No error is logged.

@alexmercerind alexmercerind changed the title [Linux] '../external/webview/webview.h' File not found ~[Linux] '../external/webview/webview.h' File not found~ Freeze on Linux Sep 25, 2021
@alexmercerind alexmercerind changed the title ~[Linux] '../external/webview/webview.h' File not found~ Freeze on Linux Freeze on Linux Sep 25, 2021
@alexmercerind
Copy link
Member

alexmercerind commented Sep 25, 2021

@ryanheise I wanted to confirm few things.

  • Which distro are you on?
  • Do you have GStreamer and WebKit 2 GTK 4.0 installed?
    • sudo apt-get install libmediainfo-dev gstreamer1.0-libav libwebkit2gtk-4.0-dev.
  • If you think that this is cause of some C++ error. I can only help with a stacktrace generated using gdb.

A little "tutorial" on gdb can be:

$ gdb executable_name
$ start
$ continue (until break points keep appearing)
$ backtrace (when error occurs)

After that you'll see complete stacktrace where the error has occurred. I'd be helped by it.

I have tested it on Manjaro Linux (worked with no additional dependencies), and Ubuntu (required above command). Along Harmonoid, biyi_app is also using it.

https://github.com/biyidev/biyi_app/blob/04f24538203042aa0ba4f246a0af83e960bb0c15/pubspec.yaml#L37

Other things:

I haven't got time to test any changes from @bdlukaa & I just merged them. So, a possibility can be that something in his commits broke it, in that case you may try to git reset to some older commit (maybe c86e8b03791c78204024123cb22aff1871172cc7).

@ryanheise
Copy link
Author

I'm on arch linux.

$ pacman -Ss|egrep '(gstreamer|webkit|/gtk[0-9]\>).*installed'
extra/gstreamer 1.18.5-1 [installed]
extra/gtk2 2.24.33-2 [installed]
extra/gtk3 1:3.24.30-2 [installed]
extra/webkit2gtk 2.32.4-1 [installed]
community/gstreamermm 1.10.0-2 [installed]

Maybe the issue is that I don't have gtk 4?

@alexmercerind
Copy link
Member

I don't think it has anything to do with GTK 4.0. Since, Flutter embedding is 3.0.

@ryanheise
Copy link
Author

ryanheise commented Sep 25, 2021

Running with gdb it still just freezes without any error:

zle-line-finish:echoti:1: no such terminfo capability: rmkx
[New Thread 0x7ffff5078640 (LWP 28584)]
[New Thread 0x7ffff4877640 (LWP 28585)]
[New Thread 0x7fffed7ad640 (LWP 28587)]
[New Thread 0x7fffecf48640 (LWP 28588)]
[New Thread 0x7fffdbfff640 (LWP 28589)]
[New Thread 0x7fffdb7fe640 (LWP 28590)]
[New Thread 0x7fffdaffd640 (LWP 28591)]
[New Thread 0x7fffda7fc640 (LWP 28592)]
[New Thread 0x7fffd9ffb640 (LWP 28593)]
[New Thread 0x7fffd97fa640 (LWP 28594)]
[New Thread 0x7fffd8ff9640 (LWP 28595)]
[New Thread 0x7fffc7fff640 (LWP 28596)]
[New Thread 0x7fffe01fb640 (LWP 28597)]
[New Thread 0x7fffc757f640 (LWP 28598)]
[New Thread 0x7fffb3fff640 (LWP 28599)]
[New Thread 0x7fffb37fe640 (LWP 28600)]
[New Thread 0x7fffb29ff640 (LWP 28601)]
[New Thread 0x7fffb21fe640 (LWP 28602)]
[New Thread 0x7fffb19fd640 (LWP 28603)]
[New Thread 0x7fffb11fc640 (LWP 28604)]
[Detaching after fork from child process 28605]
[New Thread 0x7fffb09fb640 (LWP 28606)]
[New Thread 0x7fff6bffd640 (LWP 28607)]
[Thread 0x7fffb21fe640 (LWP 28602) exited]
[New Thread 0x7fffb21fe640 (LWP 28609)]
[Detaching after fork from child process 28610]
[New Thread 0x7fff6ae47640 (LWP 28611)]
[New Thread 0x7fff6a646640 (LWP 28612)]
[New Thread 0x7fff69e45640 (LWP 28613)]
[New Thread 0x7fff69644640 (LWP 28614)]
[Thread 0x7fff69e45640 (LWP 28613) exited]
[New Thread 0x7fff69e45640 (LWP 28615)]
[Thread 0x7fff69644640 (LWP 28614) exited]
[New Thread 0x7fff69644640 (LWP 28616)]
[Thread 0x7fff69e45640 (LWP 28615) exited]
[Thread 0x7fff69644640 (LWP 28616) exited]
[New Thread 0x7fff68cff640 (LWP 28636)]
[New Thread 0x7fff43fff640 (LWP 28637)]
[Thread 0x7fff6bffd640 (LWP 28607) exited]
[Thread 0x7fffb09fb640 (LWP 28606) exited]
[Thread 0x7fff68cff640 (LWP 28636) exited]
[Thread 0x7fff43fff640 (LWP 28637) exited]
[New Thread 0x7fff68cff640 (LWP 28803)]
[New Thread 0x7fff43d7f640 (LWP 28804)]

[Thread 0x7fff43d7f640 (LWP 28804) exited]
[Thread 0x7fffb21fe640 (LWP 28609) exited]
[Thread 0x7fff68cff640 (LWP 28803) exited]
^C
Thread 1 "libwinmedia_exa" received signal SIGINT, Interrupt.

The blank line is where I tried to interact with the running app and the freeze occurred. But those 3 exited threads didn't immediately exit after the freeze.

@Sotneo
Copy link
Contributor

Sotneo commented Sep 28, 2021

I get the same behavior(App Freeze) under Ubuntu after calling PlayerOpen.
Can't get any useful information from gdb. Is it even possible to do debugging with Flutter+dart:ffi+gdb?
If I build libwinmedia.so with --config Debug and target it to debug libwinmedia_example
I am getting error in gdb:

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Invalid argument(s): Failed to lookup symbol 'InitializeDartApi': /home/sot/libwinmedia/flutter/example/build/linux/x64/debug/bundle/lib/libwinmedia.so: undefined symbol: InitializeDartApi
#0      DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:34:70)
#1      LWM._InitializeDartApi_ptr (package:libwinmedia/generated/bindings.dart:32:56)
#2      LWM._InitializeDartApi_ptr (package:libwinmedia/generated/bindings.dart)
#3      LWM._InitializeDartApi (package:libwinmedia/generated/bindings.dart:34:7)
#4      LWM._InitializeDartApi (package:libwinmedia/generated/bindings.dart)
#5      LWM.InitializeDartApi (package:libwinmedia/generated/bindings.dart:25:12)
#6      LWM.initialize (package:libwinmedia/src/internal.dart:132:18)
#7      main (package:libwinmedia_example/main.dart:5:7)
#8      _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:129:25)
#9      _rootRun (dart:async/zone.dart:1428:13)
#10     _CustomZone.run (dart:async/zone.dart:1328:19)
#11     _runZoned (dart:async/zone.dart:1863:10)
#12     runZonedGuarded (dart:async/zone.dart:1851:12)
#13     _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:125:5)
#14     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19)
#15     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

@Sotneo
Copy link
Contributor

Sotneo commented Sep 28, 2021

Example is working with v0.0.4

@alexmercerind
Copy link
Member

alexmercerind commented Sep 29, 2021

Addressed by @Sotneo, a minor typo in the JavaScript that does the callback.

Since, the webview needs to wait for the page to be loaded first, after that only audio tag can be addressed. To make the API sync (i.e. object creation, Player::Open, Player::Play etc. to work on same thread), I had to add std::promise::get_future::wait call to wait for the page to be loaded.

A minor typo possibly resulted in whole JavaScript error being faulty, thus no callback made the std::promise completed.

Thanks to @Sotneo for the fix. Checkout latest commit to apply the minor change yourself.

(I'm kinda busy with the things, Harmonoid is pinned to 0.0.4 since the beginning & I didn't get time to check the PRs myself)

@bdlukaa
Copy link
Contributor

bdlukaa commented Sep 29, 2021

I'm sorry for breaking this!

@ryanheise
Copy link
Author

@bdlukaa maybe we could get the fix into just_audio_libwinmedia ?

@bdlukaa
Copy link
Contributor

bdlukaa commented Sep 30, 2021

@ryanheise according to @Sotneo it's not working on Linux even after the fix :/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants