facebookincubator/fizz

`FizzCommandCommon.cpp: error: no matching function for call to 'std::basic_string<char>::erase(__gnu_cxx::__normal_iterator<char*, std::basic_string<char> >, std::basic_string<char>::const_iterator)'`

barracuda156 opened this issue · 7 comments

Could someone say why this may fail?
(To be clear, this is not necessarily a bug in fizz code, since we have to patch folly in a few places to fix it for Big-endian platforms, but it could be a fizz bug.)

:info:build FAILED: CMakeFiles/fizz.dir/tool/FizzCommandCommon.cpp.o 
:info:build /opt/local/bin/g++-mp-13 -DFMT_SHARED -DGFLAGS_IS_A_DLL=0 -Dfizz_EXPORTS -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.15.00 -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/build/generated -isystem /opt/local/include -isystem /opt/local/libexec/openssl3/include -isystem /opt/local/libexec/boost/1.81/include -isystem /opt/local/include/libfmt10 -pipe -I/opt/local/libexec/openssl3/include -I/opt/local/libexec/boost/1.81/include -Os -DNDEBUG -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -I/opt/local/libexec/boost/1.81/include -isystem/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -arch ppc -mmacosx-version-min=10.6 -fPIC -std=c++17 -MD -MT CMakeFiles/fizz.dir/tool/FizzCommandCommon.cpp.o -MF CMakeFiles/fizz.dir/tool/FizzCommandCommon.cpp.o.d -o CMakeFiles/fizz.dir/tool/FizzCommandCommon.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.15.00/fizz/tool/FizzCommandCommon.cpp
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.15.00/fizz/tool/FizzCommandCommon.cpp: In function 'folly::Optional<fizz::ech::ECHConfigList> fizz::tool::parseECHConfigsBase64(std::string)':
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.15.00/fizz/tool/FizzCommandCommon.cpp:176:28: error: no matching function for call to 'std::basic_string<char>::erase(__gnu_cxx::__normal_iterator<char*, std::basic_string<char> >, std::basic_string<char>::const_iterator)'
:info:build   176 |   echConfigListBase64.erase(
:info:build       |   ~~~~~~~~~~~~~~~~~~~~~~~~~^
:info:build   177 |       std::remove(echConfigListBase64.begin(), echConfigListBase64.end(), '\n'),
:info:build       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build   178 |       echConfigListBase64.cend());
:info:build       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build In file included from /opt/local/include/gcc13/c++/bits/basic_string.h:51,
:info:build                  from /opt/local/include/gcc13/c++/string:54,
:info:build                  from /opt/local/include/folly/lang/Exception.h:21,
:info:build                  from /opt/local/include/folly/Range.h:46,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.15.00/fizz/crypto/exchange/KeyExchange.h:11,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.15.00/fizz/crypto/exchange/OpenSSLKeyExchange.h:11,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.15.00/fizz/tool/FizzCommandCommon.cpp:10:
:info:build /opt/local/include/gcc13/c++/bits/cow_string.h:1718:7: note: candidate: 'std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::erase(size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
:info:build  1718 |       erase(size_type __pos = 0, size_type __n = npos)
:info:build       |       ^~~~~
:info:build /opt/local/include/gcc13/c++/bits/cow_string.h:1718:23: note:   no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<char*, std::basic_string<char> >' to 'std::basic_string<char>::size_type' {aka 'long unsigned int'}
:info:build  1718 |       erase(size_type __pos = 0, size_type __n = npos)
:info:build       |             ~~~~~~~~~~^~~~~~~~~
:info:build /opt/local/include/gcc13/c++/bits/cow_string.h:1734:7: note: candidate: 'std::basic_string<_CharT, _Traits, _Alloc>::iterator std::basic_string<_CharT, _Traits, _Alloc>::erase(iterator) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::basic_string<char>::iterator]'
:info:build  1734 |       erase(iterator __position)
:info:build       |       ^~~~~
:info:build /opt/local/include/gcc13/c++/bits/cow_string.h:1734:7: note:   candidate expects 1 argument, 2 provided
:info:build /opt/local/include/gcc13/c++/bits/cow_string.h:3372:6: note: candidate: 'std::basic_string<_CharT, _Traits, _Alloc>::iterator std::basic_string<_CharT, _Traits, _Alloc>::erase(iterator, iterator) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::basic_string<char>::iterator]'
:info:build  3372 |      basic_string<_CharT, _Traits, _Alloc>::
:info:build       |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build /opt/local/include/gcc13/c++/bits/cow_string.h:3373:39: note:   no known conversion for argument 2 from '__normal_iterator<const char*,[...]>' to '__normal_iterator<char*,[...]>'
:info:build  3373 |      erase(iterator __first, iterator __last)
:info:build       |                              ~~~~~~~~~^~~~~~

To be honest it looks like there is something wrong with types in fizz; it is unlikely to have anything to do with what we patch in folly.

Also fails with C++20 same way:

