microsoft / microsoft/onnxruntime
Linux wants const char but Windoze wants const wchar_t in Ort::Session::Session
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 21.9k
- Forks
- 4.2k
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 184
Description
Describe the issue
I am compiling in both windows and linux onnxruntime version 1.14.1.
According to the documentation in here, the signature for the session ctor is:
Ort::Session::Session(Ort::Env&, const char*, Ort::SessionOptions)
In linux this seems to be so, but when compiling in windows, the compilation fails and the compiler complains about const char* and says that the ctor signature is this one instead:
Ort::Session::Session(const Ort::Env &,const wchar_t *,const Ort::SessionOptions &)
On the other hand, if I try to do that in linux, it fails (it wants const char*), so this is pretty bad inconsistency if one wants to write architecture-independent code: in linux it must be const char* and in windows const w_char*.
Urgency
No response
Target platform
linux AND windows
Build script
CMake: msbuild.exe in windows and make in linux
Error / output
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\memory(3393,35): error C2665: 'Ort::Session::Session': no overloaded function could conver
t all the argument types [Z:\home\sampsa\repos\mnist-test\deploy\onnx\winbuild\onnx_wrap.vcxproj]
C:\Program Files\onnxruntime\include\onnxruntime_cxx_inline.h(937,17): message : could be 'Ort::Session::Session(const Ort::Env &,const wchar_t *,const Ort::SessionOptions &)' [Z:\
home\sampsa\repos\mnist-test\deploy\onnx\winbuild\onnx_wrap.vcxproj]
Visual Studio Version
No response
GCC / Compiler Version
No response
Contributor guide
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 with the documented Ort::Session constructor and the implementation around line 937 of onnxruntime_cxx_inline.h. Reproduce the constructor call with the CMake/MSBuild Windows build and the Linux make build, then compare the platform-specific declarations and documentation. Done means the cross-platform constructor behavior and its documentation are consistent, with coverage for both targets.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100