最近生产环境升级cacti到0.8.8b的时候,重新./configure的时候cacti-spine-0.8.8b的时候一直报以下错误:

…………….

checking for mysql_init in -lmysqlclient_r... no

configure: error: MySQLlibraries not found

mysqlmysql-developenssl-develnet-snmp-devel安装包没有安装都排除

[root@cactitest2 cacti-spine-0.8.8b]# yum list installed | grep mysqlmysql.x86_64 5.1.69-1.el6_4 @updatesmysql-devel.x86_64 5.1.69-1.el6_4 @updatesmysql-libs.x86_64 5.1.69-1.el6_4 @updatesmysql-server.x86_645.1.69-1.el6_4 @updatesphp-mysql.x86_645.4.11-1.el6 @myrpms[root@cactitest2 cacti-spine-0.8.8b]# yum list installed | grep opensslopenssl.x86_641.0.0-27.el6 @anaconda-CentOS-201303020151.x86_64/6.4openssl-devel.x86_64 1.0.0-27.el6 installed[root@cactitest2 cacti-spine-0.8.8b]# yum list installed | grep net-snmp-develnet-snmp-devel.x86_641:5.5-44.el6_4.4

  而且我测试平台编译一切正常,既然提示mysql库文件有问题,我就从库文件来查看,我们就查看正常编译的和出问题编译的库调用情况查看

首先查看正常的测试平台编译的库调用情况

[root@example cacti-spine-0.8.8b]# strace -o cacti-spine.txt ./configure……………………………….checking that generated files are newer than configure... doneconfigure: creating ./config.statusconfig.status: creating Makefileconfig.status: creating config/config.hconfig.status: config/config.h is unchangedconfig.status: executing depfiles commandsconfig.status: executing libtool commands查看mysql库调用情况[root@example cacti-spine-0.8.8b]# cat cacti-spine.txt | grep mysqlread(3, "/usr/lib64/mysql ", 128) = 17stat("/usr/include/mysql.h", 0x7fffdccacec0) = -1 ENOENT (No such file or directory)stat("/usr/include/mysql/mysql.h", {st_mode=S_IFREG|0644, st_size=33771, ...}) = 0read(3, "/usr/lib64/libmysqlclient_r.*\n", 128) = 30stat("/usr/lib64/libmysqlclient_r.*", 0x7fffdccac830) = -1 ENOENT (No such file or directory)read(3, "/usr/lib64/mysql/libmysqlclient_"..., 128) = 121stat("/usr/lib64/mysql/libmysqlclient_r.so", {st_mode=S_IFREG|0755, st_size=1595240, ...}) = 0access("/usr/lib64/mysql/libmysqlclient_r.so", R_OK) = 0write(1, "checking for mysql_init in -lmys"..., 46) = 46write(1, "checking for mysql_thread_init i"..., 53) = 53

问题平台编译的时候库调用情况

[root@cactitest2cacti-spine-0.8.8b]# strace -o cacti-spine.txt ./configure…………………checking whether we areusing Linux Capabilities... nochecking for mysql_initin -lmysqlclient_r... noconfigure: error: MySQLlibraries not found查看关于mysql的库调用情况[root@examplecacti-spine-0.8.8b]# cat cacti-spine.txt | grep mysqlread(3,"/usr/lib64/mysql /usr/lib/vmware"..., 128) = 128stat("/usr/include/mysql.h",0x7fffea11fe50) = -1 ENOENT (No such file or directory)stat("/usr/include/mysql/mysql.h",{st_mode=S_IFREG|0644, st_size=33771, ...}) = 0read(3, "/usr/lib64/libmysqlclient_r.so.1"..., 128) = 128read(3, "ib64/libmysqlclient_r.so.16.0.0\n", 128) = 32stat("/usr/lib64/libmysqlclient_r.so.12",{st_mode=S_IFREG|0755, st_size=262312, ...}) = 0access("/usr/lib64/libmysqlclient_r.so.12", R_OK) = 0write(1, "checkingfor mysql_init in -lmys"..., 46) = 46

   通过两者对比发现有问题的平台调用的mysql的库文件和正常的平台调用的不是相同的库文件,在问题平台上找到相应的文件

