microsoft / microsoft/onnxruntime-extensions
windows: clang: file_sys.h does not work
Open
Beginner friendly
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 479
- Forks
- 144
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 11
Description
With libc++ on windows the code in file_sys.h is wrong, as std::ifstream works with char and not whcar_t:
D:/a/score-addon-onnx/score-addon-onnx/addon/3rdparty/onnxruntime-extensions/base/file_sys.h:54:12: error: no matching constructor for initialization of 'std::ifstream' (aka 'basic_ifstream<char>')
54 | return std::ifstream(w_path_, mode);
| ^ ~~~~~~~~~~~~~
C:/ossia-sdk-x86_64/llvm/include/c++/v1/fstream:1111:34: note: candidate constructor not viable: no known conversion from 'const std::wstring' (aka 'const basic_string<wchar_t>') to 'const char *' for 1st argument
1111 | _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
| ^ ~~~~~~~~~~~~~~~
C:/ossia-sdk-x86_64/llvm/include/c++/v1/fstream:1113:34: note: candidate constructor not viable: no known conversion from 'const std::wstring' (aka 'const basic_string<wchar_t>') to 'const wchar_t *' for 1st argument
1113 | _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::in);
| ^ ~~~~~~~~~~~~~~~~~~
C:/ossia-sdk-x86_64/llvm/include/c++/v1/fstream:1115:34: note: candidate constructor not viable: no known conversion from 'const basic_string<wchar_t>' to 'const basic_string<char>' for 1st argument
1115 | _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
| ^ ~~~~~~~~~~~~~~~~~
C:/ossia-sdk-x86_64/llvm/include/c++/v1/fstream:1119:38: note: candidate template ignored: requirement 'is_same_v<std::wstring, std::filesystem::path>' was not satisfied [with _Tp = std::wstring]
1119 | _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const _Tp& __p, ios_base::openmode __mode = ios_base::in)
| ^
C:/ossia-sdk-x86_64/llvm/include/c++/v1/fstream:1122:25: note: candidate constructor not viable: requires single argument '__rhs', but 2 arguments were provided
1122 | _LIBCPP_HIDE_FROM_ABI basic_ifstream(basic_ifstream&& __rhs);
| ^ ~~~~~~~~~~~~~~~~~~~~~~
C:/ossia-sdk-x86_64/llvm/include/c++/v1/__fwd/fstream.h:24:28: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
24 | class _LIBCPP_TEMPLATE_VIS basic_ifstream;
| ^~~~~~~~~~~~~~
C:/ossia-sdk-x86_64/llvm/include/c++/v1/fstream:1110:25: note: candidate constructor not viable: requires 0 arguments, but 2 were provided
1110 | _LIBCPP_HIDE_FROM_ABI basic_ifstream();
| ^
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in addon/3rdparty/onnxruntime-extensions/base/file_sys.h at line 54 and reproduce the Windows libc++ compilation error shown in the issue. Inspect how the std::wstring path is passed to std::ifstream, then verify the corrected handling builds successfully with clang and libc++ on Windows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 74/100