flutter build Linux --> clang:错误:链接器命令失败

w80xi6nr  于 2023-10-22  发布在  Flutter
关注(0)|答案(1)|浏览(118)

“flutter build Linux”输出:

💪 Building with sound null safety 💪     
clang: error: linker command failed with exit code 1 (use -v to see invocation) Building Linux application...                         
Build process failed

“flutter doctor -v”输出:

[✓] Flutter (Channel stable, 2.5.3, on Ubuntu 20.04.2 LTS 5.11.0-41-generic, locale C.UTF-8)
    • Flutter version 2.5.3 at /home/MyHome/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (8 weeks ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /home/MyHome/Documents/Apps/Android/Sdk/
    • Platform android-30, build-tools 30.0.2
    • ANDROID_SDK_ROOT = /home/MyHome/Documents/Apps/Android/Sdk/
    • Java binary at: /home/MyHome/Documents/Apps/Android/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /opt/brave.com/brave/brave-browser

[✓] 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 (version 2020.3)
    • Android Studio at
      /home/MyHome/Documents/Apps/Android/android-studio-ide-201.6953283-linux/android-studio
    • Flutter plugin version 58.0.2
    • Dart plugin version 203.8292
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] Android Studio
    • Android Studio at /home/MyHome/Documents/Apps/Android/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /home/MyHome/Documents/Apps/Android/android-studio
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] VS Code (version 1.63.0)
    • VS Code at /usr/share/code
    • Flutter extension version 3.29.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 20.04.2 LTS 5.11.0-41-generic
    • Chrome (web)    • chrome • web-javascript • Brave Browser 96.1.32.115

• No issues found!

<br/>
"uname -a" output:

Linux X200 5.11.0-41-generic #45~20.04.1-Ubuntu SMP Wed Nov 10 10:20:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

我删除并重新安装了flutter和clang几次,但我仍然没有看到任何关于上述问题的变化,当我运行build with -v时,我收到了这样的消息:
“flutter build Linux -v”输出:
Output on pastebin.com

c86crjj0

c86crjj01#

看来是第三方引用的库链接未能获得此问题,原因是执行版本与Flutter官方支持的版本不一致
1.更新apt
sudo apt update sudo apt full-upgrade
1.升级C库
在此输入代码
实在无法更新Linux内核,最终解决方案

相关问题