vcpkg update を実行して Error: while loading boost-disjoint-sets: と出たときには、以前にインストールした boost-disjoint-sets を削除する

試した環境

  • Windows10
  • vcpkg 2021.05.12
  • boost 1.72.0 -> 1.75.0

本題

vcpkg updateを実行したところ、以下のエラーメッセージが出力されました。

Error: while loading boost-disjoint-sets:
The port directory (X:XXXX\vcpkg\ports\boost-disjoint-sets) does not exist
Error: failed to load port from X:XXXX\vcpkg\ports\boost-disjoint-sets
Note: Updating vcpkg by rerunning bootstrap-vcpkg may resolve this failure.

.\vcpkg\ports フォルダを確認すると、 boost-disjoint-sets フォルダが存在していません。 一方 .\vcpkg\packages フォルダを確認すると、 boost-disjoint-sets フォルダが存在してます。 どうやら、以前インストールした boost-disjoint-sets パッケージの更新を確認しようとしたが、更新後の vcpkg には boost-disjoint-sets が無くなったことがエラーの原因のようです。

そこで、以前にインストールした boost-disjoint-sets パッケージを vcpkg から削除します。 しかし単純にvcpkg remove boost-disjoint-setsでは削除できませんでした。

$ vcpkg remove boost-disjoint-sets
The following packages will be removed:
  * boost:x86-windows
    boost-disjoint-sets:x86-windows
Additional packages (*) need to be removed to complete this operation.
If you are sure you want to remove them, run the command with the --recurse option

--recurseオプションを追加したことで削除できました。

$ vcpkg remove boost-disjoint-sets --recurse
The following packages are not installed, so not removed:
    option:x86-windows
The following packages will be removed:
  * boost:x86-windows
    boost-disjoint-sets:x86-windows
Additional packages (*) need to be removed to complete this operation.
Removing package boost:x86-windows...
Removing package boost:x86-windows... done
Removing package boost-disjoint-sets:x86-windows...
Removing package boost-disjoint-sets:x86-windows... done
Package option:x86-windows is not installed

x64-windows バージョンも削除します。

$ vcpkg remove boost-disjoint-sets:x64-windows --recurse
The following packages are not installed, so not removed:
    option:x86-windows
The following packages will be removed:
  * boost:x64-windows
    boost-disjoint-sets:x64-windows
Additional packages (*) need to be removed to complete this operation.
Removing package boost:x64-windows...
Removing package boost:x64-windows... done
Removing package boost-disjoint-sets:x64-windows...
Removing package boost-disjoint-sets:x64-windows... done
Package option:x86-windows is not installed

その後vcpkg updateを実行したところ、エラーメッセージが出ずに、正しく実行されるようになりました。

参考

https://github.com/microsoft/vcpkg/issues/11482