最近生产环境升级cacti到0.8.8b的时候,重新./configure的时候cacti-spine-0.8.8b的时候一直报以下错误:
…………….
checking for mysql_init in -lmysqlclient_r... no
configure: error: MySQLlibraries not found
mysql、mysql-devel、openssl-devel、net-snmp-devel安装包没有安装都排除
[root@cactitest2 cacti-spine-0.8.8b]# yum list installed | grep mysql mysql.x86_64 5.1.69-1.el6_4 @updates mysql-devel.x86_64 5.1.69-1.el6_4 @updates mysql-libs.x86_64 5.1.69-1.el6_4 @updates mysql-server.x86_645.1.69-1.el6_4 @updates php-mysql.x86_645.4.11-1.el6 @myrpms [root@cactitest2 cacti-spine-0.8.8b]# yum list installed | grep openssl openssl.x86_641.0.0-27.el6 @anaconda-CentOS-201303020151.x86_64/6.4 openssl-devel.x86_64 1.0.0-27.el6 installed [root@cactitest2 cacti-spine-0.8.8b]# yum list installed | grep net-snmp-devel net-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... done configure: creating ./config.status config.status: creating Makefile config.status: creating config/config.h config.status: config/config.h is unchanged config.status: executing depfiles commands config.status: executing libtool commands 查看mysql库调用情况 [root@example cacti-spine-0.8.8b]# cat cacti-spine.txt | grep mysql read(3, "/usr/lib64/mysql ", 128) = 17 stat("/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, ...}) = 0 read(3, "/usr/lib64/libmysqlclient_r.*\n", 128) = 30 stat("/usr/lib64/libmysqlclient_r.*", 0x7fffdccac830) = -1 ENOENT (No such file or directory) read(3, "/usr/lib64/mysql/libmysqlclient_"..., 128) = 121 stat("/usr/lib64/mysql/libmysqlclient_r.so", {st_mode=S_IFREG|0755, st_size=1595240, ...}) = 0 access("/usr/lib64/mysql/libmysqlclient_r.so", R_OK) = 0 write(1, "checking for mysql_init in -lmys"..., 46) = 46 write(1, "checking for mysql_thread_init i"..., 53) = 53
问题平台编译的时候库调用情况
[[email protected]]# strace -o cacti-spine.txt ./configure ………………… checking whether we areusing Linux Capabilities... no checking for mysql_initin -lmysqlclient_r... no configure: error: MySQLlibraries not found 查看关于mysql的库调用情况 [[email protected]]# cat cacti-spine.txt | grep mysql read(3,"/usr/lib64/mysql /usr/lib/vmware"..., 128) = 128 stat("/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, ...}) = 0 read(3, "/usr/lib64/libmysqlclient_r.so.1"..., 128) = 128 read(3, "ib64/libmysqlclient_r.so.16.0.0\n", 128) = 32 stat("/usr/lib64/libmysqlclient_r.so.12",{st_mode=S_IFREG|0755, st_size=262312, ...}) = 0 access("/usr/lib64/libmysqlclient_r.so.12", R_OK) = 0 write(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.0 lrwxrwxrwx. 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.0 lrwxrwxrwx. 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.0 lrwxrwxrwx. 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.0 lrwxrwxrwx. 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.0 lrwxrwxrwx. 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.0 lrwxrwxrwx. 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.0 lrwxrwxrwx. 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.12 MySQL-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的源码包移动到其他的位置重新编译(重要,移动要移动)
[[email protected]]# ./configure ………………………….. checking thatgenerated files are newer than configure... done configure:creating ./config.status config.status:creating Makefile config.status:creating config/config.h config.status:executing depfiles commands config.status:executing libtool commands 这样就解决了,make;make install就编译安装完成了 [[email protected]]# make;make install gcc-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.c mv -f.deps/sql.Tpo .deps/sql.Po gcc-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.c mv -f.deps/spine.Tpo .deps/spine.Po gcc-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.c mv -f.deps/util.Tpo .deps/util.Po gcc-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.c mv -f.deps/snmp.Tpo .deps/snmp.Po gcc-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.c mv -f.deps/locks.Tpo .deps/locks.Po gcc-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.c mv -f.deps/poller.Tpo .deps/poller.Po gcc-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.c mv -f.deps/nft_popen.Tpo .deps/nft_popen.Po gcc-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.c mv -f.deps/php.Tpo .deps/php.Po gcc-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.c mv -f.deps/ping.Tpo .deps/ping.Po gcc-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.c mv -f.deps/keywords.Tpo .deps/keywords.Po gcc-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.c mv -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 -lm libtool: 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 -lm make[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