alexmercerind / flutter_media_metadata

A Flutter plugin to read 🔖 metadata of 🎵 media files. Supports Windows, Linux, macOS, Android, iOS & Web.
MIT License
69 stars 35 forks source link

Build process failed on Linux #27

Open MaddPenguin opened 2 years ago

MaddPenguin commented 2 years ago

Cannot build my project on Linux.

flutter run -d linux:

/home/pizi/Documents/Project/boombox/linux/flutter/ephemeral/.plugin_symlinks/flutter_media_metadata/cxx/utils.hpp:108:12: error: variable 'last_index' set but not used [-Werror,-Wunused-but-set-variable]
/home/pizi/Documents/Project/boombox/linux/flutter/ephemeral/.plugin_symlinks/flutter_media_metadata/cxx/metadata_retriever.cpp:56:16: error: variable 'size' set but not used [-Werror,-Wunused-but-set-variable]
/home/pizi/Documents/Project/boombox/linux/flutter/ephemeral/.plugin_symlinks/flutter_media_metadata/cxx/metadata_retriever.cpp:57:16: error: variable 'header' set but not used [-Werror,-Wunused-but-set-variable]
Exception: Build process failed

flutter doctor:

[✓] Flutter (Channel stable, 2.10.4, on Manjaro Linux 5.15.28-1-MANJARO, locale
    en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version
    32.1.0-rc1)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.1)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

tried as per #23, still not working

mediainfo --version

MediaInfo Command line, 
MediaInfoLib - v22.03
omegaui commented 2 years ago

I am having the same problem. I am going to try using an earlier version.

Hutsaliuk commented 2 years ago

The same for me! The last version doesn't work on Linux!

omegaui commented 2 years ago

@Hutsaliuk

The same for me! The last version doesn't work on Linux!

I tried using an earlier version, but Even an earlier version isn't working on linux

omegaui commented 2 years ago

Currently using id3 for MP3 files.

Hutsaliuk commented 2 years ago

