I tried first to follow the official installation instructions but this gave me the same error as in #389.
So, following the instructions,
We recommend first trying libbpfcc-dev and then trying a manual installation if the package has not already been fixed.
I tried a manual installation. The bcc installation worked as expected given ubuntu source installation instructions.
Afterwards, I got these errors:
$ mkdir build; cd build; cmake -DCMAKE_BUILD_TYPE=DEBUG ..
mkdir: cannot create directory ‘build’: File exists
-- Configuring done
-- Generating done
-- Build files have been written to: /home/alarcj/go/src/github.com/iovisor/bpftrace/build
alarcj at alarcj-N501VW in ~/go/src/github.com/iovisor/bpftrace/build on master
$ make -j8
Scanning dependencies of target resources
[ 5%] Built target parser
[ 8%] Built target arch
[ 9%] Performing update step for 'gtest-git'
[ 10%] Building CXX object resources/CMakeFiles/resources.dir/headers.cpp.o
[ 43%] Built target man
[ 44%] Performing configure step for 'gtest-git'
[ 45%] Linking CXX static library libresources.a
[ 52%] Built target ast
[ 52%] Built target resources
[ 54%] Building CXX object src/CMakeFiles/bpftrace.dir/attached_probe.cpp.o
[ 55%] Building CXX object src/CMakeFiles/bpftrace.dir/printf.cpp.o
[ 56%] Building CXX object src/CMakeFiles/bpftrace.dir/map.cpp.o
[ 57%] Building CXX object src/CMakeFiles/bpftrace.dir/mapkey.cpp.o
[ 58%] Building CXX object src/CMakeFiles/bpftrace.dir/tracepoint_format_parser.cpp.o
[ 59%] Building CXX object src/CMakeFiles/bpftrace.dir/types.cpp.o
[ 60%] Building CXX object src/CMakeFiles/bpftrace.dir/resolve_cgroupid.cpp.o
-- Configuring done
-- Generating done
-- Build files have been written to: /home/alarcj/go/src/github.com/iovisor/bpftrace/build/tests/gtest-git-prefix/src/gtest-git-build
[ 62%] Performing build step for 'gtest-git'
[ 25%] Built target gtest
[ 50%] Built target gmock
[ 75%] Built target gtest_main
[ 63%] Building CXX object src/CMakeFiles/bpftrace.dir/utils.cpp.o
[100%] Built target gmock_main
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/map.cpp: In member function ‘int bpftrace::Map::create_map(bpf_map_type, const char*, int, int, int, int)’:
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/map.cpp:16:10: error: ‘bpf_create_map’ was not declared in this scope
return bpf_create_map(map_type, name, key_size, value_size, max_entries, flags);
^~~~~~~~~~~~~~
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/map.cpp:16:10: note: suggested alternative: ‘bcc_create_map’
return bpf_create_map(map_type, name, key_size, value_size, max_entries, flags);
^~~~~~~~~~~~~~
bcc_create_map
[ 66%] Built target gtest-git-build
src/CMakeFiles/bpftrace.dir/build.make:206: recipe for target 'src/CMakeFiles/bpftrace.dir/map.cpp.o' failed
make[2]: *** [src/CMakeFiles/bpftrace.dir/map.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 67%] Building CXX object tests/CMakeFiles/bpftrace_test.dir/__/src/attached_probe.cpp.o
[ 68%] Building CXX object tests/CMakeFiles/bpftrace_test.dir/__/src/driver.cpp.o
[ 70%] Building CXX object tests/CMakeFiles/bpftrace_test.dir/__/src/fake_map.cpp.o
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/tracepoint_format_parser.cpp: In static member function ‘static bool bpftrace::TracepointFormatParser::parse(bpftrace::ast::Program*)’:
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/tracepoint_format_parser.cpp:70:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < glob_result.gl_pathc; ++i) {
~~^~~~~~~~~~~~~~~~~~~~~~
[ 71%] Building CXX object tests/CMakeFiles/bpftrace_test.dir/__/src/map.cpp.o
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/attached_probe.cpp: In member function ‘void bpftrace::AttachedProbe::load_prog()’:
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/attached_probe.cpp:341:15: error: ‘bpf_prog_load’ was not declared in this scope
progfd_ = bpf_prog_load(progtype(probe_.type), namep,
^~~~~~~~~~~~~
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/attached_probe.cpp:341:15: note: suggested alternative: ‘bcc_prog_load’
progfd_ = bpf_prog_load(progtype(probe_.type), namep,
^~~~~~~~~~~~~
bcc_prog_load
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/attached_probe.cpp: In member function ‘void bpftrace::AttachedProbe::attach_kprobe()’:
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/attached_probe.cpp:379:58: error: too few arguments to function ‘int bpf_attach_kprobe(int, bpf_probe_attach_type, const char*, const char*, uint64_t, int)’
eventname().c_str(), probe_.attach_point.c_str(), 0);
^
In file included from /home/alarcj/go/src/github.com/iovisor/bpftrace/src/attached_probe.h:5:0,
from /home/alarcj/go/src/github.com/iovisor/bpftrace/src/attached_probe.cpp:13:
/usr/include/bcc/libbpf.h:81:5: note: declared here
int bpf_attach_kprobe(int progfd, enum bpf_probe_attach_type attach_type,
^~~~~~~~~~~~~~~~~
[ 72%] Building CXX object tests/CMakeFiles/bpftrace_test.dir/__/src/mapkey.cpp.o
[ 73%] Building CXX object tests/CMakeFiles/bpftrace_test.dir/__/src/printf.cpp.o
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/map.cpp: In member function ‘int bpftrace::Map::create_map(bpf_map_type, const char*, int, int, int, int)’:
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/map.cpp:16:10: error: ‘bpf_create_map’ was not declared in this scope
return bpf_create_map(map_type, name, key_size, value_size, max_entries, flags);
^~~~~~~~~~~~~~
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/map.cpp:16:10: note: suggested alternative: ‘bcc_create_map’
return bpf_create_map(map_type, name, key_size, value_size, max_entries, flags);
^~~~~~~~~~~~~~
bcc_create_map
[ 74%] Building CXX object tests/CMakeFiles/bpftrace_test.dir/__/src/resolve_cgroupid.cpp.o
[ 75%] Building CXX object tests/CMakeFiles/bpftrace_test.dir/__/src/tracepoint_format_parser.cpp.o
tests/CMakeFiles/bpftrace_test.dir/build.make:398: recipe for target 'tests/CMakeFiles/bpftrace_test.dir/__/src/map.cpp.o' failed
make[2]: *** [tests/CMakeFiles/bpftrace_test.dir/__/src/map.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/attached_probe.cpp: In member function ‘void bpftrace::AttachedProbe::load_prog()’:
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/attached_probe.cpp:341:15: error: ‘bpf_prog_load’ was not declared in this scope
progfd_ = bpf_prog_load(progtype(probe_.type), namep,
^~~~~~~~~~~~~
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/attached_probe.cpp:341:15: note: suggested alternative: ‘bcc_prog_load’
progfd_ = bpf_prog_load(progtype(probe_.type), namep,
^~~~~~~~~~~~~
bcc_prog_load
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/attached_probe.cpp: In member function ‘void bpftrace::AttachedProbe::attach_kprobe()’:
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/attached_probe.cpp:379:58: error: too few arguments to function ‘int bpf_attach_kprobe(int, bpf_probe_attach_type, const char*, const char*, uint64_t, int)’
eventname().c_str(), probe_.attach_point.c_str(), 0);
^
In file included from /home/alarcj/go/src/github.com/iovisor/bpftrace/src/attached_probe.h:5:0,
from /home/alarcj/go/src/github.com/iovisor/bpftrace/src/attached_probe.cpp:13:
/usr/include/bcc/libbpf.h:81:5: note: declared here
int bpf_attach_kprobe(int progfd, enum bpf_probe_attach_type attach_type,
^~~~~~~~~~~~~~~~~
src/CMakeFiles/bpftrace.dir/build.make:62: recipe for target 'src/CMakeFiles/bpftrace.dir/attached_probe.cpp.o' failed
make[2]: *** [src/CMakeFiles/bpftrace.dir/attached_probe.cpp.o] Error 1
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/tracepoint_format_parser.cpp: In static member function ‘static bool bpftrace::TracepointFormatParser::parse(bpftrace::ast::Program*)’:
/home/alarcj/go/src/github.com/iovisor/bpftrace/src/tracepoint_format_parser.cpp:70:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < glob_result.gl_pathc; ++i) {
~~^~~~~~~~~~~~~~~~~~~~~~
tests/CMakeFiles/bpftrace_test.dir/build.make:278: recipe for target 'tests/CMakeFiles/bpftrace_test.dir/__/src/attached_probe.cpp.o' failed
make[2]: *** [tests/CMakeFiles/bpftrace_test.dir/__/src/attached_probe.cpp.o] Error 1
CMakeFiles/Makefile2:1196: recipe for target 'src/CMakeFiles/bpftrace.dir/all' failed
make[1]: *** [src/CMakeFiles/bpftrace.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:1323: recipe for target 'tests/CMakeFiles/bpftrace_test.dir/all' failed
make[1]: *** [tests/CMakeFiles/bpftrace_test.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Would anyone be able to tell me how to fix this?
I'm getting the same error. I guess it's because of BCC v0.9.0 update
+1, the same error here
I'm closing this as it seems to be a duplicate of #453. If it's not, please let me know so we can reopen it.
A workaround is to build bcc 0.8: git checkout v0.8.0. Using that, bpftrace builds successfully for me.
Most helpful comment
A workaround is to build bcc 0.8:
git checkout v0.8.0. Using that, bpftrace builds successfully for me.