簡體   English   中英

Flutter linux 在 Ubuntu 22.04 LTS CMake 上構建錯誤

[英]Flutter linux build on Ubuntu 22.04 LTS CMake Error

我有顫振項目,可以在 Ubuntu 20.04 上成功構建。 現在我想在 Ubuntu 22.04 上構建它,但我遇到了 CMake 錯誤。

CMake Error at /snap/flutter/111/usr/share/cmake-3.10/Modules/CMakeTestCXXCompiler.cmake:45 (message):
  The C++ compiler

    "/snap/flutter/current/usr/bin/clang++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/arzak/StudioProjects/testlinux/build/linux/x64/debug/CMakeFiles/CMakeTmp

    Run Build Command:"/snap/flutter/current/usr/bin/ninja" "cmTC_38e6c"
    [1/2] Building CXX object CMakeFiles/cmTC_38e6c.dir/testCXXCompiler.cxx.o
    [2/2] Linking CXX executable cmTC_38e6c
    FAILED: cmTC_38e6c 
    : && /snap/flutter/current/usr/bin/clang++    -L/snap/flutter/current/usr/lib/gcc/x86_64-linux-gnu/8 -L/snap/flutter/current/usr/lib/x86_64-linux-gnu -lblkid -lgcrypt -llzma -lpthread -ldl -L/snap/flutter/current/usr/lib/ CMakeFiles/cmTC_38e6c.dir/testCXXCompiler.cxx.o  -o cmTC_38e6c   && :
    /snap/flutter/current/usr/bin/ld: warning: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crt1.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0008002
    /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libgcc_s.so.1: undefined reference to `_dl_find_object@GLIBC_2.35'
    //lib/x86_64-linux-gnu/libgpg-error.so.0: undefined reference to `__libc_single_threaded@GLIBC_2.32'
    //lib/x86_64-linux-gnu/libgpg-error.so.0: undefined reference to `pthread_mutex_trylock@GLIBC_2.34'
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.




  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)

我已經使用sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev安裝了 clang 和其他人

這是flutter doctor的結果

[✓] Flutter (Channel stable, 3.0.0, on Ubuntu 22.04 LTS 5.15.0-27-generic,
    locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version
    32.1.0-rc1)
[✗] 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)
[✓] Connected device (1 available)
[✓] HTTP Host Availability

! Doctor found issues in 1 category.

感謝Pkrarakal ,我聽從了他的建議,錯誤消失了。 試試這個步驟:

  • 移動到邊緣通道, snap refresh flutter --edge
  • 運行flutter upgrade
  • 刪除構建目錄rm -r build/
  • 再次運行應用程序 flutter run -d linux

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM