Flutter on Fedora 36 - Linux compilation not working "unable to load driver: swrast"
Asked Answered
A

1

0

when running flutter run to run on linux, a blank page appears with this in the debug console:

Launching lib/main.dart on Linux in debug mode...
libGL error: MESA-LOADER: failed to open swrast: /lib64/libpthread.so.0: version `GLIBC_PRIVATE' not found (required by /snap/flutter/current/usr/lib/x86_64-linux-gnu/dri/../../../../lib/x86_64-linux-gnu/librt.so.1) (search paths :/usr/lib/dri:/snap/flutter/current/usr/lib/x86_64-linux-gnu/dri:, suffix _dri)
libGL error: failed to load driver: swrast
** (flutter_mastering:4822): WARNING **: 18:51:11.101: Failed to start Flutter renderer: Unable to create a GL context

searched for similar issues on the topic:

apparently nothing worked, here is some of my device's info:

  • 5.19.6-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 31 17:58:15 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
  • ❯ glxinfo | grep render
    GLX_MESA_query_renderer, GLX_MESA_swap_control, GLX_NV_float_buffer, 
    GLX_MESA_query_renderer, GLX_MESA_swap_control, GLX_OML_swap_method, 
Extended renderer info (GLX_MESA_query_renderer):
OpenGL renderer string: AMD Radeon Vega 3 Graphics (raven, LLVM 14.0.0, DRM 3.47, 5.19.6-200.fc36.x86_64)
    GL_ARB_compute_variable_group_size, GL_ARB_conditional_render_inverted, 
    GL_INTEL_blackhole_render, GL_KHR_blend_equation_advanced, 
    GL_NV_conditional_render, GL_NV_copy_image, GL_NV_depth_clamp, 
    GL_ARB_compute_variable_group_size, GL_ARB_conditional_render_inverted, 
    GL_INGR_blend_func_separate, GL_INTEL_blackhole_render, 
    GL_NV_compute_shader_derivatives, GL_NV_conditional_render, 
    GL_EXT_render_snorm, GL_EXT_robustness, GL_EXT_sRGB_write_control, 
    GL_INTEL_blackhole_render, GL_KHR_blend_equation_advanced, 
    GL_NV_conditional_render, GL_NV_draw_buffers, GL_NV_fbo_color_attachments, 
    GL_OES_element_index_uint, GL_OES_fbo_render_mipmap,
  • ❯ flutter doctor
[✓] Flutter (Channel stable, 3.0.5, on Fedora Linux 36 (Workstation Edition) 5.19.6-200.fc36.x86_64, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.71.0)
[✓] Connected device (1 available)
[✓] HTTP Host Availability

! Doctor found issues in 1 category.
Ajay answered 7/9, 2022 at 16:3 Comment(1)
literally no one knows about this issue but me? eh hard luck I guess I'm stuck with debugging my apps on 2 fps with an android emulatorAjay
A
0

The issue is because of the snap install, what worked for me is replacing the snap version with the manual install from github. You can also use the tarball.

git clone https://github.com/flutter/flutter.git -b stable

now to add flutter to path:

sudo gedit ~/.bashrc

Assuming ur flutter install was at /home/user/ add this at the end of the file:

export PATH="$PATH:/flutter/bin"

If ur flutter install is somewhere else then change the directory accordingly

After saving and exiting, refresh ur .bashrc file with:

source ~/.bashrc

Now check if its added to path with:

echo $PATH

If you see a /flutter/bin then ur doing fine. To check if flutter's installed:

flutter  --version

To add any missing dependencies (if ur on Fedora) use:

sudo dnf install bash curl file git unzip which xz zip mesa-libGLU clang cmake ninja-build pkg-config gtk3-devel

On Ubuntu based distros it is

sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
Anemometer answered 22/11, 2022 at 15:49 Comment(1)
The error for search keywords: libGL error: MESA-LOADER: failed to open swrast: /lib64/libpthread.so.0: version `GLIBC_PRIVATE' not found (required by /snap/flutter/current/usr/lib/x86_64-linux-gnu/dri/../../../../lib/x86_64-linux-gnu/librt.so.1) (search paths :/usr/lib/dri:/snap/flutter/current/usr/lib/x86_64-linux-gnu/dri:, suffix _dri) libGL error: failed to load driver: swrastAnemometer

© 2022 - 2024 — McMap. All rights reserved.