draios / sysdig

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

sysdig doesn't build with gcc-4.9 #258

Closed doktor5000 closed 10 years ago

doktor5000 commented 10 years ago

Attached is an excerpt of the build log for sysdig-0.1.89. Full version for i586 available at http://pkgsubmit.mageia.org/uploads/failure/cauldron/core/release/20141004105246.doktor5000.valstar.6842/log/botcmd.1412419982.rabbit.log and for x86_64: http://pkgsubmit.mageia.org/uploads/failure/cauldron/core/release/20141004105246.doktor5000.valstar.6842/log/botcmd.1412419984.valstar.log

CFLAGS='-O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fomit-frame-pointer -march=i586 -mtune=generic -fasynchronous-unwind-tables'
+ export CFLAGS
+ CXXFLAGS='-O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fomit-frame-pointer -march=i586 -mtune=generic -fasynchronous-unwind-tables'
+ export CXXFLAGS
+ FFLAGS='-O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fomit-frame-pointer -march=i586 -mtune=generic -fasynchronous-unwind-tables'
+ export FFLAGS
+ LDFLAGS=' -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags'
+ export LDFLAGS
+ mkdir -p build
+ cd build
+ /usr/bin/cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_LIBDIR:PATH=/usr/lib -DCMAKE_INSTALL_LIBEXECDIR:PATH=/usr/libexec -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DCMAKE_BUILD_TYPE=release -DCMAKE_SKIP_RPATH:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_STATIC_LIBS:BOOL=OFF '-DCMAKE_MODULE_LINKER_FLAGS=-Wl,--as-needed  -Wl,-z,relro -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags' -DBUILD_DRIVER=OFF -DUSE_BUNDLED_LUAJIT=OFF -DUSE_BUNDLED_JSONCPP=OFF -DUSE_BUNDLED_ZLIB=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo

[...snip...]

[ 41%] Building CXX object userspace/libsinsp/CMakeFiles/sinsp.dir/chisel.cpp.o
/home/iurt/rpmbuild/BUILD/sysdig-0.1.89/userspace/libsinsp/chisel.cpp:113:1: error: elements of array 'const luaL_reg ll_sysdig []' have incomplete type
 };
 ^
/home/iurt/rpmbuild/BUILD/sysdig-0.1.89/userspace/libsinsp/chisel.cpp:113:1: error: storage size of 'll_sysdig' isn't known
/home/iurt/rpmbuild/BUILD/sysdig-0.1.89/userspace/libsinsp/chisel.cpp:124:1: error: elements of array 'const luaL_reg ll_chisel []' have incomplete type
 };
 ^
/home/iurt/rpmbuild/BUILD/sysdig-0.1.89/userspace/libsinsp/chisel.cpp:124:1: error: storage size of 'll_chisel' isn't known
/home/iurt/rpmbuild/BUILD/sysdig-0.1.89/userspace/libsinsp/chisel.cpp:134:1: error: elements of array 'const luaL_reg ll_evt []' have incomplete type
 };
 ^
/home/iurt/rpmbuild/BUILD/sysdig-0.1.89/userspace/libsinsp/chisel.cpp:134:1: error: storage size of 'll_evt' isn't known
/home/iurt/rpmbuild/BUILD/sysdig-0.1.89/userspace/libsinsp/chisel.cpp: In static member function 'static bool sinsp_chisel::init_lua_chisel(chisel_desc&, const string&)':
/home/iurt/rpmbuild/BUILD/sysdig-0.1.89/userspace/libsinsp/chisel.cpp:351:27: error: 'lua_open' was not declared in this scope
  lua_State* ls = lua_open();
                           ^
/home/iurt/rpmbuild/BUILD/sysdig-0.1.89/userspace/libsinsp/chisel.cpp:357:41: error: 'luaL_openlib' was not declared in this scope
  luaL_openlib(ls, "sysdig", ll_sysdig, 0);
                                         ^
