cargo install batしようとしてエラー

qiita.com

この記事に影響受けてカラフルで見やすいコマンドいっちょ使ってみっか!と思ってRustインストールしたまではいいけど、意気揚々とcargo install batコマンド打ったらエラーになった。

環境

Linux 5.3.0-40-generic #32~18.04.1-Ubuntu

error: failed to run custom build command for `onig_sys v69.2.0`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installG3HylE/release/build/onig_sys-7d9cf1b204cf2143/build-script-build` (exit code: 101)
--- stdout
cargo:warning=couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
cargo:warning=set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable

--- stderr
thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'libclang.so\', \'libclang-*.so\', \'libclang.so.*\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

warning: build failed, waiting for other jobs to finish...
error: failed to compile `bat v0.12.1`, intermediate artifacts can be found at `/tmp/cargo-installG3HylE`

Caused by:
  build failed

sudo apt install llvm でエラーが出なくなった。

error: failed to run custom build command for `onig_sys v69.2.0`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installm6GLXU/release/build/onig_sys-7d9cf1b204cf2143/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'libclang.so\', \'libclang-*.so\', \'libclang.so.*\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

warning: build failed, waiting for other jobs to finish...
error: failed to compile `bat v0.12.1`, intermediate artifacts can be found at `/tmp/cargo-installm6GLXU`

Caused by:
  build failed

sudo apt install libclang-dev でエラーが出なくなった。

batコマンドはうん見やすい。