Build failure with protobuf 3.30
I get the following build error after Arch Linux updated to protobuf 3.30:
lib/config/proto.cc: In function ‘std::string getProtoFieldValue(ProtoField&)’:
lib/config/proto.cc:291:35: error: could not convert ‘enumvalue->google::protobuf::EnumValueDescriptor::name()’ from ‘google::protobuf::internal::DescriptorStringView’ {aka ‘std::basic_string_view<char>’} to ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’}
291 | return enumvalue->name();
| ~~~~~~~~~~~~~~~^~
| |
| google::protobuf::internal::DescriptorStringView {aka std::basic_string_view<char>}
lib/config/proto.cc: In instantiation of ‘findAllProtoFields(google::protobuf::Message*)::<lambda(auto:34*, const auto:35&)> [with auto:34 = const google::protobuf::Descriptor; auto:35 = std::__cxx11::basic_string<char>]’:
/usr/include/c++/14.2.1/type_traits:2655:26: required by substitution of ‘template<class _Fn, class ... _Args> static std::__result_of_success<decltype (declval<_Fn>()((declval<_Args>)()...)), std::__invoke_other> std::__result_of_other_impl::_S_test(int) [with _Fn = findAllProtoFields(google::protobuf::Message*)::<lambda(auto:34*, const auto:35&)>&; _Args = {const google::protobuf::Descriptor*, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&}]’
2655 | std::declval<_Fn>()(std::declval<_Args>()...)
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14.2.1/type_traits:2666:60: required from ‘struct std::__result_of_impl<false, false, findAllProtoFields(google::protobuf::Message*)::<lambda(auto:34*, const auto:35&)>&, const google::protobuf::Descriptor*, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>’
2666 | using type = decltype(_S_test<_Functor, _ArgTypes...>(0));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14.2.1/bits/std_function.h:348:9: recursively required by substitution of ‘template<class _Result, class _Ret> struct std::__is_invocable_impl<_Result, _Ret, true, std::__void_t<typename _CTp::type> > [with _Result = std::__invoke_result<findAllProtoFields(google::protobuf::Message*)::<lambda(auto:34*, const auto:35&)>&, const google::protobuf::Descriptor*, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>; _Ret = void]’
348 | struct _Callable
| ^~~~~~~~~
/usr/include/c++/14.2.1/bits/std_function.h:348:9: required from ‘struct std::function<void(const google::protobuf::Descriptor*, const std::__cxx11::basic_string<char>&)>::_Callable<findAllProtoFields(google::protobuf::Message*)::<lambda(auto:34*, const auto:35&)>, findAllProtoFields(google::protobuf::Message*)::<lambda(auto:34*, const auto:35&)>, std::__invoke_result<findAllProtoFields(google::protobuf::Message*)::<lambda(auto:34*, const auto:35&)>&, const google::protobuf::Descriptor*, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&> >’
/usr/include/c++/14.2.1/bits/std_function.h:353:41: required by substitution of ‘template<class _Res, class ... _ArgTypes> template<class _Cond, class _Tp> using std::function<_Res(_ArgTypes ...)>::_Requires = std::__enable_if_t<((bool)_Cond::value), _Tp> [with _Cond = std::function<void(const google::protobuf::Descriptor*, const std::__cxx11::basic_string<char>&)>::_Callable<findAllProtoFields(google::protobuf::Message*)::<lambda(auto:34*, const auto:35&)>, findAllProtoFields(google::protobuf::Message*)::<lambda(auto:34*, const auto:35&)>, std::__invoke_result<findAllProtoFields(google::protobuf::Message*)::<lambda(auto:34*, const auto:35&)>&, const google::protobuf::Descriptor*, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&> >; _Tp = void; _Res = void; _ArgTypes = {const google::protobuf::Descriptor*, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&}]’
353 | using _Requires = __enable_if_t<_Cond::value, _Tp>;
| ^~~~~
/usr/include/c++/14.2.1/bits/std_function.h:434:9: required by substitution of ‘template<class _Functor, class _Constraints> std::function<void(const google::protobuf::Descriptor*, const std::__cxx11::basic_string<char>&)>::function(_Functor&&) [with _Functor = findAllProtoFields(google::protobuf::Message*)::<lambda(auto:34*, const auto:35&)>; _Constraints = <missing>]’
434 | typename _Constraints = _Requires<_Callable<_Functor>>>
| ^~~~~~~~
lib/config/proto.cc:366:5: required from here
366 | };
| ^
lib/config/proto.cc:358:31: error: no match for ‘operator+’ (operand types are ‘const std::__cxx11::basic_string<char>’ and ‘google::protobuf::internal::DescriptorStringView’ {aka ‘std::basic_string_view<char>’})
358 | std::string n = s + f->name();
| ~~^~~~~~~~~~~
In file included from /usr/include/c++/14.2.1/bits/stl_algobase.h:67,
from /usr/include/c++/14.2.1/bits/hashtable_policy.h:36,
from /usr/include/c++/14.2.1/bits/hashtable.h:35,
from /usr/include/c++/14.2.1/bits/unordered_map.h:33,
from /usr/include/c++/14.2.1/unordered_map:41,
from /usr/include/c++/14.2.1/functional:63,
from .obj/unix/lib/core/+core_hdr/lib/core/globals.h:5,
from lib/config/proto.cc:1:
/usr/include/c++/14.2.1/bits/stl_iterator.h:627:5: note: candidate: ‘template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)’
627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14.2.1/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed:
lib/config/proto.cc:358:31: note: ‘google::protobuf::internal::DescriptorStringView’ {aka ‘std::basic_string_view<char>’} is not derived from ‘const std::reverse_iterator<_Iterator>’
358 | std::string n = s + f->name();
| ~~^~~~~~~~~~~
/usr/include/c++/14.2.1/bits/stl_iterator.h:1798:5: note: candidate: ‘template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)’
1798 | operator+(typename move_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14.2.1/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed:
lib/config/proto.cc:358:31: note: ‘google::protobuf::internal::DescriptorStringView’ {aka ‘std::basic_string_view<char>’} is not derived from ‘const std::move_iterator<_IteratorL>’
358 | std::string n = s + f->name();
| ~~^~~~~~~~~~~
In file included from /usr/include/c++/14.2.1/string:54,
from /usr/include/c++/14.2.1/bits/locale_classes.h:40,
from /usr/include/c++/14.2.1/bits/ios_base.h:41,
from /usr/include/c++/14.2.1/ios:44,
from /usr/include/c++/14.2.1/ostream:40,
from /usr/include/c++/14.2.1/iostream:41,
from .obj/unix/lib/core/+core_hdr/lib/core/globals.h:7:
/usr/include/c++/14.2.1/bits/basic_string.h:3598:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)’
3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed:
lib/config/proto.cc:358:31: note: ‘google::protobuf::internal::DescriptorStringView’ {aka ‘std::basic_string_view<char>’} is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’
358 | std::string n = s + f->name();
| ~~^~~~~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3616:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)’
3616 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed:
lib/config/proto.cc:358:31: note: mismatched types ‘const _CharT*’ and ‘std::__cxx11::basic_string<char>’
358 | std::string n = s + f->name();
| ~~^~~~~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3635:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)’
3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs)
| ^~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed:
lib/config/proto.cc:358:31: note: ‘google::protobuf::internal::DescriptorStringView’ {aka ‘std::basic_string_view<char>’} is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’
358 | std::string n = s + f->name();
| ~~^~~~~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3652:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)’
3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed:
lib/config/proto.cc:358:31: note: mismatched types ‘const _CharT*’ and ‘std::basic_string_view<char>’
358 | std::string n = s + f->name();
| ~~^~~~~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3670:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)’
3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
| ^~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed:
lib/config/proto.cc:358:31: note: deduced conflicting types for parameter ‘_CharT’ (‘char’ and ‘std::basic_string_view<char>’)
358 | std::string n = s + f->name();
| ~~^~~~~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3682:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)’
3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed:
lib/config/proto.cc:358:31: note: types ‘std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’ and ‘const std::__cxx11::basic_string<char>’ have incompatible cv-qualifiers
358 | std::string n = s + f->name();
| ~~^~~~~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3689:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)’
3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed:
lib/config/proto.cc:358:31: note: ‘google::protobuf::internal::DescriptorStringView’ {aka ‘std::basic_string_view<char>’} is not derived from ‘std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’
358 | std::string n = s + f->name();
| ~~^~~~~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3696:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)’
3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed:
lib/config/proto.cc:358:31: note: types ‘std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’ and ‘const std::__cxx11::basic_string<char>’ have incompatible cv-qualifiers
358 | std::string n = s + f->name();
| ~~^~~~~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3719:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)’
3719 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed:
lib/config/proto.cc:358:31: note: mismatched types ‘const _CharT*’ and ‘std::__cxx11::basic_string<char>’
358 | std::string n = s + f->name();
| ~~^~~~~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3726:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)’
3726 | operator+(_CharT __lhs,
| ^~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed:
lib/config/proto.cc:358:31: note: ‘google::protobuf::internal::DescriptorStringView’ {aka ‘std::basic_string_view<char>’} is not derived from ‘std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’
358 | std::string n = s + f->name();
| ~~^~~~~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3733:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)’
3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed:
lib/config/proto.cc:358:31: note: types ‘std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’ and ‘const std::__cxx11::basic_string<char>’ have incompatible cv-qualifiers
358 | std::string n = s + f->name();
| ~~^~~~~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3740:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)’
3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14.2.1/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed:
lib/config/proto.cc:358:31: note: types ‘std::__cxx11::basic_string<_CharT, _Traits, _Allocator>’ and ‘const std::__cxx11::basic_string<char>’ have incompatible cv-qualifiers
358 | std::string n = s + f->name();
| ~~^~~~~~~~~~~
Compiler is GCC 14.2.1.
Sigh, protobuf 30 now returns string_views instead of std::strings and for some reason, string_views cannot be implicitly converted to std::strings.
The fix is easy. Will take a look. Thanks for the bug report.
Any news? I fell for the same issue. Just made a Manjaro update, but it's the same before and after. protobuf shows version 30.1-1 I am on Manjaro stable. Why is your version different?
Thanks
I thought I'd fixed this. Let me take a look.
This should be properly fixed now. I hope.