katran icon indicating copy to clipboard operation
katran copied to clipboard

Ubuntu 24.04 ./build_katran.sh error: "(xdpdecap_tester) undefined reference to `ZSTD_createCCtx'"

Open tantm3 opened this issue 1 year ago • 2 comments

Hi everyone,

I faced two issues when building Katran at Ubuntu VERSION="24.04 LTS (Noble Numbat)". The reason why I need to build Katran in Ubuntu 24.04 is that I want to run Katran belong with Bpfilter as a firewall (https://github.com/facebook/bpfilter) which is require Ubuntu version 23+.

The first one here:

[ 19%] Built target murmur3
[ 20%] Building CXX object katran/lib/CMakeFiles/chhelpers.dir/CHHelpers.cpp.o
[ 21%] Building CXX object katran/lib/CMakeFiles/chhelpers.dir/MaglevBase.cpp.o
[ 22%] Building CXX object katran/lib/CMakeFiles/chhelpers.dir/MaglevHash.cpp.o
[ 23%] Building CXX object katran/lib/CMakeFiles/chhelpers.dir/MaglevHashV2.cpp.o
[ 25%] Linking CXX static library libchhelpers.a
[ 25%] Built target chhelpers
[ 26%] Building CXX object katran/lib/CMakeFiles/maglev_integration_test.dir/maglev_integration_test.cpp.o
/root/katran/katran/lib/BpfLoader.cpp: In function ‘std::string katran::{anonymous}::libBpfErrMsg(int)’:
/root/katran/katran/lib/BpfLoader.cpp:44:25: error: variable ‘std::array<char, 128> buf’ has initializer but incomplete type
   44 |   std::array<char, 128> buf{};
      |                         ^~~
make[2]: *** [katran/lib/CMakeFiles/bpfadapter.dir/build.make:104: katran/lib/CMakeFiles/bpfadapter.dir/BpfLoader.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 27%] Linking CXX static library libiphelpers.a
[ 27%] Built target iphelpers
[ 28%] Building CXX object katran/lib/tests/CMakeFiles/iphelpers-tests.dir/IpHelpersTest.cpp.o
[ 29%] Building CXX object katran/lib/tests/CMakeFiles/iphelpers-tests.dir/common/TestMain.cpp.o
[ 30%] Linking CXX static library libmac_helpers.a
[ 31%] Linking CXX executable maglev_integration_test
[ 31%] Built target mac_helpers
[ 31%] Built target maglev_integration_test
make[1]: *** [CMakeFiles/Makefile2:353: katran

With this one, I follow the issue https://github.com/facebookincubator/katran/pull/193 here and fix the error. The second error is:

[ 86%] Built target bpftester
[ 87%] Building CXX object katran/decap/testing/CMakeFiles/xdpdecap_tester.dir/xdpdecap_tester.cpp.o
[ 88%] Building CXX object katran/lib/testing/CMakeFiles/katran_test_util.dir/KatranTestUtil.cpp.o
[ 89%] Linking CXX executable libkatran-tests
[ 89%] Built target pcap-writer-test
[ 90%] Linking CXX static library libkatran_service_handler.a
[ 90%] Built target katran_service_handler
[ 92%] Building CXX object example_grpc/CMakeFiles/katran_server_grpc.dir/katran_server.cpp.o
[ 92%] Built target libkatran-tests
[ 93%] Linking CXX executable eventpipe-callback-test
[ 94%] Linking CXX executable monitoring-service-core-test
[ 94%] Built target eventpipe-callback-test
[ 94%] Built target monitoring-service-core-test
[ 95%] Linking CXX executable xdpdecap_tester
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_compress':
(.text+0x113): undefined reference to `ZSTD_createCCtx'
/usr/bin/ld: (.text+0x2a9): undefined reference to `ZSTD_compressStream2'
/usr/bin/ld: (.text+0x2b4): undefined reference to `ZSTD_isError'
/usr/bin/ld: (.text+0x2db): undefined reference to `ZSTD_freeCCtx'
/usr/bin/ld: (.text+0x5a0): undefined reference to `ZSTD_compressStream2'
/usr/bin/ld: (.text+0x5ab): undefined reference to `ZSTD_isError'
/usr/bin/ld: (.text+0x6b9): undefined reference to `ZSTD_freeCCtx'
/usr/bin/ld: (.text+0x835): undefined reference to `ZSTD_freeCCtx'
/usr/bin/ld: (.text+0x86f): undefined reference to `ZSTD_freeCCtx'
/usr/bin/ld: (.text+0x91b): undefined reference to `ZSTD_freeCCtx'
/usr/bin/ld: (.text+0xa12): undefined reference to `ZSTD_freeCCtx'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_decompress':
(.text+0xbfc): undefined reference to `ZSTD_decompress'
/usr/bin/ld: (.text+0xc04): undefined reference to `ZSTD_isError'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_decompress_elf':
(.text+0xd45): undefined reference to `ZSTD_decompress'
/usr/bin/ld: (.text+0xd4d): undefined reference to `ZSTD_isError'
collect2: error: ld returned 1 exit status
make[2]: *** [katran/decap/testing/CMakeFiles/xdpdecap_tester.dir/build.make:139: katran/decap/testing/xdpdecap_tester] Error 1
make[1]: *** [CMakeFiles/Makefile2:1760: katran/decap/testing/CMakeFiles/xdpdecap_tester.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 96%] Linking CXX static library libkatran_test_util.a
[ 96%] Built target katran_test_util
/root/katran/example_grpc/katran_server.cpp: In function ‘int main(int, char**)’:
/root/katran/example_grpc/katran_server.cpp:109:14: warning: ‘void folly::init(int*, char***, bool)’ is deprecated: Use the RAII version Init [-Wdeprecated-declarations]
  109 |   folly::init(&argc, &argv);
      |   ~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from /root/katran/example_grpc/katran_server.cpp:26:
/root/katran/_build/deps/include/folly/init/Init.h:99:50: note: declared here
   99 | [[deprecated("Use the RAII version Init")]] void init(
      |                                                  ^~~~
[ 97%] Linking CXX executable katran_server_grpc
[ 97%] Built target katran_server_grpc
make: *** [Makefile:146: all] Error 2

Updated:

  • I think there is an upgrade from the libelf-dev and libelf1 packages between Ubuntu version 22 vs 24 that may cause the error above
Ubuntu 22.04: libelf-dev, libelf1 version 0.186
Ubuntu 24.04: libelf-dev,libelf1t64 version 0.190

Here is some information and feel free to ask me to provide more! Kernel version: 6.8.0-31-generic

tantm3 avatar Aug 13 '24 15:08 tantm3

I think Ubuntu 24.04 is not a top priority, so I will temporarily close this issue here. Maybe we could open it in the future.

tantm3 avatar Sep 05 '24 06:09 tantm3

@tantm3 lets keep it open, anyone from community is welcome to submit a patch to make it work on Ubuntu 24.

avasylev avatar Sep 05 '24 15:09 avasylev

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!

github-actions[bot] avatar Dec 05 '24 12:12 github-actions[bot]

This issue has been closed because it has not had recent activity. If you are still having this issue please feel free to create a new one.

github-actions[bot] avatar Dec 20 '24 12:12 github-actions[bot]