[root@cactitest2 cacti-spine-0.8.8b]# ll /usr/lib64/libmysqlclient*lrwxrwxrwx. 1 root root 26 Jun 27 2013 /usr/lib64/libmysqlclient_r.so.12 -> libmysqlclient_r.so.12.0.0-rwxr-xr-x. 1 root root 262312 Dec 21 2012 /usr/lib64/libmysqlclient_r.so.12.0.0lrwxrwxrwx. 1 root root 26 Jun 27 2013 /usr/lib64/libmysqlclient_r.so.14 -> libmysqlclient_r.so.14.0.0-rwxr-xr-x. 1 root root 1253992 Dec 21 2012 /usr/lib64/libmysqlclient_r.so.14.0.0lrwxrwxrwx. 1 root root 26 Jun 27 2013 /usr/lib64/libmysqlclient_r.so.15 -> libmysqlclient_r.so.15.0.0-rwxr-xr-x. 1 root root 2110184 Dec 21 2012 /usr/lib64/libmysqlclient_r.so.15.0.0lrwxrwxrwx. 1 root root 26 Jun 27 2013 /usr/lib64/libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0-rwxr-xr-x 1 root root 2142576 Dec 21 2012 /usr/lib64/libmysqlclient_r.so.16.0.0lrwxrwxrwx. 1 root root 24 Jun 27 2013 /usr/lib64/libmysqlclient.so.12 -> libmysqlclient.so.12.0.0-rwxr-xr-x. 1 root root 253888 Dec 21 2012 /usr/lib64/libmysqlclient.so.12.0.0lrwxrwxrwx. 1 root root 24 Jun 27 2013 /usr/lib64/libmysqlclient.so.14 -> libmysqlclient.so.14.0.0-rwxr-xr-x. 1 root root 1242088 Dec 21 2012 /usr/lib64/libmysqlclient.so.14.0.0lrwxrwxrwx. 1 root root 24 Jun 27 2013 /usr/lib64/libmysqlclient.so.15 -> libmysqlclient.so.15.0.0-rwxr-xr-x. 1 root root 2101416 Dec 21 2012 /usr/lib64/libmysqlclient.so.15.0.0lrwxrwxrwx. 1 root root 24 Jun 27 2013 /usr/lib64/libmysqlclient.so.16 -> libmysqlclient.so.16.0.0-rwxr-xr-x 1 root root 2131592 Dec 21 2012 /usr/lib64/libmysqlclient.so.16.0.0查看这些库文件是由哪一个安装包安装的[root@cactitest2 cacti-spine-0.8.8b]# rpm -qf /usr/lib64/libmysqlclient_r.so.12MySQL-Cluster-shared-compat-gpl-7.2.10-1.el6.x86_64

移除此安装包

[root@cactitest2 cacti-spine-0.8.8b]# yum remove MySQL-Cluster-shared-compat-gpl

cacti-spine的源码包移动到其他的位置重新编译(重要,移动要移动

[root@cactitest3cacti-spine-0.8.8b]# ./configure…………………………..checking thatgenerated files are newer than configure... doneconfigure:creating ./config.statusconfig.status:creating Makefileconfig.status:creating config/config.hconfig.status:executing depfiles commandsconfig.status:executing libtool commands这样就解决了,make;make install就编译安装完成了[root@cactitest3cacti-spine-0.8.8b]# make;make installgcc-DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp-I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT sql.o -MD -MP -MF.deps/sql.Tpo -c -o sql.o sql.cmv -f.deps/sql.Tpo .deps/sql.Pogcc-DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp-I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT spine.o -MD -MP -MF.deps/spine.Tpo -c -o spine.o spine.cmv -f.deps/spine.Tpo .deps/spine.Pogcc-DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp-I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT util.o -MD -MP -MF.deps/util.Tpo -c -o util.o util.cmv -f.deps/util.Tpo .deps/util.Pogcc-DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp-I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT snmp.o -MD -MP -MF.deps/snmp.Tpo -c -o snmp.o snmp.cmv -f.deps/snmp.Tpo .deps/snmp.Pogcc-DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp-I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT locks.o -MD -MP -MF.deps/locks.Tpo -c -o locks.o locks.cmv -f.deps/locks.Tpo .deps/locks.Pogcc-DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp-I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT poller.o -MD -MP -MF.deps/poller.Tpo -c -o poller.o poller.cmv -f.deps/poller.Tpo .deps/poller.Pogcc-DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp-I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT nft_popen.o -MD -MP-MF .deps/nft_popen.Tpo -c -o nft_popen.o nft_popen.cmv -f.deps/nft_popen.Tpo .deps/nft_popen.Pogcc-DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp-I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT php.o -MD -MP -MF.deps/php.Tpo -c -o php.o php.cmv -f.deps/php.Tpo .deps/php.Pogcc-DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp-I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT ping.o -MD -MP -MF.deps/ping.Tpo -c -o ping.o ping.cmv -f.deps/ping.Tpo .deps/ping.Pogcc-DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp-I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT keywords.o -MD -MP-MF .deps/keywords.Tpo -c -o keywords.o keywords.cmv -f.deps/keywords.Tpo .deps/keywords.Pogcc-DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp-I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT error.o -MD -MP -MF.deps/error.Tpo -c -o error.o error.cmv -f.deps/error.Tpo .deps/error.Po/bin/sh./libtool --tag=CC --mode=link gcc -I/usr/include/net-snmp-I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -L/usr/lib64-L/usr/lib64/mysql -o spine sql.o spine.o util.o snmp.o locks.o poller.onft_popen.o php.o ping.o keywords.o error.o -lnetsnmp -lmysqlclient_r-lmysqlclient_r -lcrypto -lz -lpthread -lmlibtool: link:gcc -I/usr/include/net-snmp -I/usr/include/net-snmp/.. -I/usr/include/mysql -g-O2 -o spine sql.o spine.o util.o snmp.o locks.o poller.o nft_popen.o php.oping.o keywords.o error.o -L/usr/lib64 -L/usr/lib64/mysql -lnetsnmp-lmysqlclient_r -lcrypto -lz -lpthread -lmmake[1]:Entering directory `/root/cacti-spine-0.8.8b'/bin/mkdir -p'/usr/local/spine/bin'/bin/sh./libtool --mode=install /usr/bin/install -c spine '/usr/local/spine/bin'libtool:install: /usr/bin/install -c spine /usr/local/spine/bin/spine/bin/mkdir -p'/usr/local/spine/etc'/usr/bin/install-c -m 644 spine.conf.dist '/usr/local/spine/etc'make[1]:Leaving directory `/root/cacti-spine-0.8.8b'You have newmail in /var/spool/mail/root