From clang 13.0.0 has a new option -print-multiarch, matching gcc. On
linux-musl systems this outputs x86_64-linux-gnu (or aarch64-linux-gnu, etc)
instead of x86_64-linux-musl (or aarch64-linux-musl, etc).
Amongst other things, this bug breaks compiling python with clang on musl
hosts, as the python configure script does a sanity check and notices the
output of -print-multiarch is inconsistent with the linux-musl platform triplet
it (correctly) deduces for the host by other means. (The configure script
errors out with "internal configure error for the platform triplet, please file
a bug report" FWIW. This worked okay in clang 12.0.1 because python only checks
the multiarch target for consistency if $CC -print-multiarch isn't an error.)
The implementation in Linux::getMultiarchTriple() of
clang/lib/Driver/ToolChains/Linux.cpp special-cases -linux-android targets, and
assumes -linux-gnu for anything else.
Credit for this patch goes to arachsys <Chris Webb> and mgorny <Michał Górny>
Please also reffer:
https://bugs.llvm.org/show_bug.cgi?id=52127 and
llvm/llvm-project#51469