The TableLog.cc was missing the "stddef.h" include file which defines the offsetof() macro.
Simply add
#include <stddef.h>
To the beginning of TableLog.cc
Question
When trying to compile CheckMK's livestatus Nagios plugin, I get an error during the "make" process:
g++ -DHAVE_CONFIG_H -I. -I.. -I../nagios -fPIC -g -O2 -MT livestatus_so-TableLog.o -MD -MP -MF .deps/livestatus_so-TableLog.Tpo -c -o livestatus_so-TableLog.o `test -f 'TableLog.cc' || echo './'`TableLog.cc
TableLog.cc: In member function ‘void TableLog::updateLogfileIndex()’:
TableLog.cc:250:21: error: expected primary-expression before ‘struct’
TableLog.cc:250:36: error: ‘d_name’ was not declared in this scope
TableLog.cc:250:42: error: ‘offsetof’ was not declared in this scope
make[2]: *** [livestatus_so-TableLog.o] Error 1
The relevant part of TableLog.cc:
250 int len = offsetof(struct dirent, d_name)
251 + pathconf(log_archive_path, _PC_NAME_MAX) + 1;
The source is availalbe at http://www.mathias-kettner.de/download/mk-livestatus-1.1.6p1.tar.gz
There's a mailing list thread about this issue (http://permalink.gmane.org/gmane.network.nagios.checkmk/2560), but it remains unanswered.
Solution
The TableLog.cc was missing the "stddef.h" include file which defines the offsetof() macro.
Simply add
#include <stddef.h>
To the beginning of TableLog.cc
OTHER TIPS
as like omribahumi said in previous answer, edit TableLog.cc
file
then comment the 523, 524, 525 lines in setup.sh
script
523 #rm -rf $D
524 #mkdir -p $D
525 #tar xvzf $SRCDIR/livestatus.tar.gz -C $D
Then execute the setup.sh
script once again.