Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update wasi-libc and Makefile to fix <fstream> #375

Merged
merged 1 commit into from
Jan 12, 2024

Conversation

dicej
Copy link
Contributor

@dicej dicej commented Jan 11, 2024

As of LLVM 17, which includes https://reviews.llvm.org/D152168, libcxx has combined the old _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY and _LIBCPP_HAS_NO_FSTREAM preprocessor symbols into a single _LIBCPP_HAS_NO_FILESYSTEM symbol, which means there's no longer any way to enable <fstream> without enabling <filesystem>.

The solution is to set -DLIBCXX_ENABLE_FILESYSTEM:BOOL=ON and update wasi-libc, which includes stubs for the functions required by libcxx's <filesystem> implementation.

Fixes #373

As of LLVM 17, which includes https://reviews.llvm.org/D152168, libcxx has
combined the old `_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY` and
`_LIBCPP_HAS_NO_FSTREAM` preprocessor symbols into a single
`_LIBCPP_HAS_NO_FILESYSTEM` symbol, which means there's no longer any way to
enable `<fstream>` without enabling `<filesystem>`.

The solution is to set `-DLIBCXX_ENABLE_FILESYSTEM:BOOL=ON` and update
`wasi-libc`, which includes stubs for the functions required by libcxx's
`<filesystem>` implementation.

Fixes WebAssembly#373

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
@abrown abrown merged commit 9fbc7b5 into WebAssembly:main Jan 12, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

libcxx's <fstream> no longer works as of wasi-sdk 21
2 participants