FAILED: CMakeFiles/fizz.dir/tool/FizzCommandCommon.cpp.o 
/opt/local/bin/g++-mp-13 -DFMT_SHARED -DGFLAGS_IS_A_DLL=0 -Dfizz_EXPORTS -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.15.00 -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/build/generated -isystem /opt/local/include -isystem /opt/local/libexec/openssl3/include -isystem /opt/local/libexec/boost/1.81/include -isystem /opt/local/include/libfmt10 -pipe -I/opt/local/libexec/openssl3/include -I/opt/local/libexec/boost/1.81/include -Os -DNDEBUG -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -I/opt/local/libexec/boost/1.81/include -isystem/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -arch ppc -mmacosx-version-min=10.6 -fPIC -std=c++20 -MD -MT CMakeFiles/fizz.dir/tool/FizzCommandCommon.cpp.o -MF CMakeFiles/fizz.dir/tool/FizzCommandCommon.cpp.o.d -o CMakeFiles/fizz.dir/tool/FizzCommandCommon.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.15.00/fizz/tool/FizzCommandCommon.cpp
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.15.00/fizz/tool/FizzCommandCommon.cpp: In function 'folly::Optional<fizz::ech::ECHConfigList> fizz::tool::parseECHConfigsBase64(std::string)':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.15.00/fizz/tool/FizzCommandCommon.cpp:176:28: error: no matching function for call to 'std::basic_string<char>::erase(__gnu_cxx::__normal_iterator<char*, std::basic_string<char> >, std::basic_string<char>::const_iterator)'
  176 |   echConfigListBase64.erase(
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~^
  177 |       std::remove(echConfigListBase64.begin(), echConfigListBase64.end(), '\n'),
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  178 |       echConfigListBase64.cend());
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/local/include/gcc13/c++/bits/basic_string.h:51,
                 from /opt/local/include/gcc13/c++/string:54,
                 from /opt/local/include/folly/lang/Exception.h:21,
                 from /opt/local/include/folly/Range.h:46,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.15.00/fizz/crypto/exchange/KeyExchange.h:11,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.15.00/fizz/crypto/exchange/OpenSSLKeyExchange.h:11,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.15.00/fizz/tool/FizzCommandCommon.cpp:10:
/opt/local/include/gcc13/c++/bits/cow_string.h:1718:7: note: candidate: 'std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::erase(size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 1718 |       erase(size_type __pos = 0, size_type __n = npos)
      |       ^~~~~
/opt/local/include/gcc13/c++/bits/cow_string.h:1718:23: note:   no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<char*, std::basic_string<char> >' to 'std::basic_string<char>::size_type' {aka 'long unsigned int'}
 1718 |       erase(size_type __pos = 0, size_type __n = npos)
      |             ~~~~~~~~~~^~~~~~~~~
/opt/local/include/gcc13/c++/bits/cow_string.h:1734:7: note: candidate: 'std::basic_string<_CharT, _Traits, _Alloc>::iterator std::basic_string<_CharT, _Traits, _Alloc>::erase(iterator) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::basic_string<char>::iterator]'
 1734 |       erase(iterator __position)
      |       ^~~~~
/opt/local/include/gcc13/c++/bits/cow_string.h:1734:7: note:   candidate expects 1 argument, 2 provided
/opt/local/include/gcc13/c++/bits/cow_string.h:3372:6: note: candidate: 'std::basic_string<_CharT, _Traits, _Alloc>::iterator std::basic_string<_CharT, _Traits, _Alloc>::erase(iterator, iterator) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::basic_string<char>::iterator]'
 3372 |      basic_string<_CharT, _Traits, _Alloc>::
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/gcc13/c++/bits/cow_string.h:3373:39: note:   no known conversion for argument 2 from '__normal_iterator<const char*,[...]>' to '__normal_iterator<char*,[...]>'
 3373 |      erase(iterator __first, iterator __last)
      |                              ~~~~~~~~~^~~~~~

These two commits have broken it: 6efc106 and 235358c

Hey @barracuda156,
I'm having trouble reproducing this build error on my MacOS 14.2.1 environment. Could you give more details on how you're building this?

Thanks

@NickR23 This is likely specific to libstdc++. While I have 14.2.1, I do not have a functional setup with libstdc++ on it at the moment.

My log is from 10.6 on PowerPC with gcc 13.2.0, but I suspect it should be reproducible on Intel as long as gcc with libstdc++ is used.

@NickR23 Still fails with v2024.01.22.00. Could I assist somehow with debugging beyond the log? If you suggest what I could try, I will do it.
It would be really nice to fix this properly instead of having to revert two commits.

