windows: open files via std::filesystem::path so libc++ accepts wide paths#1084
Open
jcelerier wants to merge 1 commit into
Open
windows: open files via std::filesystem::path so libc++ accepts wide paths#1084jcelerier wants to merge 1 commit into
jcelerier wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Windows builds using clang/libc++ by avoiding the non-standard MSVC-only std::ifstream(std::wstring, ...) overload, instead opening files via the standard C++17 std::ifstream(std::filesystem::path, ...) path-based constructor to preserve UTF-16 filenames.
Changes:
- Add
<filesystem>to support standard path-based stream constructors. - Update
ort_extensions::path::open()on Windows to construct anstd::ifstreamfromstd::filesystem::path(w_path_).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jcelerier
added a commit
to ossia/score-addon-onnx
that referenced
this pull request
Jun 24, 2026
The onnxruntime-extensions Windows build was force-disabled because the upstream base/file_sys.h does not compile with clang + libc++ (the ossia Windows toolchain): it constructs a std::ifstream from a std::wstring, an overload only MSVC's STL provides (issue #985 / #1071). Point the submodule at the ossia fork carrying the one-line fix -- open files via std::filesystem::path, whose basic_ifstream ctor is standard C++17 and honoured by libc++ -- filed upstream as microsoft/onnxruntime-extensions#1084. With that, drop the WIN32 guard so FastVLM/QwenLLM build on every non-wasm back-end, score and standalone alike. (Windows itself is CI-verified-pending; Linux standalone still builds pyfastvlm.so + pyqwenllm.so.) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ieWXB1cvaTVuVGuEmyKKP
…paths base/file_sys.h's path::open() built a std::ifstream straight from the std::wstring w_path_ on Windows. That ctor overload is a Microsoft-STL extension; libc++ (the clang Windows toolchain) does not provide it, so the header fails to compile with "no matching constructor for initialization of 'std::ifstream'". Construct a std::filesystem::path from the wide string instead -- basic_ifstream's filesystem::path ctor is standard C++17, honoured by libc++/libstdc++/MSVC STL, and still preserves the UTF-16 path. Fixes microsoft#1071.
b9652aa to
7d48543
Compare
jcelerier
added a commit
to ossia/score-addon-onnx
that referenced
this pull request
Jun 26, 2026
The onnxruntime-extensions Windows build was force-disabled because the upstream base/file_sys.h does not compile with clang + libc++ (the ossia Windows toolchain): it constructs a std::ifstream from a std::wstring, an overload only MSVC's STL provides (issue #985 / #1071). Point the submodule at the ossia fork carrying the one-line fix -- open files via std::filesystem::path, whose basic_ifstream ctor is standard C++17 and honoured by libc++ -- filed upstream as microsoft/onnxruntime-extensions#1084. With that, drop the WIN32 guard so FastVLM/QwenLLM build on every non-wasm back-end, score and standalone alike. (Windows itself is CI-verified-pending; Linux standalone still builds pyfastvlm.so + pyqwenllm.so.) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ieWXB1cvaTVuVGuEmyKKP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
base/file_sys.h'spath::open()constructs astd::ifstreamdirectly from thestd::wstring w_path_on Windows:That
basic_ifstreamoverload taking a wide string is a Microsoft-STL extension. libc++ (the clang Windows toolchain) does not provide it, so the header fails to compile:This fixes it by constructing a
std::filesystem::pathfrom the wide string and usingbasic_ifstream'sfilesystem::pathconstructor, which is standard C++17 and honoured by libc++, libstdc++ and MSVC STL alike — while still preserving the UTF-16 path for Unicode filenames.Fixes #1071 (and the earlier #985).