今天星痕(网名)搭建nagios整合平台,编译ndoutils-1-5的时候出现问题,遂一起研究
MysqL用的是源码5.5.11安装的,在编译的时候使用不同参数,configure能正常通过,make却报错,也有configure报错,nake却正常的
更详细的ndoutils安装问题,请看此文
http://hi.baidu.com/dongjunjia/blog/item/3c0043ed27a52a372697919f.html
#./configure --prefix=/usr/local/nagios --enable-MysqL LDFLAGS=-L/usr/local/MysqL --with-MysqL-inc=/usr/local/MysqL/include --with-ndo2db-user=nagios --with-ndo2db-group=nagios --with-MysqL=/usr/local/MysqL --with-MysqL-lib=/usr/local/MysqL/lib/MysqL
前面省略掉……
checking for initgroups... yes
checking for strtof... yes
checking for type of socket size... size_t
checking for linker flags for loadable modules... -shared
checking for MysqL_init in -lMysqLclient... yes
MysqL library and include file(s) were found!
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating docs/docbook/en-en/Makefile
config.status: creating subst
config.status: creating include/config.h
checking for strtof... yes
checking for type of socket size... size_t
checking for linker flags for loadable modules... -shared
checking for MysqL_init in -lMysqLclient... yes
MysqL library and include file(s) were found!
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating docs/docbook/en-en/Makefile
config.status: creating subst
config.status: creating include/config.h
*** Configuration summary for ndoutils 1.5 02-03-2012 ***:
General Options:
-------------------------
NDO2DB user: nagios
NDO2DB group: nagios
-------------------------
NDO2DB user: nagios
NDO2DB group: nagios
Review the options above for accuracy. If they look okay,
type 'make' to compile the NDO utilities.
configure是成功的
[root@localhost ndoutils-1-5]# make
cd ./src && make
make[1]: Entering directory `/root/nagios/nd2db_test/ndoutils-1-5/src'
gcc -fPIC -g -O2 -I/usr/local/MysqL/include -DHAVE_CONFIG_H -c -o io.o io.c
在包含自 io.c:11 的文件中:
../include/config.h:261:25: 错误:MysqL/MysqL.h:没有那个文件或目录
../include/config.h:262:26: 错误:MysqL/errmsg.h:没有那个文件或目录
make[1]: *** [io.o] 错误 1
make[1]: Leaving directory `/root/nagios/nd2db_test/ndoutils-1-5/src'
make: *** [all] 错误 2
[root@localhost ndoutils-1-5]#
cd ./src && make
make[1]: Entering directory `/root/nagios/nd2db_test/ndoutils-1-5/src'
gcc -fPIC -g -O2 -I/usr/local/MysqL/include -DHAVE_CONFIG_H -c -o io.o io.c
在包含自 io.c:11 的文件中:
../include/config.h:261:25: 错误:MysqL/MysqL.h:没有那个文件或目录
../include/config.h:262:26: 错误:MysqL/errmsg.h:没有那个文件或目录
make[1]: *** [io.o] 错误 1
make[1]: Leaving directory `/root/nagios/nd2db_test/ndoutils-1-5/src'
make: *** [all] 错误 2
[root@localhost ndoutils-1-5]#
先在系统里面找这2个文件
[root@localhost ndoutils-1-5]# find /usr/local/MysqL/ -name MysqL.h
/usr/local/MysqL/include/MysqL.h
/usr/local/MysqL/include/MysqL.h
[root@localhost ndoutils-1-5]# find /usr/local/MysqL/ -name errmsg.h
/usr/local/MysqL/include/errmsg.h
/usr/local/MysqL/include/errmsg.h
第二看报错信息 ../include/config.h 那么由此可以看到 上面2个出错文件是由config .h定义的
再次make 则顺利通过
当然,处理上面的问题,还可以通过建立链接的方式
对上面解决问题的思路做一个总结:
往往给我们带来很多麻烦。对于此类问题,首先是找到错误提示信息,针对错误提示,分析系统是否有这个文件,再次是分析源码文件的库文件相关应用位置,上例中,正是由于库文件引用不正确导致的,所以很容易就把吃问题解决了。
itnihao 2012-02-29于成都