Is this a libcxx build bug? _mbstate_t.h ... error: "We don't know .. get the definition of mbstate_t without <wchar.h>

I am (attempting) to build libcxx:

  • host is windows mingw
  • target is wasm32 (not WASI or emscripten)

I am using these cmake flags:

cmake -G 'MinGW Makefiles' -S runtimes -B build    \
	-DCMAKE_BUILD_TYPE=Release		\
	-DCMAKE_C_COMPILER=clang   \
	-DCMAKE_CXX_COMPILER=clang++  \
	-DLLVM_ENABLE_LLD=ON    \
	-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind"  \
	-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \
	-DLIBCXX_ADDITIONAL_COMPILE_FLAGS="-emit-llvm --target=wasm32 -nostdinc -nostdlib -I C:/GitHubClonesDev/tiny-wasm-runtime/include/"  \
	-DLIBCXXABI_ADDITIONAL_COMPILE_FLAGS="-emit-llvm --target=wasm32 -nostdinc -nostdlib -I C:/GitHubClonesDev/tiny-wasm-runtime/include/"  \
	-DLIBUNWIND_ADDITIONAL_COMPILE_FLAGS="-emit-llvm --target=wasm32 -nostdinc -nostdlib -I C:/GitHubClonesDev/tiny-wasm-runtime/include/"  \
	-DLLVM_TARGET_TRIPLE=wasm32 \
	-DLLVM_DEFAULT_TARGET_TRIPLE=wasm32 \
	-DLLVM_RUNTIME_TARGETS=wasm32 \
	-DLIBCXX_ENABLE_EXCEPTIONS=OFF \
	-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF \
	-DLIBCXX_ENABLE_RTTI=OFF \
	 \
	-DLIBCXX_ENABLE_THREADS=OFF \
	-DLIBCXXABI_ENABLE_THREADS=OFF \
	-DLIBUNWIND_ENABLE_THREADS=OFF \
	 \
	-DLIBCXX_ENABLE_SHARED=OFF \
	-DLIBCXXABI_ENABLE_SHARED=OFF  \
	-DLIBUNWIND_ENABLE_SHARED=OFF \
	\
	-DLIBCXX_ENABLE_FILESYSTEM=OFF \
	-DLIBCXX_ENABLE_TIME_ZONE_DATABASE=OFF \
	-DLIBCXX_ENABLE_MONOTONIC_CLOCK=OFF \
	-DLIBCXX_ENABLE_RANDOM_DEVICE=OFF \
	-DLIBCXX_ENABLE_LOCALIZATION=OFF \
	-DLIBCXX_INCLUDE_BENCHMARKS=OFF \
	-DLIBCXX_ENABLE_UNICODE=OFF \
	-DLIBCXX_ENABLE_WIDE_CHARACTERS=OFF 

I am getting this error:

In file included from C:\GitHubClonesDev\llvm-project\libcxxabi\src\cxa_demangle.cpp:17:
In file included from C:\GitHubClonesDev\llvm-project\libcxxabi\src/demangle/ItaniumDemangle.h:20:
In file included from C:\GitHubClonesDev\llvm-project\libcxxabi\src/demangle/StringViewExtras.h:20:
In file included from C:/GitHubClonesDev/llvm-project/build/include/c++/v1/string_view:225:
In file included from C:/GitHubClonesDev/llvm-project/build/include/c++/v1/__string/char_traits.h:27:
In file included from C:/GitHubClonesDev/llvm-project/build/include/c++/v1/iosfwd:118:
In file included from C:/GitHubClonesDev/llvm-project/build/include/c++/v1/__std_mbstate_t.h:14:
C:/GitHubClonesDev/llvm-project/build/include/c++/v1/__mbstate_t.h:51:4: error: "We don't know how to get the definition of mbstate_t without <wchar.h> on your platform."
   51 | #  error "We don't know how to get the definition of mbstate_t without <wchar.h> on your platform."
      |    ^
In file included from C:\GitHubClonesDev\llvm-project\libcxxabi\src\cxa_demangle.cpp:17:
In file included from C:\GitHubClonesDev\llvm-project\libcxxabi\src/demangle/ItaniumDemangle.h:20:
In file included from C:\GitHubClonesDev\llvm-project\libcxxabi\src/demangle/StringViewExtras.h:20:
In file included from C:/GitHubClonesDev/llvm-project/build/include/c++/v1/string_view:225:
In file included from C:/GitHubClonesDev/llvm-project/build/include/c++/v1/__string/char_traits.h:27:
C:/GitHubClonesDev/llvm-project/build/include/c++/v1/iosfwd:136:14: error: reference to unresolved using declaration
  136 | typedef fpos<mbstate_t> streampos;
      |              ^
C:/GitHubClonesDev/llvm-project/build/include/c++/v1/__std_mbstate_t.h:25:1: note: using declaration annotated with 'using_if_exists' here
   25 | using ::mbstate_t _LIBCPP_USING_IF_EXISTS;

Any thoughts appreciated.

This is for this project:

thanks

This looks like this bug report

thanks. That does indeed look like the bug.