bdlukaa / just_audio_libwinmedia

Libwinmedia implementation of just_audio.
MIT License
11 stars 8 forks source link

Build on linux fails with missing dependency #4

Open baudren opened 2 years ago

baudren commented 2 years ago

Hello,

I'm trying to run the simple example from the just_audio package on Linux (POP OS 20.04). My pubspec.yaml contains:

  just_audio: ^0.9.15
  just_audio_libwinmedia: ^0.0.4

But when I run, I get the following error:

Building Linux application...
libwinmedia - 0.0.3
-------------------
Building on Linux against GTK 3.0 & WebKit2 4.0
C++ Standard: 17
CMake Error at /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:463 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:643 (_pkg_check_modules_internal)
  flutter/ephemeral/.plugin_symlinks/libwinmedia/master/CMakeLists.txt:71 (pkg_check_modules)

Exception: Unable to generate build files

First, I don't know why it talks about libwinmedia 0.0.3 despite my pubspec file asking for 0.0.4. Then how am I supposed to know which package is missing? Thank you in advance for your help, and for making this plugin!

bdlukaa commented 2 years ago

@alexmercerind any idea?

alexmercerind commented 2 years ago

@baudren

First, I don't know why it talks about libwinmedia 0.0.3 despite my pubspec file asking for 0.0.4.

libwinmedia is my C/C++ library (AND ITS LATEST VERSION IS 0.0.3), I do NOT endorse just_audio_libwinmedia or just_audio. I have nothing to do with the versioning of just_audio_libwinmedia (which is 0.0.4 at the moment). Other thing to note is that, libwinmedia.dart is Dart projection that I wrote for my personal purpose & follows different versioning (because both are separate things & I cannot just wait for bug-fixes/features that I add to match versioning).

But when I run, I get the following error:

First of all, always share your log with --verbose. I cannot just blindly tell what is "A required package was not found". Secondly, installing the required packages before attempting to build application is the first thing that one does (sudo apt-get install libwebkit2gtk-4.0-dev).

Once again, I do NOT endorse just_audio_libwinmedia or just_audio & it is not my responsiblity to write build instructions or document required apt packages.

baudren commented 2 years ago

@alexmercerind Thank you for the clarification, and thank you for your work on the underlying library, then! I did not think about checking the --verbose output, as I was thinking that the list of missing packages would appear in the normal command, but I was wrong. Indeed, it is then listed that libwebkit2gtk-4.0 was missing. I installed the dev dependency as you suggested, and the program now goes forward.

However, @bdlukaa (thanks for adding the linux instructions, btw!), the application then never really launches. I see nothing in flutter run --verbose that indicates a failure, but the application window is simply frozen (I can't move it).

I will directly the underlying library, libwinmedia, and see if I get a similar error.

[  +16 ms] Building Linux application...
[  +11 ms] <- compile package:sound_tests/main.dart
[   +4 ms] executing: [build/linux/x64/debug/] cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug
-DFLUTTER_TARGET_PLATFORM=linux-x64 /home/benjamin/StudioProjects/sound_tests/linux
[  +40 ms] libwinmedia - 0.0.3
[   +1 ms] -------------------
[        ] Building on Linux against GTK 3.0 & WebKit2 4.0
[        ] C++ Standard: 17
[   +1 ms] -- Checking for module 'webkit2gtk-4.0'
[  +20 ms] --   Found webkit2gtk-4.0, version 2.34.1
[  +68 ms] Enabled Dart VM NativePorts callbacks.
[   +1 ms] -- Configuring done
[  +18 ms] -- Generating done
[        ] -- Build files have been written to:
/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug
[   +3 ms] executing: ninja -C build/linux/x64/debug install
[   +5 ms] ninja: Entering directory `build/linux/x64/debug'
[+3082 ms] [1/10] Building CXX object
plugins/libwinmedia/libwinmedia/CMakeFiles/libwinmedia.dir/libwinmedia.cpp.o
[ +239 ms] [2/10] Linking CXX shared library plugins/libwinmedia/libwinmedia/libwinmedia.so
[+10258 ms] [3/10] Generating
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/libflutter_linux_gtk.so,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_basic_message
_channel.h,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.
h,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_binary_messen
ger.h,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_dart_project.
h, /home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_engine.h,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_json_message_
codec.h,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_json_method_c
odec.h,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_message_codec
.h,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_method_call.h
,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_method_channe
l.h,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_method_codec.
h,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_method_respon
se.h,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_plugin_regist
rar.h,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_plugin_regist
ry.h,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_standard_mess
age_codec.h,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_standard_meth
od_codec.h,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_string_codec.
h, /home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_value.h,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/fl_view.h,
/home/benjamin/StudioProjects/sound_tests/linux/flutter/ephemeral/flutter_linux/flutter_linux.h,
_phony_
[   +3 ms] [  +75 ms] executing: uname -m
[        ] [  +32 ms] Exit code 0 from: uname -m
[        ] [        ] x86_64
[        ] [   +7 ms] executing: [/home/benjamin/Programs/flutter/] git -c
log.showSignature=false log -n 1 --pretty=format:%H
[        ] [   +5 ms] Exit code 0 from: git -c log.showSignature=false log -n 1
--pretty=format:%H
[        ] [        ] 3595343e20a61ff16d14e8ecc25f364276bb1b8b
[        ] [        ] executing: [/home/benjamin/Programs/flutter/] git tag --points-at
3595343e20a61ff16d14e8ecc25f364276bb1b8b
[        ] [  +18 ms] Exit code 0 from: git tag --points-at
3595343e20a61ff16d14e8ecc25f364276bb1b8b
[        ] [        ] 2.5.2
[        ] [  +12 ms] executing: [/home/benjamin/Programs/flutter/] git rev-parse --abbrev-ref
--symbolic @{u}
[        ] [   +4 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] [        ] origin/stable
[        ] [        ] executing: [/home/benjamin/Programs/flutter/] git ls-remote --get-url
origin
[        ] [   +4 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] [        ] https://github.com/flutter/flutter.git
[        ] [  +56 ms] executing: [/home/benjamin/Programs/flutter/] git rev-parse --abbrev-ref
HEAD
[        ] [   +3 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] [        ] stable
[        ] [  +53 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required,
skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required,
skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping
update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping
update.
[        ] [        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping
update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping
update.
[        ] [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping
update.
[        ] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping
update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping
update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping
update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping
update.
[        ] [ +122 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required,
skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required,
skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping
update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping
update.
[        ] [        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping
update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping
update.
[        ] [   +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping
update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping
update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping
update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping
update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping
update.
[        ] [        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[        ] [  +29 ms] Initializing file store
[        ] [  +18 ms] Skipping target: gen_localizations
[        ] [  +19 ms] gen_dart_plugin_registrant: Starting due to
{InvalidatedReasonKind.inputChanged: The following inputs have updated contents:
/home/benjamin/StudioProjects/sound_tests/.dart_tool/package_config_subset}
[        ] [   +2 ms] unpack_linux: Starting due to {}
[        ] [ +124 ms] unpack_linux: Complete
[        ] [ +561 ms] Found plugin audio_session at
/home/benjamin/.pub-cache/hosted/pub.dartlang.org/audio_session-0.1.6+1/
[        ] [  +15 ms] Found plugin just_audio at
/home/benjamin/.pub-cache/hosted/pub.dartlang.org/just_audio-0.9.15/
[        ] [   +1 ms] Found plugin just_audio_libwinmedia at
/home/benjamin/.pub-cache/hosted/pub.dartlang.org/just_audio_libwinmedia-0.0.4/
[        ] [   +3 ms] Found plugin just_audio_web at
/home/benjamin/.pub-cache/hosted/pub.dartlang.org/just_audio_web-0.4.2/
[        ] [   +2 ms] Found plugin libwinmedia at
/home/benjamin/.pub-cache/hosted/pub.dartlang.org/libwinmedia-0.0.7/
[        ] [   +4 ms] Found plugin path_provider at
/home/benjamin/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.6/
[        ] [   +1 ms] Found plugin path_provider_linux at
/home/benjamin/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.1.0/
[        ] [   +1 ms] Found plugin path_provider_macos at
/home/benjamin/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.2/
[        ] [   +2 ms] Found plugin path_provider_windows at
/home/benjamin/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.3/
[        ] [  +34 ms] gen_dart_plugin_registrant: Complete
[        ] [   +1 ms] kernel_snapshot: Starting due to {}
[   +2 ms] [   +7 ms] /home/benjamin/Programs/flutter/bin/cache/dart-sdk/bin/dart
--disable-dart-dev
/home/benjamin/Programs/flutter/bin/cache/artifacts/engine/linux-x64/frontend_server.dart.snapsh
ot --sdk-root
/home/benjamin/Programs/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/
--target=flutter --no-print-incremental-dependencies -DFLUTTER_WEB_AUTO_DETECT=true
-Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation
--packages /home/benjamin/StudioProjects/sound_tests/.dart_tool/package_config.json
--output-dill
/home/benjamin/StudioProjects/sound_tests/.dart_tool/flutter_build/647b4d9e6c396086c56f937d99299
d95/app.dill --depfile
/home/benjamin/StudioProjects/sound_tests/.dart_tool/flutter_build/647b4d9e6c396086c56f937d99299
d95/kernel_snapshot.d
/home/benjamin/StudioProjects/sound_tests/.dart_tool/flutter_build/generated_main.dart
[   +1 ms] [+10476 ms] kernel_snapshot: Complete
[        ] [ +474 ms] debug_bundle_linux-x64_assets: Starting due to {}
[        ] [ +186 ms] debug_bundle_linux-x64_assets: Complete
[        ] [ +600 ms] Persisting file store
[        ] [   +7 ms] Done persisting file store
[        ] [   +8 ms] build succeeded.
[        ] [   +8 ms] "flutter assemble" took 12,742ms.
[        ] [   +3 ms] Running shutdown hooks
[        ] [        ] Shutdown hooks complete
[        ] [        ] exiting with code 0
[ +431 ms] [4/10] Building CXX object CMakeFiles/sound_tests.dir/main.cc.o
[  +17 ms] [5/10] Building CXX object
CMakeFiles/sound_tests.dir/flutter/generated_plugin_registrant.cc.o
[  +45 ms] [6/10] Building CXX object CMakeFiles/sound_tests.dir/my_application.cc.o
[  +18 ms] [7/10] Building CXX object
plugins/libwinmedia/CMakeFiles/libwinmedia_plugin.dir/libwinmedia_plugin.cc.o
[  +84 ms] [8/10] Linking CXX shared library plugins/libwinmedia/liblibwinmedia_plugin.so
[ +118 ms] [9/10] Linking CXX executable intermediates_do_not_run/sound_tests
[        ] [9/10] Install the project...
[   +7 ms] -- Install configuration: "Debug"
[   +1 ms] -- Installing:
/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug/bundle/sound_tests
[        ] -- Set runtime path of
"/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug/bundle/sound_tests" to
"$ORIGIN/lib"
[        ] -- Installing:
/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug/bundle/data/icudtl.dat
[        ] -- Installing:
/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug/bundle/lib/libflutter_linux_gtk.
so
[  +63 ms] -- Installing:
/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug/bundle/lib/liblibwinmedia_plugin
.so
[        ] -- Installing:
/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug/bundle/lib/libwinmedia.so
[   +1 ms] -- Installing:
/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug/bundle/data/flutter_assets
[        ] -- Installing:
/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug/bundle/data/flutter_assets/versi
on.json
[        ] -- Installing:
/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug/bundle/data/flutter_assets/NOTIC
ES.Z
[        ] -- Installing:
/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug/bundle/data/flutter_assets/fonts
[        ] -- Installing:
/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug/bundle/data/flutter_assets/fonts
/MaterialIcons-Regular.otf
[  +11 ms] -- Installing:
/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug/bundle/data/flutter_assets/Asset
Manifest.json
[        ] -- Installing:
/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug/bundle/data/flutter_assets/FontM
anifest.json
[        ] -- Installing:
/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug/bundle/data/flutter_assets/packa
ges
[        ] -- Installing:
/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug/bundle/data/flutter_assets/packa
ges/cupertino_icons
[        ] -- Installing:
/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug/bundle/data/flutter_assets/packa
ges/cupertino_icons/assets
[        ] -- Installing:
/home/benjamin/StudioProjects/sound_tests/build/linux/x64/debug/bundle/data/flutter_assets/kerne
l_blob.bin
[  +81 ms] Building Linux application... (completed in 14.7s)
[ +223 ms] Observatory URL on device: http://127.0.0.1:42887/NV0jOR3hnaI=/
[   +5 ms] Caching compiled dill
[  +76 ms] Connecting to service protocol: http://127.0.0.1:42887/NV0jOR3hnaI=/
[ +143 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting
to VM service at http://127.0.0.1:42887/NV0jOR3hnaI=/.
[  +77 ms] DDS is listening at http://127.0.0.1:39745/49IDHqXGW4E=/.
[  +45 ms] Successfully connected to service protocol: http://127.0.0.1:42887/NV0jOR3hnaI=/
[  +28 ms] DevFS: Creating new filesystem on the device (null)
[  +22 ms] DevFS: Created new filesystem on the device
(file:///tmp/sound_testsKEMATW/sound_tests/)
[   +1 ms] Updating assets
[  +66 ms] Syncing files to device Linux...
[   +1 ms] <- reset
[        ] Compiling dart to kernel with 0 updated files
[   +2 ms] <- recompile
file:///home/benjamin/StudioProjects/sound_tests/.dart_tool/flutter_build/generated_main.dart
a9169ae9-b7db-4c03-9d47-5a5a3c68c9d0
[        ] <- a9169ae9-b7db-4c03-9d47-5a5a3c68c9d0
[ +208 ms] Updating files.
[        ] DevFS: Sync finished
[   +1 ms] Syncing files to device Linux... (completed in 213ms)
[        ] Synced 0.0MB.
[   +2 ms] <- accept
[   +2 ms] Connected to _flutterView/0x1d51340.
[   +3 ms] Flutter run key commands.
[   +1 ms] r Hot reload. 🔥🔥🔥
[        ] R Hot restart.
[        ] h List all available interactive commands.
[        ] d Detach (terminate "flutter run" but leave application running).
[        ] c Clear the screen
[        ] q Quit (terminate the application on the device).
[        ] 💪 Running with sound null safety 💪
[   +1 ms] An Observatory debugger and profiler on Linux is available at:
           http://127.0.0.1:39745/49IDHqXGW4E=/
[  +74 ms] Activating Dart DevTools...
[+1343 ms] Activating Dart DevTools... (completed in 1,343ms)
baudren commented 2 years ago

I confirm that the simple example from @alexmercerind on his dart bindings work, I manage to run the example and play some local audio files without issues.

@bdlukaa please let me know if you need any other information for debugging this freezing issue. And thanks again to both for your work and time, I'm looking forward to be able to create a nice music application cross-platform!

Cheers

bdlukaa commented 2 years ago

@baudren This is probably caused by preload: true. Can you try this again using https://github.com/ryanheise/just_audio/commit/0aef1beaad1bb070526fede56a784a53cd7abfe3 (latest master) ?

baudren commented 2 years ago

I used the following in my pubspec.yaml

  just_audio:
    git:
      url: https://github.com/ryanheise/just_audio.git
      path: just_audio
      ref: master
  just_audio_libwinmedia: ^0.0.4

But I still get the window hanging without starting.

bdlukaa commented 2 years ago

@baudren Can you try his latest example?

baudren commented 2 years ago

@bdlukaa I tried the playlist example from a few days ago. The app starts, which is a good sign! The play button however does not seem to work, I get this warning in the console:

CONSOLE JS ERROR Unhandled Promise Rejection: AbortError: The operation was aborted.

However the issue is not the same as the original ticket... do you want me to open a new issue?

bdlukaa commented 2 years ago

No, it's not necessary! I was thinking to install linux in my machine to see if I can get this working

nikitatg commented 2 years ago

On Ubuntu 20.04.3 LTS trying examples have same issues as above.

  1. On main.dart window are hanging. It happens on _player.setAudioSource(AudioSource.uri(Uri.file(someFilePath)) and _player.setAudioSource(AudioSource.uri(Uri.parse(someUri)). If passing preload: false app starts, but on pushing Play button debug console says CONSOLE JS ERROR Unhandled Promise Rejection: AbortError: The operation was aborted.
  2. Tried to use classes from src/just_audio_libwinmedia_real.dart directly but compiler does not see them when import is import 'package:just_audio_libwinmedia/just_audio_libwinmedia.dart';. Obviously just_audio_libwinmedia.dart does not export just_audio_libwinmedia_real.dart because of if (dart.library.ffi) does not pierce. But don't know what is dart.library.ffi flag
bdlukaa commented 2 years ago

But don't know what is dart.library.ffi flag

This makes sure it doesn't break on the web platform