swiftc のビルドエラー 'libxml/xmlreader.h' file not found について

swiftc を久しぶりにビルドしたら以下のエラーが出た。

/Users/enomoto/.ghq/github.com/apple/llvm/lib/WindowsManifest/WindowsManifestMerger.cpp:21:10: fatal error: 'libxml/xmlreader.h' file not found
#include <libxml/xmlreader.h>
         ^~~~~~~~~~~~~~~~~~~~

結論を書くと、 libxml 配下のファイルがなくてビルドエラーになる場合、Command Line Tools をインストールできていない。Xcodeのバージョンを上げたので、インストールする必要があった。

Command Line Tools のインストール

$ xcode-select --install

再度ビルド

$ ./swift/utils/build-script -Rt

無事ビルドが通った。

環境