facebookincubator / katran

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

Compile errors with latest code #167

Closed rkerur closed 2 years ago

rkerur commented 2 years ago

Hello, I am seeing following compile errors on Ubuntu 18.04 and 5.16 kernel

FAILED: katran/lib/CMakeFiles/bpfadapter.dir/BaseBpfAdapter.cpp.o /usr/bin/c++ -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_NO_LIB -DBOOST_SYSTEM_NO_LIB -DBOOST_THREAD_NO_LIB -DFMT_LOCALE -DGFLAGS_IS_A_DLL=0 -I/tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/repos/github.com-facebookincubator-katran.git/. -I/tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/libbpf-kDbQ7kpZPdoStx8dWf3Tvx52-oONx-bMMjtNPkt-EAU/include -I/tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/libelf-MJ2QdiOikvx24SM3imyV5TJDnAT8oz2O5h4veGo8QN4/include/libelf -I/tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/libelf-MJ2QdiOikvx24SM3imyV5TJDnAT8oz2O5h4veGo8QN4/include -I/tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/repos/github.com-facebookincubator-katran.git/../.. -I/tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/libmnl-8xzA3Eteid70bhD5tSfdRC3HTNojzMu3SaLMqJcZ-Eo/include -isystem /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/folly/include -isystem /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/glog-XfDP4i60qJ8LnB_SufvzspQ6cOBsheQf2_wuKpnM7Jg/include -isystem /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/boost-5wgXfhTYiEplqV9t_me7ikceYl9mv7_0i96rMWpSYO8/include -isystem /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/double-conversion-2SkMNJEufkmRKUy9pakJk8W3aBtW38c01KPFCQSZy5Q/include -isystem /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/gflags-7FMQEDy9mpdFl1OBfyzP9jBZjkVkDEMhcY_U0O0TDkU/include -isystem /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/libevent-X8u28S0xt1V-wknBaDBxRcoLuUC2ORz4yjWtKuxIoHc/include -isystem /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/zlib-FU8Lg4IEQqiaViHRN1CbL8mgi-elh1WNgJ6d7cEKBzA/include -isystem /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/xz-f7FpfK-SBZ-FZ9nmv-uFLEwi_lSksQRYvI496kn1q6k/include -isystem /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/lz4-hN3z8uvN0MV4zMEd7wnUEMY-qb0WOwkv8V9J92GuhMw/include -isystem /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/zstd-dC9pHb5tq5xqCQf5PAG2tXe36Nac4viIFjoxFkq4da0/include -isystem /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/snappy-CuFQ0AZ2SrmA6jY3YIP0Xh2taMkoOjgXF9zlosodLdU/include -isystem /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/libsodium-RQQkqkV7KIZSZWmw8On34V3GMKRa40ovgJiv8s160ZE/include -isystem /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/fmt-nNEJH18A26p_nqpqfezTY8zu4JXOwQsdJspXAd0GgOQ/include -O2 -g -DNDEBUG -std=gnu++1z -MD -MT katran/lib/CMakeFiles/bpfadapter.dir/BaseBpfAdapter.cpp.o -MF katran/lib/CMakeFiles/bpfadapter.dir/BaseBpfAdapter.cpp.o.d -o katran/lib/CMakeFiles/bpfadapter.dir/BaseBpfAdapter.cpp.o -c /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/repos/github.com-facebookincubator-katran.git/katran/lib/BaseBpfAdapter.cpp In file included from /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/libbpf-kDbQ7kpZPdoStx8dWf3Tvx52-oONx-bMMjtNPkt-EAU/include/bpf/bpf.h:31:0, from /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/repos/github.com-facebookincubator-katran.git/katran/lib/BaseBpfAdapter.h:24, from /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/repos/github.com-facebookincubator-katran.git/katran/lib/BaseBpfAdapter.cpp:17: /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/repos/github.com-facebookincubator-katran.git/katran/lib/BaseBpfAdapter.cpp: In static member function ‘static int katran::BaseBpfAdapter::createNamedBpfMap(const string&, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, int)’: /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/libbpf-kDbQ7kpZPdoStx8dWf3Tvx52-oONx-bMMjtNPkt-EAU/include/bpf/libbpf_common.h:80:3: sorry, unimplemented: non-trivial designated initializers not supported }; \ ^ /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/repos/github.com-facebookincubator-katran.git/katran/lib/BaseBpfAdapter.cpp:200:3: note: in expansion of macro ‘LIBBPF_OPTS’ LIBBPF_OPTS( ^~~ /tmp/fbcode_builder_getdeps-ZhomeZrkerurZkatranZbuildZfbcode_builder/installed/libbpf-kDbQ7kpZPdoStx8dWf3Tvx52-oONx-bMMjtNPkt-EAU/include/bpf/libbpf_common.h:80:3: sorry, unimplemented: non-trivial designated initializers not supported }; \ ^

Error is at struct TYPE NAME = ({ \ memset(&NAME, 0, sizeof(struct TYPE)); \ (struct TYPE) { \ .sz = sizeof(struct TYPE), \ __VA_ARGS__ \ }; \ })

which is 'C' initialization, not supported by C++.

Not sure If anything else needs to be done before build.sh is run (I clone the repo and going through the README, ran build.sh). How do I pick katran to be compiled by Clang, I have both Clang and GCC but it always picks GCC(g++).

Thanks.

lima1756 commented 2 years ago

Hi! Currently we are not supporting Ubuntu 18.04 anymore, besides this problem you will encounter a few more before being able to build the project, we recommend to bump to Ubuntu 20.04 version. But answering your question, all our build options use CMake so it should use the default compiler configured in the system, you should be able to change the env variable if desired