Compiling With MySQL Support
Donahue, Pat
pdonahue at acmicorp.com
Wed Jul 7 17:11:44 CEST 2004
Hi,
I'm having problems compiling with MySQL support. I've passed the
appropriate flags to the compiler (note that the db was installed as a
binary distribution):
./configure --with-mysql-xdata --with-mysql-lib=/usr/local/mysql/lib
--with-mysql-inc=/usr/local/mysql/include
I was getting this error: ../xdata/xrddb.c:41: mysql/mysql.h: No such
file or directory
so I copied the includes into a subdirectory named mysql within
/usr/local/mysql/include. That took care of the missing header files.
The next problem was that gcc couldn't seem to find the appropriate
library files, even though I had specified them on the config command
line. As you can see the library directory is specified with -L and the
library itself is specified with -l. I tried removing these LDFLAGS and
just simply specifying the path to the library.. still no luck.
Here is the current error:
# make all
...
gcc -g -O2 -I/usr/local/mysql/include -DHAVE_CONFIG_H -DNSCORE
-L/usr/local/mysql/lib -lmysqlclient nagios.c checks.o config.o
commands.o flapping.o logging.o notifications.o sehandlers.o utils.o
sretention.o ../xdata/xrddb.c ../common/comments.c ../xdata/xcddb.c
../common/objects.c ../xdata/xodtemplate.c ../common/statusdata.c
../xdata/xsddb.c perfdata.o ../xdata/xpddefault.c ../common/downtime.c
../xdata/xdddb.c -lm -o nagios
/tmp/ccokJN8q.o: In function `xrddb_initialize':
/usr/local/src/nagios-1.2/base/../xdata/xrddb.c:224: undefined reference
to `mysql_init'
/tmp/ccokJN8q.o: In function `xrddb_connect':
/usr/local/src/nagios-1.2/base/../xdata/xrddb.c:286: undefined reference
to `mysql_real_connect'
/usr/local/src/nagios-1.2/base/../xdata/xrddb.c:256: undefined reference
to `mysql_close'
...
Why can't Nagios find the MySQL library? During config it even claims it
can!
# ./configure --with-mysql-lib=/usr/local/mysql/lib
--with-mysql-inc=/usr/local/mysql/include --with-mysql-xdata
...
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!
Thanks in advance for the help,
Pat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20040707/a94fe723/attachment.html>
More information about the Users
mailing list