@omegaui Thanks for suggesting, but in that package unclear how to retrieve the cover image... Unfortunately, it has a very poor description... :(

omegaui commented 2 years ago

@Hutsaliuk You can access the artwork like below

MP3Instance mp3instance = MP3Instance(File(track.path).readAsBytesSync());
    if(mp3instance.parseTagsSync()){
      dataMap = mp3instance.getMetaTags();
      if(dataMap != null) {
        dynamic apicMap = dataMap?['APIC'];
        if(apicMap != null) {
          artworkBytes = base64Decode(apicMap['base64']);
        }
      }
    }

Yes, it wasn't mention anywhere how to do this, I just took a look at a sample json of id3's README.md!

omegaui commented 2 years ago

You can then use Image.memory(artworkBytes) To display it as you want

Hutsaliuk commented 2 years ago

@Hutsaliuk You can access the artwork like below

MP3Instance mp3instance = MP3Instance(File(track.path).readAsBytesSync());
    if(mp3instance.parseTagsSync()){
      dataMap = mp3instance.getMetaTags();
      if(dataMap != null) {
        dynamic apicMap = dataMap?['APIC'];
        if(apicMap != null) {
          artworkBytes = base64Decode(apicMap['base64']);
        }
      }
    }

Yes, it wasn't mention anywhere how to do this, I just took a look at a sample json of id3's README.md!

Thanks! You've really helped me! I will try it! =)

yuto-yuto commented 1 year ago

I could resolve the warnings in my forked repo.

but it still has linker command error.

[ +10 ms] /usr/bin/ld: cannot find -lmediainfo: No such file or directory [ +14 ms] clang: error: linker command failed with exit code 1 (use -v to see invocation) [ +804 ms] [3/6] Building CXX object CMakeFiles/flutter_media_metadata_example.dir/my_application.cc.o [ +6 ms] [4/6] Building CXX object CMakeFiles/flutter_media_metadata_example.dir/flutter/generated_plugin_registrant.cc.o [ ] ninja: build stopped: subcommand failed. [ +26 ms] Building Linux application... (completed in 4.0s) [ +5 ms] "flutter linux" took 5,020ms. [ +9 ms] Build process failed

Click to see the all info ```shell $ flutter build linux -v [ +80 ms] executing: uname -m [ +48 ms] Exit code 0 from: uname -m [ ] x86_64 [ +12 ms] executing: [/home/yuto/root/development/libraries/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H [ +12 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H [ ] 135454af32477f815a7525073027a3ff9eff1bfd [ +1 ms] executing: [/home/yuto/root/development/libraries/flutter/] git tag --points-at 135454af32477f815a7525073027a3ff9eff1bfd [ +26 ms] Exit code 0 from: git tag --points-at 135454af32477f815a7525073027a3ff9eff1bfd [ ] 3.3.10 [ +81 ms] executing: [/home/yuto/root/development/libraries/flutter/] git rev-parse --abbrev-ref --symbolic @{upstream} [ +7 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{upstream} [ ] origin/stable [ ] executing: [/home/yuto/root/development/libraries/flutter/] git ls-remote --get-url origin [ +10 ms] Exit code 0 from: git ls-remote --get-url origin [ +1 ms] https://github.com/flutter/flutter.git [ +65 ms] Unable to locate an Android SDK. [ +6 ms] executing: [/home/yuto/root/development/libraries/flutter/] git rev-parse --abbrev-ref HEAD [ +7 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD [ ] stable [ +103 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ +6 ms] 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. [ +6 ms] Artifact Instance of 'WindowsEngineArtifacts' 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. [ +113 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update. [ ] Artifact Instance of 'GradleWrapper' is not required, skipping update. [ +7 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. [ ] Artifact Instance of 'FlutterSdk' is not required, skipping update. [ ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ +6 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. [ +1 ms] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update. [ +4 ms] Artifact Instance of 'PubDependencies' is not required, skipping update. [ +120 ms] Skipping pub get: version match. [ +63 ms] Found plugin file_picker at /home/yuto/.pub-cache/hosted/pub.dartlang.org/file_picker-4.6.1/ [ +10 ms] Found plugin flutter_plugin_android_lifecycle at /home/yuto/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-2.0.7/ [ +64 ms] Found plugin flutter_media_metadata at /home/yuto/root/development/temp/flutter_media_metadata/ [ +68 ms] Found plugin file_picker at /home/yuto/.pub-cache/hosted/pub.dartlang.org/file_picker-4.6.1/ [ +7 ms] Found plugin flutter_plugin_android_lifecycle at /home/yuto/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-2.0.7/ [ +72 ms] Found plugin flutter_media_metadata at /home/yuto/root/development/temp/flutter_media_metadata/ [ +75 ms] Found plugin file_picker at /home/yuto/.pub-cache/hosted/pub.dartlang.org/file_picker-4.6.1/ [ +3 ms] Found plugin flutter_plugin_android_lifecycle at /home/yuto/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-2.0.7/ [ +34 ms] Found plugin flutter_media_metadata at /home/yuto/root/development/temp/flutter_media_metadata/ [ +119 ms] Generating /home/yuto/root/development/temp/flutter_media_metadata/example/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java [ +108 ms] 💪 Building with sound null safety 💪 [ +21 ms] Building Linux application... [ +50 ms] executing: [build/linux/x64/release/] cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DFLUTTER_TARGET_PLATFORM=linux-x64 /home/yuto/root/development/temp/flutter_media_metadata/example/linux [ +103 ms] -- Configuring done [ +96 ms] -- Generating done [ ] -- Build files have been written to: /home/yuto/root/development/temp/flutter_media_metadata/example/build/linux/x64/release [ +11 ms] executing: ninja -C build/linux/x64/release install [ +23 ms] ninja: Entering directory `build/linux/x64/release' [+2704 ms] [1/7] Generating /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/libflutter_linux_gtk.so, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_engine.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_method_call.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_method_response.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_value.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/fl_view.h, /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/flutter_linux/flutter_linux.h, _phony_ [ +81 ms] [ +78 ms] executing: uname -m [ +1 ms] [ +49 ms] Exit code 0 from: uname -m [ +1 ms] [ ] x86_64 [ +1 ms] [ +6 ms] executing: [/home/yuto/root/development/libraries/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H [ +1 ms] [ +5 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H [ +7 ms] [ ] 135454af32477f815a7525073027a3ff9eff1bfd [ ] [ ] executing: [/home/yuto/root/development/libraries/flutter/] git tag --points-at 135454af32477f815a7525073027a3ff9eff1bfd [ +1 ms] [ +16 ms] Exit code 0 from: git tag --points-at 135454af32477f815a7525073027a3ff9eff1bfd [ +1 ms] [ ] 3.3.10 [ +1 ms] [ +67 ms] Unable to locate an Android SDK. [ +1 ms] [ +4 ms] executing: [/home/yuto/root/development/libraries/flutter/] git rev-parse --abbrev-ref HEAD [ +1 ms] [ +5 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD [ +1 ms] [ ] stable [ +1 ms] [ +69 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ ] [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ +1 ms] [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ ] [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ ] [ +5 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ +1 ms] [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ +1 ms] [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ +5 ms] [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ +1 ms] [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +1 ms] [ +121 ms] executing: [/home/yuto/root/development/libraries/flutter/] git rev-parse --abbrev-ref --symbolic @{upstream} [ +1 ms] [ +7 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{upstream} [ ] [ ] origin/stable [ +1 ms] [ ] executing: [/home/yuto/root/development/libraries/flutter/] git ls-remote --get-url origin [ +1 ms] [ +4 ms] Exit code 0 from: git ls-remote --get-url origin [ +1 ms] [ ] https://github.com/flutter/flutter.git [ +1 ms] [ +1 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update. [ +1 ms] [ ] Artifact Instance of 'GradleWrapper' is not required, skipping update. [ ] [ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ +1 ms] [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ +1 ms] [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ +1 ms] [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ +1 ms] [ ] Artifact Instance of 'FlutterSdk' is not required, skipping update. [ +1 ms] [ ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ +1 ms] [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ +1 ms] [ +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ +1 ms] [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ +1 ms] [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ +2 ms] [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +11 ms] [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ ] [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ +1 ms] [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ +1 ms] [ ] 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. [ ] [ +57 ms] Initializing file store [ ] [ +18 ms] Done initializing file store [ ] [ +82 ms] Skipping target: gen_localizations [ ] [ +16 ms] Skipping target: gen_dart_plugin_registrant [ ] [ +346 ms] Skipping target: unpack_linux [ +1 ms] [ +596 ms] Skipping target: kernel_snapshot [ ] [ +63 ms] Skipping target: aot_elf_release [ +1 ms] [ +43 ms] Skipping target: linux_aot_bundle [ +1 ms] [ +53 ms] Skipping target: release_bundle_linux-x64_assets [ +1 ms] [ +1 ms] Persisting file store [ +2 ms] [ +11 ms] Done persisting file store [ +2 ms] [ +11 ms] build succeeded. [ +1 ms] [ +9 ms] "flutter assemble" took 1,478ms. [ ] [ +143 ms] ensureAnalyticsSent: 139ms [ +1 ms] [ +4 ms] Running shutdown hooks [ ] [ ] Shutdown hooks complete [ ] [ ] exiting with code 0 [ +7 ms] [2/6] Linking CXX shared library plugins/flutter_media_metadata/libflutter_media_metadata_plugin.so [ +2 ms] FAILED: plugins/flutter_media_metadata/libflutter_media_metadata_plugin.so [ +10 ms] : && /usr/bin/clang++ -fPIC -O3 -DNDEBUG -shared -Wl,-soname,libflutter_media_metadata_plugin.so -o plugins/flutter_media_metadata/libflutter_media_metadata_plugin.so plugins/flutter_media_metadata/CMakeFiles/flutter_media_metadata_plugin.dir/flutter_media_metadata_plugin.cc.o plugins/flutter_media_metadata/CMakeFiles/flutter_media_metadata_plugin.dir/__/cxx/metadata_retriever.cpp.o -Wl,-rpath,/home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral -lmediainfo /home/yuto/root/development/temp/flutter_media_metadata/example/linux/flutter/ephemeral/libflutter_linux_gtk.so /usr/lib/x86_64-linux-gnu/libblkid.so /usr/lib/x86_64-linux-gnu/libgtk-3.so /usr/lib/x86_64-linux-gnu/libgdk-3.so /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so /usr/lib/x86_64-linux-gnu/libpango-1.0.so /usr/lib/x86_64-linux-gnu/libharfbuzz.so /usr/lib/x86_64-linux-gnu/libatk-1.0.so /usr/lib/x86_64-linux-gnu/libcairo-gobject.so /usr/lib/x86_64-linux-gnu/libcairo.so /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so /usr/lib/x86_64-linux-gnu/libgio-2.0.so /usr/lib/x86_64-linux-gnu/libgobject-2.0.so /usr/lib/x86_64-linux-gnu/libglib-2.0.so && : [ +10 ms] /usr/bin/ld: cannot find -lmediainfo: No such file or directory [ +14 ms] clang: error: linker command failed with exit code 1 (use -v to see invocation) [ +804 ms] [3/6] Building CXX object CMakeFiles/flutter_media_metadata_example.dir/my_application.cc.o [ +6 ms] [4/6] Building CXX object CMakeFiles/flutter_media_metadata_example.dir/flutter/generated_plugin_registrant.cc.o [ ] ninja: build stopped: subcommand failed. [ +26 ms] Building Linux application... (completed in 4.0s) [ +5 ms] "flutter linux" took 5,020ms. [ +9 ms] Build process failed [ ] #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3) #1 _runBuild (package:flutter_tools/src/linux/build_linux.dart:185:5) #2 buildLinux (package:flutter_tools/src/linux/build_linux.dart:78:5) #3 BuildLinuxCommand.runCommand (package:flutter_tools/src/commands/build_linux.dart:85:5) #4 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1209:27) #5 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #6 CommandRunner.runCommand (package:args/command_runner.dart:209:13) #7 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9) #8 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #9 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5) #10 run.. (package:flutter_tools/runner.dart:62:9) #11 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #12 main (package:flutter_tools/executable.dart:91:3) [ +41 ms] ensureAnalyticsSent: 36ms [ +1 ms] Running shutdown hooks [ ] Shutdown hooks complete [ +4 ms] exiting with code 1 ```

I've read the following comment, installed libstdc++-12-dev, and reinstalled the other required dependencies but the error is still there. https://github.com/flutter/flutter/issues/115909#issuecomment-1330332515

The following error seems to cause the problem but I don't know how to solve it. /usr/bin/ld: cannot find -lmediainfo: No such file or directory

mbakhlaqi commented 1 year ago

I know its been a while but worth saying, I had this problem too and man I was very frustrated and after some research I found nothing and decided to look into it myself though I don't know anything about literally anything I did these steps to solve it:

  1. Run and see what are the errors and what variables cause them.
  2. got to the file it says and open it up and find the variables(code that causes error) and comment them. (in the error log it prints both path of the file and line of the error).
  3. Run again, and again you get some errors do step 2 again and your done (this one is a bit tricky comment any line that the error indicate).
tl2a commented 11 months ago

Anybody still messing with this, just install mediainfo and libmediainfo-devel. Thanks

Fedora users can install like this:

sudo dnf install mediainfo libmediainfo-devel