🐛
Arch LinuxでFlutter環境構築で「clang++ is required for Linux development.」となる
Arch LinuxでFlutter環境構築中に微詰まりしたのでメモ。
事象
最初の環境構築時、flutter doctor
で以下の事象が発生。
❯ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.4, on EndeavourOS 6.9.2-arch1-1, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.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
✗ clang++ is required for Linux development.
It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/
✗ CMake is required for Linux development.
It is likely available from your distribution (e.g.: apt install cmake), or can be downloaded from https://cmake.org/download/
[✓] Android Studio (version 2021.3)
[✓] Android Studio (version 2023.1)
[✓] Connected device (1 available)
[✓] Network resources
! Doctor found issues in 2 categories.
ためしにflutter run
をしてみると、以下のエラーが発生。
❯ flutter run
Downloading linux-x64-debug/linux-x64-flutter-gtk tools... 2,288ms
Downloading linux-x64-profile/linux-x64-flutter-gtk tools... 1,514ms
Downloading linux-x64-release/linux-x64-flutter-gtk tools... 1,598ms
Launching lib/main.dart on Linux in debug mode...
Building Linux application...
Traceback (most recent call last):
File "/home/user/.local/bin/cmake", line 5, in <module>
from cmake import cmake
ModuleNotFoundError: No module named 'cmake'
Error: Unable to generate build files
python側にcmakeが必要そうなので、pipでインストール。
pip install cmake
再実行すると、以下のエラーに変わる。
/usr/bin/clang++: error while loading shared libraries: libLLVM.so.18.1: cannot open shared object file: No such file or directory
libLLVMの構築に失敗している?sudo pacman -S llvm
ですでにインストール自体はしていたが、どうやらllvm-libs
が必要とのこと。
再インストールしたところ、解消した。
対応について
結局のところ、以下の2つでエラーは取れた。
pip install cmake
sudo pacman -S llvm-libs
Discussion