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

[Build] Onnxruntime with OpenVino error: no match for ‘operator=’ #22175

Open
timorkal opened this issue Sep 23, 2024 · 3 comments
Open

[Build] Onnxruntime with OpenVino error: no match for ‘operator=’ #22175

timorkal opened this issue Sep 23, 2024 · 3 comments
Labels
build build issues; typically submitted using template ep:OpenVINO issues related to OpenVINO execution provider stale issues that have not been addressed in a while; categorized by a bot

Comments

@timorkal
Copy link

Describe the issue

When trying to build onnxruntime v1.19.2 with Openvino 2024.4.0 I am getting this error during the build:
error: no match for ‘operator=’

I am building in a docker container based on debian:stable-slim.

Urgency

No strict urgency

Target platform

Linux 64bit

Build script

./build.sh --config Release --use_openvino "AUTO:GPU,CPU" --build_shared_lib --parallel --skip_tests --allow_running_as_root

Error / output

/onnxruntime/onnxruntime/core/providers/openvino/openvino_execution_provider.h: In constructor ‘onnxruntime::OpenVINOExecutionProviderInfo::OpenVINOExecutionProviderInfo(const std::string&, const std::string&, bool, size_t, const std::string&, const std::string&, int, void*, bool, bool, bool, bool, bool, bool)’:
: error: no match for ‘operator=’ (operand types are ‘const std::string’ {aka ‘const std::__cxx11::basic_string’} and ‘const char [13]’)
In file included from /usr/include/c++/12/string:53,
from /usr/include/c++/12/stdexcept:39,
from /usr/include/c++/12/system_error:41,
from /usr/include/c++/12/bits/fs_fwd.h:35,
from /usr/include/c++/12/filesystem:44,
from /onnxruntime/onnxruntime/core/providers/openvino/openvino_execution_provider.cc:3:
/usr/include/c++/12/bits/basic_string.h:844:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’ (near match)
844 | operator=(basic_string&& __str)
| ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:844:7: note: passing ‘const std::string*’ {aka ‘const std::__cxx11::basic_string’} as ‘this’ argument discards qualifiers
/usr/include/c++/12/bits/basic_string.h:826:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’ (near match)
826 | operator=(_CharT __c)
| ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:826:7: note: conversion of argument 1 would be ill-formed:
: error: invalid conversion from ‘const char
’ to ‘char’ [-fpermissive]
/usr/include/c++/12/bits/basic_string.h:814:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’ (near match)
814 | operator=(const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:814:7: note: passing ‘const std::string*’ {aka ‘const std::__cxx11::basic_string’} as ‘this’ argument discards qualifiers
/usr/include/c++/12/bits/basic_string.h:803:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’ (near match)
803 | operator=(const basic_string& __str)
| ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:803:7: note: passing ‘const std::string
’ {aka ‘const std::__cxx11::basic_string’} as ‘this’ argument discards qualifiers
/usr/include/c++/12/bits/basic_string.h:913:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’
913 | operator=(initializer_list<_CharT> __l)
| ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:913:42: note: no known conversion for argument 1 from ‘const char [13]’ to ‘std::initializer_list’
913 | operator=(initializer_list<_CharT> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/12/bits/basic_string.h:928:8: note: candidate: ‘template std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _Tp&) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’
928 | operator=(const _Tp& __svt)
| ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:928:8: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/12/bits/move.h:57,
from /usr/include/c++/12/bits/exception_ptr.h:43,
from /usr/include/c++/12/exception:168,
from /usr/include/c++/12/stdexcept:38:
/usr/include/c++/12/type_traits: In substitution of ‘template<bool _Cond, class _Tp> using enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::__cxx11::basic_string&]’:
/usr/include/c++/12/bits/basic_string.h:155:8: required by substitution of ‘template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using _If_sv = std::enable_if_t<std::_and<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::_not<std::is_convertible<const _Tp
, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>> >, std::_not<std::is_convertible<const _Tp&, const _CharT> > >::value, _Res> [with _Tp = char [13]; _Res = std::__cxx11::basic_string&; _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’
/usr/include/c++/12/bits/basic_string.h:928:8: required by substitution of ‘template std::__cxx11::basic_string::_If_sv<_Tp, std::__cxx11::basic_string&> std::__cxx11::basic_string::operator=(const _Tp&) [with _Tp = char [13]]’
/onnxruntime/onnxruntime/core/providers/openvino/openvino_execution_provider.h:145:18: required from here
/usr/include/c++/12/type_traits:2614:11: error: no type named ‘type’ in ‘struct std::enable_if<false, std::__cxx11::basic_string&>’
2614 | using enable_if_t = typename enable_if<_Cond, _Tp>::type;
| ^~~~~~~~~~~

Visual Studio Version

No response

GCC / Compiler Version

12.2.0

@timorkal timorkal added the build build issues; typically submitted using template label Sep 23, 2024
@github-actions github-actions bot added the ep:OpenVINO issues related to OpenVINO execution provider label Sep 23, 2024
@zoulee24
Copy link

zoulee24 commented Sep 29, 2024

same problem

openvino-2024.04.0.0

./build.sh --allow_running_as_root --config Release --update --build --parallel --use_openvino AUTO:GPU,CPU --build_shared_lib --skip_tests --skip_onnx_tests
/home/openvino/onnxruntime/onnxruntime/core/providers/openvino/openvino_execution_provider.h: In constructor ‘onnxruntime::OpenVINOExecutionProviderInfo::OpenVINOExecutionProviderInfo(const string&, const string&, bool, size_t, const string&, const string&, int, void*, bool, bool, bool, bool, bool, bool)’:
<command-line>: error: no match for ‘operator=’ (operand types are ‘const string’ {aka ‘const std::__cxx11::basic_string<char>’} and ‘const char [13]’)
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/stdexcept:39,
                 from /usr/include/c++/11/system_error:41,
                 from /usr/include/c++/11/bits/fs_fwd.h:35,
                 from /usr/include/c++/11/filesystem:44,
                 from /home/openvino/onnxruntime/onnxruntime/core/providers/openvino/openvino_execution_provider.cc:3:
/usr/include/c++/11/bits/basic_string.h:799:8: note: candidate: ‘template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _Tp&) [with _Tp = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
  799 |        operator=(const _Tp& __svt)
      |        ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:799:8: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/11/bits/move.h:57,
                 from /usr/include/c++/11/bits/exception_ptr.h:43,
                 from /usr/include/c++/11/exception:153,
                 from /usr/include/c++/11/stdexcept:38,
                 from /usr/include/c++/11/system_error:41,
                 from /usr/include/c++/11/bits/fs_fwd.h:35,
                 from /usr/include/c++/11/filesystem:44,
                 from /home/openvino/onnxruntime/onnxruntime/core/providers/openvino/openvino_execution_provider.cc:3:
/usr/include/c++/11/type_traits: In substitution of ‘template<bool _Cond, class _Tp> using enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::__cxx11::basic_string<char>&]’:
/usr/include/c++/11/bits/basic_string.h:125:8:   required by substitution of ‘template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using _If_sv = std::enable_if_t<std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value, _Res> [with _Tp = char [13]; _Res = std::__cxx11::basic_string<char>&; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
/usr/include/c++/11/bits/basic_string.h:799:8:   required by substitution of ‘template<class _Tp> std::__cxx11::basic_string<char>::_If_sv<_Tp, std::__cxx11::basic_string<char>&> std::__cxx11::basic_string<char>::operator=<_Tp>(const _Tp&) [with _Tp = char [13]]’
/home/openvino/onnxruntime/onnxruntime/core/providers/openvino/openvino_execution_provider.h:145:18:   required from here
/usr/include/c++/11/type_traits:2579:11: error: no type named ‘type’ in ‘struct std::enable_if<false, std::__cxx11::basic_string<char>&>’
 2579 |     using enable_if_t = typename enable_if<_Cond, _Tp>::type;
      |           ^~~~~~~~~~~
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/stdexcept:39,
                 from /usr/include/c++/11/system_error:41,
                 from /usr/include/c++/11/bits/fs_fwd.h:35,
                 from /usr/include/c++/11/filesystem:44,
                 from /home/openvino/onnxruntime/onnxruntime/core/providers/openvino/openvino_execution_provider.cc:3:
/usr/include/c++/11/bits/basic_string.h:679:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ (near match)
  679 |       operator=(const basic_string& __str)
      |       ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:679:7: note:   passing ‘const string*’ {aka ‘const std::__cxx11::basic_string<char>*’} as ‘this’ argument discards qualifiers
/usr/include/c++/11/bits/basic_string.h:689:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ (near match)
  689 |       operator=(const _CharT* __s)
      |       ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:689:7: note:   passing ‘const string*’ {aka ‘const std::__cxx11::basic_string<char>*’} as ‘this’ argument discards qualifiers
/usr/include/c++/11/bits/basic_string.h:700:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ (near match)
  700 |       operator=(_CharT __c)
      |       ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:700:7: note:   conversion of argument 1 would be ill-formed:
<command-line>: error: invalid conversion from ‘const char*’ to ‘char’ [-fpermissive]
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/stdexcept:39,
                 from /usr/include/c++/11/system_error:41,
                 from /usr/include/c++/11/bits/fs_fwd.h:35,
                 from /usr/include/c++/11/filesystem:44,
                 from /home/openvino/onnxruntime/onnxruntime/core/providers/openvino/openvino_execution_provider.cc:3:
/usr/include/c++/11/bits/basic_string.h:717:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ (near match)
  717 |       operator=(basic_string&& __str)
      |       ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:717:7: note:   passing ‘const string*’ {aka ‘const std::__cxx11::basic_string<char>*’} as ‘this’ argument discards qualifiers
/usr/include/c++/11/bits/basic_string.h:785:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
  785 |       operator=(initializer_list<_CharT> __l)
      |       ^~~~~~~~
/usr/include/c++/11/bits/basic_string.h:785:42: note:   no known conversion for argument 1 from ‘const char [13]’ to ‘std::initializer_list<char>’
  785 |       operator=(initializer_list<_CharT> __l)

@zoulee24
Copy link

i fix it!
go to path onnxruntime/core/providers/openvino/openvino_execution_provider.h edit openvino_execution_provider.h in line 145

origin:

#elif defined OPENVINO_CONFIG_HETERO || defined OPENVINO_CONFIG_MULTI || defined OPENVINO_CONFIG_AUTO
#ifdef DEVICE_NAME
#define DEVICE DEVICE_NAME
#endif
      dev_type = DEVICE;

      if (dev_type.find("HETERO") == 0 || dev_type.find("MULTI") == 0 || dev_type.find("AUTO") == 0) {
        std::vector<std::string> devices = parseDevices(dev_type, available_devices);
        precision_ = "FP16";
        if (devices[0] == "CPU") {
          precision_ = "FP32";
        }
        device_type_ = std::move(dev_type);
      }
#endif
#elif defined OPENVINO_CONFIG_HETERO || defined OPENVINO_CONFIG_MULTI || defined OPENVINO_CONFIG_AUTO
#ifdef DEVICE_NAME
#define DEVICE DEVICE_NAME
#endif
      // dev_type = DEVICE;
      auto temp_dev_type = std::string(DEVICE);

      if (temp_dev_type.find("HETERO") == 0 || temp_dev_type.find("MULTI") == 0 || temp_dev_type.find("AUTO") == 0) {
        std::vector<std::string> devices = parseDevices(temp_dev_type, available_devices);
        precision_ = "FP16";
        if (devices[0] == "CPU") {
          precision_ = "FP32";
        }
        device_type_ = std::move(temp_dev_type);
      }
#endif

try it plz

Copy link
Contributor

This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.

@github-actions github-actions bot added the stale issues that have not been addressed in a while; categorized by a bot label Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build issues; typically submitted using template ep:OpenVINO issues related to OpenVINO execution provider stale issues that have not been addressed in a while; categorized by a bot
Projects
None yet
Development

No branches or pull requests

2 participants