flame icon indicating copy to clipboard operation
flame copied to clipboard

Install Flame audio package crash project if you run with linux

Open nmarafo opened this issue 3 years ago • 12 comments

Current bug behaviour

Installing the flame_audio package from pub.dev causes a crash if you run the project on linux.

It works again when uninstalling the package.

Expected behaviour

install the package normally.

Steps to reproduce

  1. Create a flutter project
  2. Install flame_audio package
  3. Run project on linux

Flutter doctor output

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.5, on Ubuntu 20.04.4 LTS 5.15.0-43-generic, locale es_ES.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc1)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.2)
[✓] Android Studio
[✓] IntelliJ IDEA Ultimate Edition (version 2022.2)
[✓] VS Code (version 1.70.0)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

• No issues found!

More environment information

Log information

CMake Error at flutter/ephemeral/.plugin_symlinks/audioplayers_linux/linux/CMakeLists.txt:5 (include):
  include could not find load file:

    FetchContent


CMake Error at /snap/flutter/126/usr/share/cmake-3.10/Modules/FindPkgConfig.cmake:419 (message):
  A required package was not found
Call Stack (most recent call first):
  /snap/flutter/126/usr/share/cmake-3.10/Modules/FindPkgConfig.cmake:597 (_pkg_check_modules_internal)
  flutter/ephemeral/.plugin_symlinks/audioplayers_linux/linux/CMakeLists.txt:25 (pkg_check_modules)


Exception: Unable to generate build files

nmarafo avatar Aug 09 '22 18:08 nmarafo

That is this issue: https://github.com/bluefireteam/audioplayers/issues/1197

If I remember correctly Ubuntu based distros bundle a ridiculously old cmake version.

spydon avatar Aug 09 '22 18:08 spydon

nmarafo I think you should install flutter manually instead of using snap if you are using a Linux distro thats because snap doesn't have proper CMake support.

cmedamine avatar Aug 11 '22 12:08 cmedamine

Thank you very much for the reply. I'll try to do the manual installation to see if that fixes it. Greetings.

nmarafo avatar Aug 11 '22 13:08 nmarafo

I think that you should also be able to get it working by install it from snap too if you manually set the channel: snap refresh --channel=edge/core20 flutter Since that is using this PR https://github.com/canonical/flutter-snap/pull/61

spydon avatar Aug 12 '22 07:08 spydon

Thanks Lukas, but it didn't work for me... I tried to install Flutter manually but it keeps getting the path of the old installation. I hope it will be fixed when I upgrade to Ubuntu 22...

nmarafo avatar Aug 13 '22 08:08 nmarafo

Did you make sure that it was fully uninstalled first?

spydon avatar Aug 13 '22 08:08 spydon

I followed these steps:

$ sudo snap remove flutter

$ sudo snap install flutter --classic

$ flutter sdk-path

$ snap refresh --channel=edge/core20 flutter

but doesn't work

nmarafo avatar Aug 13 '22 09:08 nmarafo

I'm not fully aware of how snap works, but shouldn't you set the channel before you install, otherwise you'll just install the same version again?

spydon avatar Aug 13 '22 10:08 spydon

If I uninstall flutter before updating snap --channel=edge/core20 flutter

I get the message snap "flutter" is not installed.

I have reinstalled flutter again with sudo snap install flutter --classic --channel=edge/core20.

Also refresh channell and install flutter...

Maybe it's related to this issue?... https://github.com/Dart-Code/Dart-Code/issues/2791

nmarafo avatar Aug 13 '22 11:08 nmarafo

@nmarafo could you try again now? Since https://github.com/canonical/flutter-snap/pull/61 is merged I'm hoping that it would work now.

spydon avatar Sep 09 '22 08:09 spydon

Hi @spydon, after refresh with snap refresh --channel=edge/core20 flutter, I get the following error message:

CMake Error at /snap/flutter/127/usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:463 (message):
  A required package was not found
Call Stack (most recent call first):
  /snap/flutter/127/usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:643 (_pkg_check_modules_internal)
  flutter/ephemeral/.plugin_symlinks/audioplayers_linux/linux/CMakeLists.txt:25 (pkg_check_modules)

flutter doctor it's OK.

Actually I'm working with Ubuntu 22.04.1 LTS

nmarafo avatar Sep 12 '22 11:09 nmarafo

Since the channel has been merged now I don't think you should need to do that step.

spydon avatar Sep 12 '22 11:09 spydon

Hey @nmarafo, on going to that particlular line in CMakeLists.txt, I found out that it was a gstreamer issue. Installing that in my system fixed this CMakeError. Btw, I am running Ubuntu 20.04 with manually build flutter and I'm using v1.4.0 release of flame engine.

AmarNathH avatar Oct 11 '22 06:10 AmarNathH

Hi, @AmarNathH, thanks for your answer, If you are talking about install gstreamer I install this on my Ubuntu 22

sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio

but doesnt work. Where is the CMakeLists.txt issue?

nmarafo avatar Oct 11 '22 20:10 nmarafo

Hey @nmarafo For this error,

flutter/ephemeral/.plugin_symlinks/audioplayers_linux/linux/CMakeLists.txt:25

You can see that there is an error at line 25 of CMakeLists, opening it and going to that line, you will able to find which package is missing.

AmarNathH avatar Oct 12 '22 01:10 AmarNathH

In my console appear:

CMake Error at flutter/ephemeral/.plugin_symlinks/audioplayers_linux/linux/CMakeLists.txt:5 (include):
  include could not find load file:

    FetchContent

I have all gstreamer packages installed. In Stackoverflow say that "FetchContent" appear in CMake 3.11... any idea how repair?

nmarafo avatar Oct 12 '22 07:10 nmarafo

At this point you got that CMakeLists error right? https://github.com/flame-engine/flame/issues/1836#issuecomment-1243615996

I am using the snap version of flutter, I've build it manually.

AmarNathH avatar Oct 12 '22 07:10 AmarNathH

In Stackoverflow say that "FetchContent" appear in CMake 3.11... any idea how repair?

Can you run cmake --version and check what version you are using?

ufrshubham avatar Oct 12 '22 07:10 ufrshubham

In my system I have

cmake --version
cmake version 3.22.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).

If in flutter/ephemeral/.plugin_symlinks/audioplayers_linux/linux/CMakeLists.txt I change

cmake_minimum_required(VERSION 3.10) 

to

cmake_minimum_required(VERSION 3.11) 

I get this out:

CMake Error at flutter/ephemeral/.plugin_symlinks/audioplayers_linux/linux/CMakeLists.txt:2 (cmake_minimum_required):
  CMake 3.11 or higher is required.  You are running version 3.10.2

Captura desde 2022-10-12 11-34-01

nmarafo avatar Oct 12 '22 10:10 nmarafo

Are you still running the Flutter snap package? Because they are the ones bundling old versions of cmake, so it doesn't matter if you have a newer version installed on your system. If I were you I would just completely purge the snap package and install Flutter from the .tar.xz

spydon avatar Oct 15 '22 00:10 spydon

Thanks all for your answers.... Indeed, the problem was when using the snap version. After installing Flutter manually, the version used in CMake is 3.22.1 (I imagine it takes the one from my system) while with snap it was 3.10 which does not support "FetchContent". After deleting the "build" folder, I do a build again and now it works. SOLVED!!!

nmarafo avatar Oct 15 '22 22:10 nmarafo