【问题标题】:mk-livestatus 1.1.6p1 fails to compile on Ubuntu 12.04 (precise)mk-livestatus 1.1.6p1 无法在 Ubuntu 12.04 上编译(精确)
【发布时间】:2013-10-24 14:28:48
【问题描述】:

在尝试编译 CheckMK 的 livestatus Nagios 插件时,我在“make”过程中遇到错误:

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

TableLog.cc的相关部分:

250         int len = offsetof(struct dirent, d_name)
251             + pathconf(log_archive_path, _PC_NAME_MAX) + 1;

来源在http://www.mathias-kettner.de/download/mk-livestatus-1.1.6p1.tar.gz

有一个关于此问题的邮件列表线程 (http://permalink.gmane.org/gmane.network.nagios.checkmk/2560),但仍未得到答复。

【问题讨论】:

    标签: c++ ubuntu nagios


    【解决方案1】:

    TableLog.cc 缺少定义 offsetof() 宏的“stddef.h”包含文件。

    简单添加

    #include <stddef.h>
    

    到 TableLog.cc 的开头

    【讨论】:

      【解决方案2】:

      就像 omribahumi 在之前的回答中所说,编辑 TableLog.cc 文件

      然后注释setup.sh脚本中的523、524、525行

      523      #rm -rf $D
      
      524      #mkdir -p $D
      
      525      #tar xvzf $SRCDIR/livestatus.tar.gz -C $D
      

      然后再次执行setup.sh 脚本。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-01-30
        • 1970-01-01
        • 2012-11-10
        • 2012-12-31
        • 1970-01-01
        • 2015-02-02
        相关资源
        最近更新 更多