draios / sysdig

Linux system exploration and troubleshooting tool with first class support for containers
http://www.sysdig.com/
Other
7.68k stars 728 forks source link

error linking to falcosecurity-libs built as a shared library #2091

Closed Apteryks closed 2 months ago

Apteryks commented 2 months ago

Hello,

This is not supported yet, but I'm working on a CMake patch to make it possible. Currently I encounter the following error, which I'll investigate later:

[  3%] Building CXX object userspace/sysdig/CMakeFiles/sysdig.dir/__/chisel/chisel_api.cpp.o
cd /home/maxim/src/sysdig/build/userspace/sysdig && /gnu/store/w55blczvj69cpv1cgcmb4sv4bfarqr4y-profile/bin/c++ -DCHISEL_TOOL_LIBRARY_NAME=\"sysdig\" -DHAS_CAPTURE -DPLATFORM_NAME=\"Linux\" -DSYSDIG_PROBE_BPF_FILEPATH=\".scap/scap-bpf.o\" -I/gnu/store/w55blczvj69cpv1cgcmb4sv4bfarqr4y-profile/include/luajit-2.1 -I/home/maxim/src/sysdig/build/userspace/sinspui -I/home/maxim/src/sysdig/userspace/sysdig/../sinspui -I/home/maxim/src/sysdig/build/userspace/sysdig -I/home/maxim/src/sysdig/userspace/sysdig/. -I/home/maxim/src/sysdig/userspace/sysdig/../chisel -I/home/maxim/src/sysdig/userspace/sysdig/.. -I/home/maxim/src/sysdig/build/driver/src -isystem /gnu/store/w55blczvj69cpv1cgcmb4sv4bfarqr4y-profile/lib/pkgconfig/../../include/falcosecurity/libsinsp -isystem /gnu/store/w55blczvj69cpv1cgcmb4sv4bfarqr4y-profile/lib/pkgconfig/../../include/falcosecurity/driver -isystem /gnu/store/w55blczvj69cpv1cgcmb4sv4bfarqr4y-profile/lib/pkgconfig/../../include/falcosecurity/libscap -isystem /gnu/store/w55blczvj69cpv1cgcmb4sv4bfarqr4y-profile/lib/pkgconfig/../../include/falcosecurity -isystem /gnu/store/f6y33sydrvp1m71vg44nr1kkcz0dq703-re2-2022-12-01/include -Wall -ggdb   -std=c++17 -O3 -fno-strict-aliasing -DNDEBUG -pthread -std=c++17 -MD -MT userspace/sysdig/CMakeFiles/sysdig.dir/__/chisel/chisel_api.cpp.o -MF CMakeFiles/sysdig.dir/__/chisel/chisel_api.cpp.o.d -o CMakeFiles/sysdig.dir/__/chisel/chisel_api.cpp.o -c /home/maxim/src/sysdig/userspace/chisel/chisel_api.cpp
 /home/maxim/src/sysdig/userspace/chisel/chisel_api.cpp: In lambda function:
/home/maxim/src/sysdig/userspace/chisel/chisel_api.cpp:845:67: error: invalid use of member function 'uint32_t sinsp_threadinfo::sinsp_userinfo::uid() const' (did you forget the '()' ?)
  845 |                         lua_pushnumber(ls, (uint32_t)tinfo.m_user.uid);
      |                                                      ~~~~~~~~~~~~~^~~
      |                                                                      ()
/home/maxim/src/sysdig/userspace/chisel/chisel_api.cpp:848:68: error: invalid use of member function 'uint32_t sinsp_threadinfo::sinsp_groupinfo::gid() const' (did you forget the '()' ?)
  848 |                         lua_pushnumber(ls, (uint32_t)tinfo.m_group.gid);
      |                                                      ~~~~~~~~~~~~~~^~~
      |                                                                       ()
/home/maxim/src/sysdig/userspace/chisel/chisel_api.cpp:876:57: error: invalid use of non-static member function 'std::string sinsp_threadinfo::sinsp_userinfo::name() const'
  876 |                         lua_pushstring(ls, tinfo.m_user.name);
      |                                            ~~~~~~~~~~~~~^~~~
In file included from /gnu/store/l2qsqb44l5i1qw05lg9baynp1jzl8brl-falcosecurity-libs-0.16.0/include/falcosecurity/libsinsp/metrics_collector.h:23,
                 from /gnu/store/l2qsqb44l5i1qw05lg9baynp1jzl8brl-falcosecurity-libs-0.16.0/include/falcosecurity/libsinsp/sinsp.h:73,
                 from /home/maxim/src/sysdig/userspace/chisel/chisel_api.cpp:27:
/gnu/store/l2qsqb44l5i1qw05lg9baynp1jzl8brl-falcosecurity-libs-0.16.0/include/falcosecurity/libsinsp/threadinfo.h:77:29: note: declared here
   77 |                 std::string name() const {
      |                             ^~~~
/home/maxim/src/sysdig/userspace/chisel/chisel_api.cpp: In static member function 'static int lua_cbacks::push_metric(lua_State*)':
/home/maxim/src/sysdig/userspace/chisel/chisel_api.cpp:1516:16: warning: unused variable 'inspector' [-Wunused-variable]
 1516 |         sinsp* inspector = ch->m_inspector;
      |                ^~~~~~~~~
make[2]: *** [userspace/sysdig/CMakeFiles/sysdig.dir/build.make:146: userspace/sysdig/CMakeFiles/sysdig.dir/__/chisel/chisel_api.cpp.o] Error 1

I'm posting it here in case someone has an idea that could accelerate my investigation. Thank you!

therealbobo commented 2 months ago

Hey @Apteryks! The libs api changed! If you look at the dev branch, you will notice that we already took care of that! The support for libs 0.16.0 it's on his way and it's only matter of driver build time :)

Apteryks commented 2 months ago

Thanks, I confirm using the latest commit resolves the problem.