WSLにAWS SAM CLIをインストールしようとしたら、「Error: patchelf must be installed: brew install patchelf」 ~  「brew install gcc」も「brew install patchelf」も実行できない

WSLにAWS SAM CLIをインストールしようとしたら、「Error: patchelf must be installed: brew install patchelf」となった。

結論から述べるとbrewgccはインストールできないから、apt-get installしろ」

WSLのOSはubuntu

user@host:~/workspace$ brew install aws-sam-cli
==> Installing aws-sam-cli from aws/tap
==> Installing dependencies for aws/tap/aws-sam-cli: patchelf, m4, gmp, mpfr, libmpc, isl@0.18, zlib, gcc, gdbm, openssl@1.1, ncurses, readline, sqlite, xz, bzip2, libffi and python
==> Installing aws/tap/aws-sam-cli dependency: patchelf
==> Downloading https://linuxbrew.bintray.com/bottles/patchelf-0.10.x86_64_linux.bottle.tar.gz
Already downloaded: /home/user/.cache/Homebrew/downloads/405227c46362964d2bc2e9ff6428fe082dff4dbd3a4b0b29453743f71923304b--patchelf-0.10.x86_64_linux.bottle.tar.gz
==> Pouring patchelf-0.10.x86_64_linux.bottle.tar.gz
Error: patchelf must be installed: brew install patchelf
Warning: Bottle installation failed: building from source.
Error: The following formula
patchelf cannot be installed as binary package and must be built from source.
Install Clang or run `brew install gcc`.

エラー内容を見ると、

「Error: patchelf must be installed: brew install patchelf」
「patchelf cannot be installed as binary package and must be built from sourceInstall Clang or run `brew install gcc`..」

ああ、「gccをインストールすればいいのか」ということで、「brew install gcc」を実行。ところが。。

user@host:~/workspace$ brew install gcc
==> Installing dependencies for gcc: patchelf, gmp, mpfr, libmpc, isl@0.18 and zlib
==> Installing gcc dependency: patchelf
==> Downloading https://linuxbrew.bintray.com/bottles/patchelf-0.10.x86_64_linux.bottle.tar.gz
Already downloaded: /home/user/.cache/Homebrew/downloads/405227c46362964d2bc2e9ff6428fe082dff4dbd3a4b0b29453743f71923304b--patchelf-0.10.x86_64_linux.bottle.tar.gz
==> Pouring patchelf-0.10.x86_64_linux.bottle.tar.gz
Error: patchelf must be installed: brew install patchelf
Warning: Bottle installation failed: building from source.
Error: The following formula
patchelf
cannot be installed as binary package and must be built from source.
Install Clang or run `brew install gcc`.

同じエラー。しかも、エラーメッセージ通りやると無限に終わらないw。
brewで駄目ならaptだろ。。。ということで、実行して事なきを得るが、こういうのは困るな。
20年経っても、依存性やらインストールやら、最初に検証する際には、そのへんの手間は殆ど変わっていない気がする。。。
一度検証終わって、パッケージに纏めてしまえば楽にはなっているんだけど。

user@host:~/workspace$ sudo apt install gcc

gccとclangをインストール後に、「brew install aws-sam-cli」を実行すると成功。