iovisor / iovisor/bcc

/root/project/bcc/src/cc/common.cc:178:59: error: no matching function for call to ‘std::basic_string<char>::replace(long unsigned int, long unsigned int, std::basic_string<char>&, int)’

Open
#4,684 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
10d 4h
Merged PRs (30d)
3

Description

[root@dev1 build]# make
-- Latest recognized Git tag is v0.28.0
-- Git HEAD is 7ce3d7db44880312e7101874808f3468c8e4e1b4
-- Revision is 0.28.0+7ce3d7db (major 0, minor 28, patch 0)
-- Kernel release: 6.4.5-1.el7.elrepo.x86_64
-- Kernel headers: /usr/src/kernels/6.4.5-1.el7.elrepo.x86_64
-- Found LLVM: /usr/local/include 10.0.1 (Use LLVM_ROOT envronment variable for another version of LLVM)
-- Could NOT find LibDebuginfod (missing: LIBDEBUGINFOD_LIBRARIES LIBDEBUGINFOD_INCLUDE_DIRS)
-- Using static-libstdc++
-- Could NOT find LuaJIT (missing: LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR)
CMake Warning at tests/python/CMakeLists.txt:10 (message):
Recommended test program 'netperf' not found

CMake Warning at tests/python/CMakeLists.txt:16 (message):
Recommended test program 'iperf' or 'iperf3' not found

