安装ndoutils 提示“MySQL library could not be located”错误!

在配置Nagios+Cacti时,安装Ndoutils时,出现了问题!

  运行命令如下:

[root@rhel ndoutils-1.4b9]# ./configure --prefix=/usr/local/nagios --enable-mysql --disable-pgsql --with-mysql-inc=/usr/include/mysql --with-mysql-lib=/usr/lib/mysql

  问题提示内容如下:

*** MySQL library could not be located... **************************
 You chose to compile NDBXT with MySQL support, but I was unable to 
 locate the MySQL library on your system.  If the library is 
 installed,  use the --with-mysql-lib argument to specify the 
 location of the MySQL library.
 NOTE: After you install the necessary libraries on your system: 
       1. Make sure /etc/ld.so.conf has an entry for the directory in 
          which the MySQL libraries are installed. 
       2. Run 'ldconfig' to update the run-time linker options. 
       3. Run 'make devclean' in the NDBXT distribution to clean out 
          any old references to your previous compile. 
       4. Rerun the configure script.
 TIP: Try the following....
          ./configure --with-mysql-lib=/usr/lib/mysql

  解决过程:

  百度很久了,都没有找到我想要的答案。不过,有个有关于64位系统的解决方法,如下:

将上述运行命令修改为,即可:
[root@rhel ndoutils-1.4b9]#./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql --with-mysql-inc=/usr/include/mysql --with-mysql-lib=/usr/lib64/mysql

  而对于32位的系统呢?像都找不到答案,后来想想,由于自己的MySQL是直接用yum安装的(lib位置为系统默认),所以直接不指定MySQL的位置,这样就可以通过configure了!如下:

[root@rhel ndoutils-1.4b9]#./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql

  然后在最后那里可以看到如下的内容,表明已经通过了!

 checking for mysql_config... /usr/bin/mysql_config
 
 checking for mysql_init in -lmysqlclient... yes
 
 MySQL library and include file(s) were found!

祝福你好运!

原文地址:https://www.cnblogs.com/sbaicl/p/2776410.html