facebookincubator / katran

A high performance layer 4 load balancer
GNU General Public License v2.0
4.74k stars 503 forks source link

Xdpdump tool build error xdp_event_logger.dir #232

Open tantm3 opened 3 months ago

tantm3 commented 3 months ago

Hi everyone!

I am trying to build the xdpdump tool (https://github.com/facebookincubator/katran/tree/main/tools) to debug and understand packet flow. I saw the BUILD_TOOLS env that is used to included building tools, so I run build_katran.sh script with that variable:

BUILD_TOOLS=1 ./build_katran.sh 

Near the end of the building process, there is an error here:

/root/katran/_build/deps/include/bpf/uapi/linux/bpf.h:7399:8: note: previous definition of ‘struct btf_ptr’
 7399 | struct btf_ptr {
      |        ^~~~~~~
In file included from /usr/include/bcc/libbpf.h:21,
                 from /root/katran/tools/xdpdump/XdpEventReader.cpp:19:
/usr/include/linux/bpf.h:6293:43: error: ‘BTF_F_COMPACT’ conflicts with a previous declaration
 6293 |         BTF_F_COMPACT   =       (1ULL << 0),
      |                                           ^
In file included from /root/katran/_build/deps/include/bpf/libbpf.h:18,
                 from /root/katran/./katran/lib/PerfBufferEventReader.h:18,
                 from /root/katran/./tools/xdpdump/XdpEventReader.h:24,
                 from /root/katran/tools/xdpdump/XdpEventReader.cpp:17:
/root/katran/_build/deps/include/bpf/uapi/linux/bpf.h:7415:9: note: previous declaration ‘<unnamed enum> BTF_F_COMPACT’
 7415 |         BTF_F_COMPACT   =       (1ULL << 0),
      |         ^~~~~~~~~~~~~
In file included from /usr/include/bcc/libbpf.h:21,
                 from /root/katran/tools/xdpdump/XdpEventReader.cpp:19:
/usr/include/linux/bpf.h:6294:43: error: ‘BTF_F_NONAME’ conflicts with a previous declaration
 6294 |         BTF_F_NONAME    =       (1ULL << 1),
      |                                           ^
In file included from /root/katran/_build/deps/include/bpf/libbpf.h:18,
                 from /root/katran/./katran/lib/PerfBufferEventReader.h:18,
                 from /root/katran/./tools/xdpdump/XdpEventReader.h:24,
                 from /root/katran/tools/xdpdump/XdpEventReader.cpp:17:
/root/katran/_build/deps/include/bpf/uapi/linux/bpf.h:7416:9: note: previous declaration ‘<unnamed enum> BTF_F_NONAME’
 7416 |         BTF_F_NONAME    =       (1ULL << 1),
      |         ^~~~~~~~~~~~
In file included from /usr/include/bcc/libbpf.h:21,
                 from /root/katran/tools/xdpdump/XdpEventReader.cpp:19:
/usr/include/linux/bpf.h:6295:43: error: ‘BTF_F_PTR_RAW’ conflicts with a previous declaration
 6295 |         BTF_F_PTR_RAW   =       (1ULL << 2),
      |                                           ^
In file included from /root/katran/_build/deps/include/bpf/libbpf.h:18,
                 from /root/katran/./katran/lib/PerfBufferEventReader.h:18,
                 from /root/katran/./tools/xdpdump/XdpEventReader.h:24,
                 from /root/katran/tools/xdpdump/XdpEventReader.cpp:17:
/root/katran/_build/deps/include/bpf/uapi/linux/bpf.h:7417:9: note: previous declaration ‘<unnamed enum> BTF_F_PTR_RAW’
 7417 |         BTF_F_PTR_RAW   =       (1ULL << 2),
      |         ^~~~~~~~~~~~~
In file included from /usr/include/bcc/libbpf.h:21,
                 from /root/katran/tools/xdpdump/XdpEventReader.cpp:19:
/usr/include/linux/bpf.h:6296:43: error: ‘BTF_F_ZERO’ conflicts with a previous declaration
 6296 |         BTF_F_ZERO      =       (1ULL << 3),
      |                                           ^
In file included from /root/katran/_build/deps/include/bpf/libbpf.h:18,
                 from /root/katran/./katran/lib/PerfBufferEventReader.h:18,
                 from /root/katran/./tools/xdpdump/XdpEventReader.h:24,
                 from /root/katran/tools/xdpdump/XdpEventReader.cpp:17:
/root/katran/_build/deps/include/bpf/uapi/linux/bpf.h:7418:9: note: previous declaration ‘<unnamed enum> BTF_F_ZERO’
 7418 |         BTF_F_ZERO      =       (1ULL << 3),
      |         ^~~~~~~~~~
[ 70%] Linking CXX static library libbase64_helpers.a
[ 70%] Built target base64_helpers
[ 71%] Building CXX object katran/lib/testing/CMakeFiles/pcap_parser.dir/PcapParser.cpp.o
[ 72%] Building CXX object katran/lib/testing/CMakeFiles/base64helpers-tests.dir/Base64Test.cpp.o
[ 73%] Building CXX object katran/lib/testing/CMakeFiles/base64helpers-tests.dir/__/tests/common/TestMain.cpp.o
[ 74%] Linking CXX executable vip-tests
[ 75%] Linking CXX executable chhelpers-tests
make[2]: *** [tools/xdpdump/CMakeFiles/xdp_event_logger.dir/build.make:76: tools/xdpdump/CMakeFiles/xdp_event_logger.dir/XdpEventReader.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1923: tools/xdpdump/CMakeFiles/xdp_event_logger.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 76%] Linking CXX static library libkatran_test_provision.a
[ 76%] Built target katran_test_provision
[ 77%] Linking CXX static library libpcap_parser.a
[ 77%] Built target pcap_parser
[ 77%] Built target vip-tests
[ 77%] Built target chhelpers-tests
[ 78%] Linking CXX executable base64helpers-tests
[ 78%] Built target base64helpers-tests
[ 80%] Linking CXX executable pcap-writer-test
[ 81%] Linking CXX executable libkatran-tests
[ 81%] Built target pcap-writer-test
[ 82%] Linking CXX static library libkatran_service_handler.a
[ 82%] Built target katran_service_handler
[ 83%] Linking CXX executable eventpipe-callback-test
[ 83%] Built target libkatran-tests
[ 84%] Linking CXX executable monitoring-service-core-test
[ 84%] Built target eventpipe-callback-test
[ 84%] Built target monitoring-service-core-test
make: *** [Makefile:146: all] Error 2

Here is some information about my server:

Did I forget to install something? If I get rid of the BUILD_TOOLS=1 env, I can build Katran normally.

github-actions[bot] commented 4 hours ago

This issue has been automatically marked as stale because it has not had recent activity. If you'd still having this issue please make a comment, make sure you've addressed any follow ups!