-- Configuring done
-- Generating done
-- Build files have been written to: /root/project/bcc/build
[ 1%] Built target clang_frontend-objects
[ 2%] Built target clang_frontend
[ 3%] Building CXX object src/cc/CMakeFiles/bpf-static.dir/common.cc.o
/root/project/bcc/src/cc/common.cc: In function ‘ebpf::field_kind_t ebpf::_get_field_kind(const string&, std::string&, std::string&, int*)’:
/root/project/bcc/src/cc/common.cc:178:59: error: no matching function for call to ‘std::basic_string::replace(long unsigned int, long unsigned int, std::basic_string&, int)’
field_name.replace(pos1 + 1, pos2 - pos1 - 1, dim, 0);
^
In file included from /opt/rh/devtoolset-7/root/usr/include/c++/7/string:52:0,
from /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/locale_classes.h:40,
from /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/ios_base.h:41,
from /opt/rh/devtoolset-7/root/usr/include/c++/7/ios:42,
from /opt/rh/devtoolset-7/root/usr/include/c++/7/istream:38,
from /opt/rh/devtoolset-7/root/usr/include/c++/7/fstream:38,
from /root/project/bcc/src/cc/common.cc:16:
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4683:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]
replace(size_type __pos, size_type __n, const basic_string& __str)
^~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4683:7: note: candidate expects 3 arguments, 4 provided
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4705:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const std::basic_string<_CharT, _Traits, _Alloc>&, std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]
replace(size_type __pos1, size_type __n1, const basic_string& __str,
^~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4705:7: note: candidate expects 5 arguments, 4 provided
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4730:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]
replace(size_type __pos, size_type __n1, const _CharT* __s,
^~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4730:7: note: no known conversion for argument 3 from ‘std::basic_string’ to ‘const char*’
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4750:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _CharT*) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]
replace(size_type __pos, size_type __n1, const _CharT* __s)
^~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4750:7: note: candidate expects 3 arguments, 4 provided
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4774:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, _CharT) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]
replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
^~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4774:7: note: no known conversion for argument 3 from ‘std::basic_string’ to ‘std::basic_string::size_type {aka long unsigned int}’
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4792:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator >; typename _Alloc::rebind<_CharT>::other::pointer = char*]
replace(iterator __i1, iterator __i2, const basic_string& __str)
^~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4792:7: note: candidate expects 3 arguments, 4 provided
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4811:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator >; typename _Alloc::rebind<_CharT>::other::pointer = char*; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]
replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n)
^~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4811:7: note: no known conversion for argument 1 from ‘long unsigned int’ to ‘std::basic_string::iterator {aka __gnu_cxx::__normal_iterator >}’
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4832:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, const _CharT*) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator >; typename _Alloc::rebind<_CharT>::other::pointer = char*]
replace(iterator __i1, iterator __i2, const _CharT* __s)
^~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4832:7: note: candidate expects 3 arguments, 4 provided
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4853:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::size_type, _CharT) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator >; typename _Alloc::rebind<_CharT>::other::pointer = char*; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]
replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
^~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4853:7: note: no known conversion for argument 1 from ‘long unsigned int’ to ‘std::basic_string::iterator {aka __gnu_cxx::__normal_iterator >}’
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4877:9: note: candidate: template std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, _InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]
replace(iterator __i1, iterator __i2,
^~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4877:9: note: template argument deduction/substitution failed:
/root/project/bcc/src/cc/common.cc:178:59: note: deduced conflicting types for parameter ‘_InputIterator’ (‘std::basic_string’ and ‘int’)
field_name.replace(pos1 + 1, pos2 - pos1 - 1, dim, 0);
^
In file included from /opt/rh/devtoolset-7/root/usr/include/c++/7/string:52:0,
from /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/locale_classes.h:40,
from /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/ios_base.h:41,
from /opt/rh/devtoolset-7/root/usr/include/c++/7/ios:42,
from /opt/rh/devtoolset-7/root/usr/include/c++/7/istream:38,
from /opt/rh/devtoolset-7/root/usr/include/c++/7/fstream:38,
from /root/project/bcc/src/cc/common.cc:16:
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4890:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, _CharT*, _CharT*) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator >; typename _Alloc::rebind<_CharT>::other::pointer = char*]
replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2)
^~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4890:7: note: no known conversion for argument 1 from ‘long unsigned int’ to ‘std::basic_string::iterator {aka __gnu_cxx::__normal_iterator >}’
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4900:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, const _CharT*, const _CharT*) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator >; typename _Alloc::rebind<_CharT>::other::pointer = char*]
replace(iterator __i1, iterator __i2,
^~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4900:7: note: no known conversion for argument 1 from ‘long unsigned int’ to ‘std::basic_string::iterator {aka __gnu_cxx::__normal_iterator >}’
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4911:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator >; typename _Alloc::rebind<_CharT>::other::pointer = char*]
replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)
^~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4911:7: note: no known conversion for argument 1 from ‘long unsigned int’ to ‘std::basic_string::iterator {aka __gnu_cxx::__normal_iterator >}’
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4921:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::const_iterator, std::basic_string<_CharT, _Traits, _Alloc>::const_iterator) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator >; typename _Alloc::rebind<_CharT>::other::pointer = char*; std::basic_string<_CharT, _Traits, _Alloc>::const_iterator = __gnu_cxx::__normal_iterator >; typename _Alloc::rebind<_CharT>::other::const_pointer = const char*]
replace(iterator __i1, iterator __i2,
^~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4921:7: note: no known conversion for argument 1 from ‘long unsigned int’ to ‘std::basic_string::iterator {aka __gnu_cxx::__normal_iterator >}’
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4946:21: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator >; typename _Alloc::rebind<_CharT>::other::pointer = char*]
basic_string& replace(iterator __i1, iterator __i2,
^~~~~~~
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:4946:21: note: candidate expects 3 arguments, 4 provided
make[2]: *** [src/cc/CMakeFiles/bpf-static.dir/build.make:408: src/cc/CMakeFiles/bpf-static.dir/common.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:919: src/cc/CMakeFiles/bpf-static.dir/all] Error 2
make: *** [Makefile:161: all] Error 2
[root@dev1 build]#

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect src/cc/common.cc at line 178 and the _get_field_kind function; first reproduce the failure with make in the build directory using the reported environment. Done means the bpf-static target compiles past common.cc without the std::string::replace error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system, devtools
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.