I found the problem. You have to add:
-fexperimental-library
to the compiler flags. This was added to clang++ 16 I think,
It should be noted they're deprecating the wstring_convert template in C++17 and removing it in C++26, however there's currently no replacement. And when I was on FreeBSD 13.2 and clang++ 14 using -std=c++2a (2020) neither problem showed up.