c++ - mk-livestatus 1.1.6p1 无法在 Ubuntu 12.04 上编译(精确)

标签 c++ ubuntu nagios

尝试编译 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 ),但仍未得到答复。

最佳答案

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

简单添加

#include <stddef.h>

到TableLog.cc开头

关于c++ - mk-livestatus 1.1.6p1 无法在 Ubuntu 12.04 上编译(精确),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19568742/

相关文章:

linux - 用于监视新创建目录的 Bash 脚本

ubuntu - 使用 jmeter 插件进行 Nagios 测试失败,出现 CRITICAL : . .. java.util.prefs.FileSystemPreferences$1 run

java - 如何配置 JBoss 6.3.0GA 使用 RMI JMX?

c++ - 如何在 C++ 的循环中从 vector 中删除元素

c++ - 了解构造函数定义 block 的句法变体

c++ - 从输入中添加连续整数(从 Python 翻译成 C++)

ubuntu - Nginx:如何仅将主域与 server_name 匹配

c++ - 函数返回 int&

file - FTP 服务器不允许我上传 .htaccess 文件

linux - 如何在 Ubuntu 上安装/编译 lgmask?