Nagios and Mysql

Jonathan Rozes jrozes at vinton.com
Wed Nov 27 22:21:09 CET 2002


Check *all* the Makefiles, not just the top-level one. In each, wherever
CFLAGS and LDFLAGS are set, they should include the paths you specified in
configure, something like this:

CFLAGS=-g -O2 -I/root/mysql-3.23.53a-pc-linux-gnu-i686/include
-fno-strict-aliasing -I/usr/libdata/perl5/i386-openbsd/5.6.1/CORE
-DHAVE_CONFIG_H
LDFLAGS=-L/root/mysql-3.23.53a-pc-linux-gnu-i686/lib -lmysqlclient

And when you run 'make all' you should see the compiler using these flags
when compiling and linking the nagios binary.

I'm not sure how picky your compiler is, but another possibility is that you
have trailing slashes in your configure arguments. Try rerunning configure
without them if the Makefiles look okay.

jonathan

> -----Original Message-----
> From: ForMatPrO ForMatPrO [mailto:formatpro at yahoo.co.uk]
> Sent: Wednesday, November 27, 2002 12:47 PM
> To: Jonathan Rozes; Nagios-users at lists.sourceforge.net
> Subject: RE: [Nagios-users] Nagios and Mysql
> 
> 
> Yes, I should have posted more info, I'm sorry...
> 
> ok, I started the configure script like this:
> "./configure --with-mysql-xdata
> --with-mysql-lib=/root/mysql-3.23.53a-pc-linux-gnu-i686/lib/
> --with-mysql-inc=/root/mysql-3.23.53a-pc-linux-gnu-i686/include/"
> 
> Evertything seemed to be OK.
> 
> Some output:
> 
> "We'll use MySQL database routines (in xdata/xsddb.*)
> for status data I/O...
> We'll use MySQL database routines (in xdata/xcddb.*)
> for comment data I/O...
> We'll use MySQL database routines (in xdata/xeddb.*)
> for extended data I/O...
> We'll use MySQL database routines (in xdata/xrddb.*)
> for retention data I/O...
> We'll use template-based routines (in
> xdata/xodtemplate.*) for object data I/O...
> We'll use default routines (in xdata/xpddefault.*) for
> performance data I/O...
> We'll use MySQL database routines (in xdata/xdddb.*)
> for scheduled downtime data I/O...
> checking for main in -lmysqlclient... yes
> MySQL library was found!
> checking for gdImagePng in -lgd (order 1)... yes
> GD library was found!"
> 
> So it found the Mysql library...
> 
> the makefile also has '-lmysqlclient' in LDFLAGS.
> 
> Then I got this with "make all":
> 
> ../xdata/xsddb.c:46:25: mysql/mysql.h: No such file or
> directory
> ../xdata/xsddb.c:47:26: mysql/errmsg.h: No such file
> or directory
> 
> So I changed the path in xsddb.c, xcddb.c, etc... so
> it got the correct location to mysql.h and errmsg.h
> ...
> 
> example:
> 
> #include
> "/root/mysql-3.23.53a-pc-linux-gnu-i686/include/mysql.h"
> #include
> "/root/mysql-3.23.53a-pc-linux-gnu-i686/include/errmsg.h"
> 
> After that, I got all the "undefined reference to
> `mysql" errors when I try to compile.
> 
> some output:
> 
> /tmp/ccuihhQ8.o: In function `xrddb_initialize':
> /root/nagios-1.0/base/../xdata/xrddb.c:215: undefined
> reference to `mysql_init'
> /tmp/ccuihhQ8.o: In function `xrddb_connect':
> /root/nagios-1.0/base/../xdata/xrddb.c:252: undefined
> reference to `mysql_real_connect'
> /root/nagios-1.0/base/../xdata/xrddb.c:254: undefined
> reference to `mysql_close'/tmp/ccuihhQ8.o: In function
> `xrddb_disconnect':
> /root/nagios-1.0/base/../xdata/xrddb.c:299: undefined
> reference to `mysql_close'/tmp/ccuihhQ8.o: In function
> `xrddb_query':
> 
> --- Jonathan Rozes <jrozes at vinton.com> wrote: > I'm
> sure lots of people have compiled it
> > successfully. I have on OpenBSD 3.1
> > and 3.2, for example. Can't really help you though
> > since you haven't showed
> > us what led you to your current situation. What
> > flags did you invoke the
> > configure script with? What was the output produced
> > by the configure script?
> > Does it say it found the mysql client library? Does
> > the resulting Makefile
> > have '-lmysqlclient' in LDFLAGS? Where are your
> > mysql headers and libraries
> > installed? How do you expect anybody to help you if
> > you don't supply any
> > useful information?
> > 
> > jonathan
> > 
> > > -----Original Message-----
> > > From: ForMatPrO ForMatPrO
> > [mailto:formatpro at yahoo.co.uk]
> > > Sent: Tuesday, November 26, 2002 11:49 PM
> > > To: Nagios-users at lists.sourceforge.net
> > > Subject: [Nagios-users] Nagios and Mysql
> > > 
> > > 
> > > Hi,
> > > 
> > > I still can't get Nagios with Mysql to work... Did
> > > anyone compile nagios with mysql? If so, what OS
> > did
> > > you use?  Or does anyone know with what OS it
> > should
> > > work right out the box?
> > > 
> > > I still get the "undefined reference to `mysql"
> > errors
> > > while compiling :/
> > > 
> > > Thx.
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
> 


-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T 
handheld. Power & Color in a compact size! 
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en




More information about the Users mailing list