Further problems with NDO Utils

tom.welsh at bt.com tom.welsh at bt.com
Wed Sep 12 19:15:05 CEST 2007


Hi Andreas,

Thanks for coming back to me on this.

Mysql was installed from source 

	mysql 5.0.45
	./configure --prefix=/usr/local/mysql 

I believe that that is the default install location anyway.

I ran ldd, I completely forgot about that and I get the following

	  /usr/local/nagios/var # ldd /usr/local/nagios/bin/ndo2db
        linux-gate.so.1 =>  (0xffffe000)
        libz.so.1 => /lib/libz.so.1 (0x4001f000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x40030000)
        libmysqlclient.so.15 => not found
        libm.so.6 => /lib/tls/libm.so.6 (0x40045000)
        libc.so.6 => /lib/tls/libc.so.6 (0x40067000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

As you can see its not found the libmysqlclient even though it says it
has. If I run a find I can see it.

	  # find / -name libmysqlclient.so.15
	  /usr/local/mysql/lib/mysql/libmysqlclient.so.15

I use the following command_line to configure ndo utils

	  NDO-Utils 1.4b5
	  ./configure --enable-mysql
--with-mysql-lib=/usr/local/mysql/lib/mysql
--with-mysql-inc=/usr/local/mysql/include

When I run make I get the following error.

	make
	cd ./src/; make ; cd ..
	make[1]: Entering directory `/home/w/ndoutils-1.4b5/src'
	gcc -fPIC -O0 -g -DHAVE_CONFIG_H -c -o io.o io.c
	In file included from io.c:10:
	../include/config.h:250:25: mysql/mysql.h: No such file or
directory
	../include/config.h:251:26: mysql/errmsg.h: No such file or
directory
	make[1]: *** [io.o] Error 1
	make[1]: Leaving directory `/home/welsht2/ndoutils-1.4b5/src'

I then edit ./include/config.h to include the complete path to the mysql
libs

So I change the mysql bit of config.h 

FROM

	#define USE_MYSQL 1
	/* #undef HAVE_MYSQL */
	#ifdef USE_MYSQL
	#define HAVE_MYSQL 1
	#include <mysql/mysql.h>
	#include <mysql/errmsg.h>
	#endif

TO

	#define USE_MYSQL 1
	/* #undef HAVE_MYSQL */
	#ifdef USE_MYSQL
	#define HAVE_MYSQL 1
	#include </usr/local/mysql/include/mysql/mysql.h>
	#include </usr/local/mysql/include/mysql/errmsg.h>
	#endif

This then does a make all ok. I can see the compile go through that does
the libmysql bit


	make ndo2db-2x
	make[2]: Entering directory `/home/welsht2/ndoutils-1.4b5/src'
	gcc -O0 -g -DHAVE_CONFIG_H -c -o db.o db.c	
	gcc -O0 -g -DHAVE_CONFIG_H -D BUILD_NAGIOS_2X -c -o
dbhandlers-2x.o dbhandlers.c
	gcc -O0 -g -DHAVE_CONFIG_H -I/usr/local/mysql/include -D
BUILD_NAGIOS_2X -o ndo2db-2x ndo2db.c dbhandlers-2x.o io.o 	utils.o
db.o  -L/usr/local/mysql/lib/mysql -lz  -lnsl -lmysqlclient -lm
	make[2]: Leaving directory `/home/welsht2/ndoutils-1.4b5/src'

	make ndo2db-3x
	make[2]: Entering directory `/home/welsht2/ndoutils-1.4b5/src'
	gcc -O0 -g -DHAVE_CONFIG_H -D BUILD_NAGIOS_3X -c -o
dbhandlers-3x.o dbhandlers.c
	gcc -O0 -g -DHAVE_CONFIG_H -I/usr/local/mysql/include -D
BUILD_NAGIOS_3X -o ndo2db-3x ndo2db.c dbhandlers-3x.o io.o 	utils.o
db.o  -L/usr/local/mysql/lib/mysql -lz  -lnsl -lmysqlclient -lm
	make[2]: Leaving directory `/home/welsht2/ndoutils-1.4b5/src'

Any more ideas off how I can get this working. Im not very good with
hunting down software compilation problems :(

All help gratefully received

Regards

Tom

-----Original Message-----
From: Andreas Ericsson [mailto:ae at op5.se] 
Sent: 12 September 2007 17:51
To: Welsh,T,Tom,XSL4A C
Cc: Nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] Further problems with NDO Utils

tom.welsh at bt.com wrote:
> Hi Again list.
> 
> Im my continuing saga to try and get NDO Utils working I have come up 
> against another error.
> 
> 	# /usr/local/nagios/bin/ndo2db -c
> /usr/local/nagios/etc/ndo2db.cfg
> 
> 	/usr/local/nagios/bin/ndo2db: error while loading shared
> libraries: libmysqlclient.so.15: cannot open shared object file: No 
> such file or directory
> 
> If I check the output off ./configure I can see that it found the 
> mysqlclient libs
> 
> 	checking for mysql_store_result in -lmysqlclient... yes
> 	checking mysql/mysql.h usability... yes
> 	checking mysql/mysql.h presence... yes
> 	checking for mysql/mysql.h... yes
> 	MySQL library and include file(s) were found!
> 
> Can anyone point me in the right direction please. 
> 

ldd /usr/local/nagios/bin/ndo2db

will tell you where it tries to find the libmysqlclient.so.15 library.
Creating a symlink there to where you actually keep the library should
suffice.

Did you have mysql installed in some nonstandard location when you
compiled the program? If so, the location was hardlinked into the binary
and you need to either re-compile (and tell it the new location) or move
the library back to its original position. If the new location is
shorter (strlen(path_to_new_loc) < strlen(path_to_old_loc)), you can use
a hex-editor to modify the binary to point to the new location.
Don't do this if it's the other way around though.

Good luck

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list