[75/91] /opt/local/bin/g++-mp-13 -DFMT_SHARED -DGFLAGS_IS_A_DLL=0 -Dfizz_EXPORTS -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.22.00 -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/build/generated -isystem /opt/local/include -isystem /opt/local/libexec/openssl3/include -isystem /opt/local/libexec/boost/1.81/include -isystem /opt/local/include/libfmt10 -pipe -I/opt/local/libexec/openssl3/include -I/opt/local/libexec/boost/1.81/include -Os -DNDEBUG -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -I/opt/local/libexec/boost/1.81/include -isystem/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -arch ppc -mmacosx-version-min=10.6 -fPIC -std=c++17 -MD -MT CMakeFiles/fizz.dir/tool/FizzCommandCommon.cpp.o -MF CMakeFiles/fizz.dir/tool/FizzCommandCommon.cpp.o.d -o CMakeFiles/fizz.dir/tool/FizzCommandCommon.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.22.00/fizz/tool/FizzCommandCommon.cpp
FAILED: CMakeFiles/fizz.dir/tool/FizzCommandCommon.cpp.o 
/opt/local/bin/g++-mp-13 -DFMT_SHARED -DGFLAGS_IS_A_DLL=0 -Dfizz_EXPORTS -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.22.00 -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/build/generated -isystem /opt/local/include -isystem /opt/local/libexec/openssl3/include -isystem /opt/local/libexec/boost/1.81/include -isystem /opt/local/include/libfmt10 -pipe -I/opt/local/libexec/openssl3/include -I/opt/local/libexec/boost/1.81/include -Os -DNDEBUG -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -I/opt/local/libexec/boost/1.81/include -isystem/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -arch ppc -mmacosx-version-min=10.6 -fPIC -std=c++17 -MD -MT CMakeFiles/fizz.dir/tool/FizzCommandCommon.cpp.o -MF CMakeFiles/fizz.dir/tool/FizzCommandCommon.cpp.o.d -o CMakeFiles/fizz.dir/tool/FizzCommandCommon.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.22.00/fizz/tool/FizzCommandCommon.cpp
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.22.00/fizz/tool/FizzCommandCommon.cpp: In function 'folly::Optional<fizz::ech::ECHConfigList> fizz::tool::parseECHConfigsBase64(std::string)':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.22.00/fizz/tool/FizzCommandCommon.cpp:176:28: error: no matching function for call to 'std::basic_string<char>::erase(__gnu_cxx::__normal_iterator<char*, std::basic_string<char> >, std::basic_string<char>::const_iterator)'
  176 |   echConfigListBase64.erase(
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~^
  177 |       std::remove(echConfigListBase64.begin(), echConfigListBase64.end(), '\n'),
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  178 |       echConfigListBase64.cend());
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/local/include/gcc13/c++/bits/basic_string.h:51,
                 from /opt/local/include/gcc13/c++/string:54,
                 from /opt/local/include/folly/lang/Exception.h:21,
                 from /opt/local/include/folly/Range.h:46,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.22.00/fizz/crypto/exchange/KeyExchange.h:11,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.22.00/fizz/crypto/exchange/OpenSSLKeyExchange.h:11,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fizz/fizz/work/fizz-v2024.01.22.00/fizz/tool/FizzCommandCommon.cpp:10:
/opt/local/include/gcc13/c++/bits/cow_string.h:1718:7: note: candidate: 'std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::erase(size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 1718 |       erase(size_type __pos = 0, size_type __n = npos)
      |       ^~~~~
/opt/local/include/gcc13/c++/bits/cow_string.h:1718:23: note:   no known conversion for argument 1 from '__gnu_cxx::__normal_iterator<char*, std::basic_string<char> >' to 'std::basic_string<char>::size_type' {aka 'long unsigned int'}
 1718 |       erase(size_type __pos = 0, size_type __n = npos)
      |             ~~~~~~~~~~^~~~~~~~~
/opt/local/include/gcc13/c++/bits/cow_string.h:1734:7: note: candidate: 'std::basic_string<_CharT, _Traits, _Alloc>::iterator std::basic_string<_CharT, _Traits, _Alloc>::erase(iterator) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::basic_string<char>::iterator]'
 1734 |       erase(iterator __position)
      |       ^~~~~
/opt/local/include/gcc13/c++/bits/cow_string.h:1734:7: note:   candidate expects 1 argument, 2 provided
/opt/local/include/gcc13/c++/bits/cow_string.h:3372:6: note: candidate: 'std::basic_string<_CharT, _Traits, _Alloc>::iterator std::basic_string<_CharT, _Traits, _Alloc>::erase(iterator, iterator) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::basic_string<char>::iterator]'
 3372 |      basic_string<_CharT, _Traits, _Alloc>::
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/gcc13/c++/bits/cow_string.h:3373:39: note:   no known conversion for argument 2 from '__normal_iterator<const char*,[...]>' to '__normal_iterator<char*,[...]>'
 3373 |      erase(iterator __first, iterator __last)
      |                              ~~~~~~~~~^~~~~~

@NickR23 I have reproduced the error on i386 when building with gcc13 against libstdc++ runtime.

I close this issue, since this bug apparently has been fixed since then. It does not show up when building v2024.06.03.00.