snakers4 / silero-vad

Silero VAD: pre-trained enterprise-grade Voice Activity Detector
MIT License
4.41k stars 432 forks source link

[C++] Compilation issue #524

Open laishramrahul opened 3 months ago

laishramrahul commented 3 months ago

Error compiling silero-vad-onnx.cpp

Error while compliling the c++ version of silero-v5, below is the error message, please help

g++ silero-vad-onnx.cpp -I /home/lrahul/workspace/onnxruntime-linux-x64-1.12.1/include/ -L /home/lrahul/workspace/onnxruntime-linux-x64-1.12.1/lib/ -lonnxruntime -Wl,-rpath,/home/lrahul/workspace/onnxruntime-linux-x64-1.12.1/lib/ -o vad In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/c++allocator.h:33, from /usr/include/c++/11/bits/allocator.h:46, from /usr/include/c++/11/string:41, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from silero-vad-onnx.cpp:1: /usr/include/c++/11/ext/new_allocator.h: In instantiation of ‘void gnu_cxx::new_allocator<_Tp>::construct(_Up, _Args&& ...) [with _Up = Ort::Session; _Args = {Ort::Env&, const wchar_t, Ort::SessionOptions&}; _Tp = Ort::Session]’: /usr/include/c++/11/bits/alloc_traits.h:516:17: required from ‘static void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up, _Args&& ...) [with _Up = Ort::Session; _Args = {Ort::Env&, const wchar_t, Ort::SessionOptions&}; _Tp = Ort::Session; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocator]’ /usr/include/c++/11/bits/shared_ptr_base.h:519:39: required from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {Ort::Env&, const wchar_t*, Ort::SessionOptions&}; _Tp = Ort::Session; _Alloc = std::allocator; gnu_cxx::_Lock_policy _Lp = gnu_cxx::_S_atomic]’ /usr/include/c++/11/bits/shared_ptr_base.h:650:16: required from ‘std::shared_count<_Lp>::shared_count(_Tp&, std::_Sp_alloc_shared_tag<_Alloc>, _Args&& ...) [with _Tp = Ort::Session; _Alloc = std::allocator; _Args = {Ort::Env&, const wchar_t, Ort::SessionOptions&}; gnu_cxx::_Lock_policy _Lp = gnu_cxx::_S_atomic]’ /usr/include/c++/11/bits/shared_ptr_base.h:1342:14: required from ‘std::__shared_ptr<_Tp, _Lp>::shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator; _Args = {Ort::Env&, const wchar_t, Ort::SessionOptions&}; _Tp = Ort::Session; gnu_cxx::_Lock_policy _Lp = gnu_cxx::_S_atomic]’ /usr/include/c++/11/bits/shared_ptr.h:409:59: required from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator; _Args = {Ort::Env&, const wchar_t, Ort::SessionOptions&}; _Tp = Ort::Session]’ /usr/include/c++/11/bits/shared_ptr.h:862:14: required from ‘std::shared_ptr<_Tp> std::allocate_shared(const _Alloc&, _Args&& ...) [with _Tp = Ort::Session; _Alloc = std::allocator; _Args = {Ort::Env&, const wchar_t, Ort::SessionOptions&}]’ /usr/include/c++/11/bits/shared_ptr.h:878:39: required from ‘std::shared_ptr<_Tp> std::make_shared(_Args&& ...) [with _Tp = Ort::Session; _Args = {Ort::Env&, const wchar_t, Ort::SessionOptions&}]’ silero-vad-onnx.cpp:117:49: required from here /usr/include/c++/11/ext/new_allocator.h:162:11: error: no matching function for call to ‘Ort::Session::Session(Ort::Env&, const wchar_t, Ort::SessionOptions&)’ 162 | { ::new((void )p) _Up(std::forward<_Args>(args)...); } | ^~~~~~~~~~~~~~ In file included from /home/lrahul/workspace/onnxruntime-linux-x64-1.12.1/include/onnxruntime_cxx_api.h:1229, from silero-vad-onnx.cpp:12: /home/lrahul/workspace/onnxruntime-linux-x64-1.12.1/include/onnxruntime_cxx_inline.h:604:8: note: candidate: ‘Ort::Session::Session(Ort::Env&, const void, size_t, const Ort::SessionOptions&)’ 604 | inline Session::Session(Env& env, const void model_data, size_t model_data_length, const SessionOptions& options) { | ^~~ /home/lrahul/workspace/onnxruntime-linux-x64-1.12.1/include/onnxruntime_cxx_inline.h:604:8: note: candidate expects 4 arguments, 3 provided /home/lrahul/workspace/onnxruntime-linux-x64-1.12.1/include/onnxruntime_cxx_inline.h:599:8: note: candidate: ‘Ort::Session::Session(Ort::Env&, const char, const Ort::SessionOptions&, OrtPrepackedWeightsContainer)’ 599 | inline Session::Session(Env& env, const ORTCHAR_T model_path, const SessionOptions& options, | ^~~ /home/lrahul/workspace/onnxruntime-linux-x64-1.12.1/include/onnxruntime_cxx_inline.h:599:8: note: candidate expects 4 arguments, 3 provided /home/lrahul/workspace/onnxruntime-linux-x64-1.12.1/include/onnxruntime_cxx_inline.h:595:8: note: candidate: ‘Ort::Session::Session(Ort::Env&, const char, const Ort::SessionOptions&)’ 595 | inline Session::Session(Env& env, const ORTCHAR_T model_path, const SessionOptions& options) { | ^~~ /home/lrahul/workspace/onnxruntime-linux-x64-1.12.1/include/onnxruntime_cxx_inline.h:595:52: note: no known conversion for argument 2 from ‘const wchar_t’ to ‘const char’ 595 | inline Session::Session(Env& env, const ORTCHAR_T model_path, const SessionOptions& options) { | ~~~^~~~ In file included from silero-vad-onnx.cpp:12: /home/lrahul/workspace/onnxruntime-linux-x64-1.12.1/include/onnxruntime_cxx_api.h:513:12: note: candidate: ‘Ort::Session::Session(std::nullptr_t)’ 513 | explicit Session(std::nullptr_t) {} ///< Create an empty Session object, must be assigned a valid one to be used | ^~~ /home/lrahul/workspace/onnxruntime-linux-x64-1.12.1/include/onnxruntime_cxx_api.h:513:12: note: candidate expects 1 argument, 3 provided /home/lrahul/workspace/onnxruntime-linux-x64-1.12.1/include/onnxruntime_cxx_api.h:512:8: note: candidate: ‘Ort::Session::Session(Ort::Session&&)’ 512 | struct Session : Base { | ^~~

IntendedConsequence commented 2 months ago

Possible solution: https://github.com/snakers4/silero-vad/issues/451