Flutter for linux build fail

Issue

A linux build of any flutter application with linux enabled, results in the following error:

flutter run -d linux
Launching lib/main.dart on Linux in debug mode...
/snap/flutter/current/usr/bin/ld: warning: /usr/lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/crt1.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0008002
/snap/flutter/current/usr/bin/ld: warning: /usr/lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/crt1.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/snap/flutter/current/usr/bin/ld: warning: /usr/lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/crt1.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/snap/flutter/current/usr/bin/ld: warning: /usr/lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/crti.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/snap/flutter/current/usr/bin/ld: warning: /usr/lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/crti.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/snap/flutter/current/usr/bin/ld: warning: /usr/lib64/gcc/x86_64-pc-linux-gnu/10.2.0/crtbegin.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/snap/flutter/current/usr/bin/ld: warning: /usr/lib64/gcc/x86_64-pc-linux-gnu/10.2.0/crtbegin.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/snap/flutter/current/usr/bin/ld: warning: /usr/lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/libgcc_s.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/snap/flutter/current/usr/bin/ld: warning: /usr/lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/libgcc_s.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/snap/flutter/current/usr/bin/ld: warning: /usr/lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/libgcc_s.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/snap/flutter/current/usr/bin/ld: warning: /usr/lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/libgcc_s.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/snap/flutter/current/usr/bin/ld: warning: /usr/lib64/gcc/x86_64-pc-linux-gnu/10.2.0/crtend.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/snap/flutter/current/usr/bin/ld: warning: /usr/lib64/gcc/x86_64-pc-linux-gnu/10.2.0/crtend.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/snap/flutter/current/usr/bin/ld: warning: /usr/lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/crtn.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/snap/flutter/current/usr/bin/ld: warning: /usr/lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/crtn.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/snap/flutter/current/usr/bin/ld: warning: //usr/lib32/libdl.so.2: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0008002
/snap/flutter/current/usr/bin/ld: warning: //usr/lib32/libdl.so.2: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/snap/flutter/current/usr/bin/ld: warning: //usr/lib32/libdl.so.2: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/snap/flutter/current/usr/bin/ld: warning: //lib64/libdl.so.2: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0008002
/snap/flutter/current/usr/bin/ld: warning: //lib64/libdl.so.2: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/snap/flutter/current/usr/bin/ld: warning: //lib64/libdl.so.2: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/snap/flutter/current/usr/bin/ld: warning: //usr/lib32/libgcrypt.so.20: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/snap/flutter/current/usr/bin/ld: warning: //usr/lib32/libgcrypt.so.20: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/snap/flutter/current/usr/bin/ld: warning: //lib64/libgcrypt.so.20: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/snap/flutter/current/usr/bin/ld: warning: //lib64/libgcrypt.so.20: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Building Linux application...
Exception: Build process failed
My flutter doctor:
flutter doctor -v
[✓] Flutter (Channel stable, 2.0.1, on Linux, locale en_US.UTF-8)
• Flutter version 2.0.1 at /home/vtr/snap/flutter/common/flutter
• Framework revision c5a4b40 (9 days ago), 2021-03-04 09:47:48 -0800
• Engine revision 40441def69
• Dart version 2.12.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /home/vtr/Android/Sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /snap/android-studio/current/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.

[✓] Chrome - develop for the web
• CHROME_EXECUTABLE = /usr/bin/google-chrome-stable

[✓] Linux toolchain - develop for Linux desktop
• clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
• cmake version 3.10.2
• ninja version 1.8.2
• pkg-config version 0.29.1

[✓] Android Studio
• Android Studio at /snap/android-studio/current/android-studio
• Flutter plugin can be installed from:
hammer https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
hammer https://plugins.jetbrains.com/plugin/6351-dart
• android-studio-dir = /snap/android-studio/current/android-studio
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] Connected device (3 available)
• Note 7P (mobile) • • android-arm64 • Android 9 (API 28)
• Linux (desktop) • linux • linux-x64 • Linux
• Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.72

• No issues found!

System info
System: Kernel: 5.9.16-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.2.1 Desktop: KDE Plasma 5.21.2 Distro: Manjaro Linux

The error manifested upon upgrade of flutter to version 2.0.0
previous versions worked perfectly

Solution

you should update flutter (Channel stable) version to 2.0.3 . This version of flutter run don’t have this issue.

Updated answer

the universal solution for this problem is to uninstall flutter that you’ve installed from snap and install it from AUR.

installing flutter from AUR–>yay -S flutter

you might encounter some permission problem. here’s how to fix permission:

Create a new group flutterusers, add the default user to the group, then change permissions on the folder /opt/flutter.

sudo groupadd flutterusers
sudo gpasswd -a $USER flutterusers
sudo chown -R :flutterusers /opt/flutter
sudo chmod -R g+w /opt/flutter/

if you still got permission deny error,you can also change the permissions of the /opt/flutter folder to your $USER:

sudo chown -R $USER:flutterusers /opt/flutter

Answered By – Romjan D. Hossain

Answer Checked By – David Goodson (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.