/home/iurt/rpmbuild/BUILD/sysdig-0.1.89/userspace/libsinsp/chisel.cpp: In member function 'void sinsp_chisel::load(std::string)':
/home/iurt/rpmbuild/BUILD/sysdig-0.1.89/userspace/libsinsp/chisel.cpp:591:18: error: 'lua_open' was not declared in this scope
  m_ls = lua_open();
                  ^
/home/iurt/rpmbuild/BUILD/sysdig-0.1.89/userspace/libsinsp/chisel.cpp:598:43: error: 'luaL_openlib' was not declared in this scope
  luaL_openlib(m_ls, "sysdig", ll_sysdig, 0);
                                           ^
userspace/libsinsp/CMakeFiles/sinsp.dir/build.make:54: recipe for target 'userspace/libsinsp/CMakeFiles/sinsp.dir/chisel.cpp.o' failed
make[2]: *** [userspace/libsinsp/CMakeFiles/sinsp.dir/chisel.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....

[...snip...]

[ 79%] Building CXX object userspace/libsinsp/CMakeFiles/sinsp.dir/parsers.cpp.o
/home/iurt/rpmbuild/BUILD/sysdig-0.1.89/userspace/libsinsp/parsers.cpp: In member function 'void sinsp_parser::parse_select_poll_epollwait_enter(sinsp_evt*)':
/home/iurt/rpmbuild/BUILD/sysdig-0.1.89/userspace/libsinsp/parsers.cpp:2777:28: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  *(uint64_t*)evt->m_tinfo->m_lastevent_data = evt->get_ts();
                            ^
CMakeFiles/Makefile2:391: recipe for target 'userspace/libsinsp/CMakeFiles/sinsp.dir/all' failed
make[1]: *** [userspace/libsinsp/CMakeFiles/sinsp.dir/all] Error 2
Makefile:137: recipe for target 'all' failed
make: *** [all] Error 2 

Please fix :)

doktor5000 commented 10 years ago

Just wanted to add, same issues with -DCMAKE_BUILD_TYPE=Release

gianlucaborello commented 10 years ago

Are you sure that it's related to GCC 4.9 and not to the custom Lua version that you seem to provide? I just tried building the 0.1.89 tag on gcc 4.9.1 and it worked fine.

Could you try a build with the embedded luajit?

doktor5000 commented 10 years ago

Okay, I can give that a shot ... is there any preferred lua version, as we have 5.0, 5.1 and 5.2 packaged? Seems to build fine with the bundled lua version - but as a linux distro we have to build against system libraries. This also works fine on an older distro version.

As you mention luajit, cmake actually checks for the normal lua library, and also sysdig seems to work without luajit binary installed. So do you require lua library, that is /usr/lib{64}/liblua.so.5.x or luajit binary?

gianlucaborello commented 10 years ago

We require LuaJIT 2.0.3 (the shared library, not the luajit binary itself). Any use of sysdig against other Lua flavors won't get any support by us (although we welcome patches in case it's important for you).

doktor5000 commented 10 years ago

I think I've found the issue, for some reason in our package only the luajit binary was built, but the libary was not. Anyways, thanks a lot for the feedback, issue closed. :)

:+1:

doktor5000 commented 10 years ago

Although, thinking about it a second time ... Shouldn't the cmake checks fail when bundled luajit is disabled, and when no luajit is detected? So that the build will not start, as prereqs are not met?

doktor5000 commented 10 years ago

Nevermind ... found what caused the issues. If there's no support for anything else then LuaJIT 2.0.3, then you should maybe remove the following from CMakeLists.txt :

        else()
                # alternatively try stock Lua
                find_package(Lua51)
                set(LUAJIT_LIB ${LUA_LIBRARY})
                set(LUAJIT_INCLUDE ${LUA_INCLUDE_DIR})

                if(NOT ${LUA51_FOUND})
                        message(FATAL_ERROR "Couldn't find system LuaJIT or Lua")
                endif()
doktor5000 commented 10 years ago

Anyway, I'd like to mention that sysdig is now available via Mageia Linux standard repositories. http://svnweb.mageia.org/packages/cauldron/sysdig/current/SPECS/sysdig.spec?view=markup If you need any help with the rpm packages that you provide, just ping me.

Keep up the good work! :8ball: