PDA

View Full Version : server and mysql compile problems - alpha11


clawson
08-08-2005, 21:56
I am having problems getting alpha11 to compile:

My environment:

Solaris 9
gcc 2.95.3
MySQL 4.0.25 and MySQL 4.1.8

My configure command, which is successful:

LIBS="-lresolv" \
CC=/opt/sfw/bin/gcc \
./configure \
--prefix=/opt/zabbix \
--enable-server \
--with-mysql=/opt/mysql

gmake results, at point of failure:

gmake[3]: Entering directory `/home/clawson/zabbix-1.1alpha11/src/zabbix_server'
source='evalfunc.c' object='evalfunc.o' libtool=no \
DEPDIR=.deps depmode=gcc /bin/bash ../../depcomp \
/opt/sfw/bin/gcc -DHAVE_CONFIG_H -I. -I. -I../../include -I../../include -I/opt/mysql/include -g -O2 -c evalfunc.c
source='expression.c' object='expression.o' libtool=no \
DEPDIR=.deps depmode=gcc /bin/bash ../../depcomp \
/opt/sfw/bin/gcc -DHAVE_CONFIG_H -I. -I. -I../../include -I../../include -I/opt/mysql/include -g -O2 -c expression.c
source='actions.c' object='actions.o' libtool=no \
DEPDIR=.deps depmode=gcc /bin/bash ../../depcomp \
/opt/sfw/bin/gcc -DHAVE_CONFIG_H -I. -I. -I../../include -I../../include -I/opt/mysql/include -g -O2 -c actions.c
source='zlog.c' object='zlog.o' libtool=no \
DEPDIR=.deps depmode=gcc /bin/bash ../../depcomp \
/opt/sfw/bin/gcc -DHAVE_CONFIG_H -I. -I. -I../../include -I../../include -I/opt/mysql/include -g -O2 -c zlog.c
source='functions.c' object='functions.o' libtool=no \
DEPDIR=.deps depmode=gcc /bin/bash ../../depcomp \
/opt/sfw/bin/gcc -DHAVE_CONFIG_H -I. -I. -I../../include -I../../include -I/opt/mysql/include -g -O2 -c functions.c
source='server.c' object='server.o' libtool=no \
DEPDIR=.deps depmode=gcc /bin/bash ../../depcomp \
/opt/sfw/bin/gcc -DHAVE_CONFIG_H -I. -I. -I../../include -I../../include -I/opt/mysql/include -g -O2 -c server.c
/opt/sfw/bin/gcc -g -O2 -o zabbix_server -L/opt/mysql/lib -lmysqlclient -lm -lz evalfunc.o expression.o actions.o zlog.o functions.o server.o ../libs/zbxsysinfo/libzbxsysinfo.a ../libs/zbxlog/libzbxlog.a ../libs/zbxpid/libzbxpid.a ../libs/zbxconf/libzbxconf.a ../libs/zbxdbhigh/libzbxdbhigh.a ../libs/zbxcrypto/libzbxcrypto.a ../libs/zbxnet/libzbxnet.a pinger/libzbxpinger.a poller/libzbxpoller.a escalator/libzbxescalator.a housekeeper/libzbxhousekeeper.a alerter/libzbxalerter.a timer/libzbxtimer.a trapper/libzbxtrapper.a ../libs/zbxemail/libzbxemail.a ../libs/zbxcommon/libzbxcommon.a -lnsl -lkstat -lsocket -lresolv
Undefined first referenced
symbol in file
mysql_fetch_row ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)
mysql_data_seek ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)
mysql_query ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)
mysql_errno ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)
mysql_error ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)
mysql_close ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)
mysql_insert_id ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)
mysql_free_result evalfunc.o
mysql_store_result ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)
mysql_init ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)
mysql_select_db ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)
mysql_affected_rows ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)
mysql_real_connect ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)
mysql_num_rows ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)
ld: fatal: Symbol referencing errors. No output written to zabbix_server
collect2: ld returned 1 exit status
gmake[3]: *** [zabbix_server] Error 1
gmake[3]: Leaving directory `/home/clawson/zabbix-1.1alpha11/src/zabbix_server'
gmake[2]: *** [all-recursive] Error 1
gmake[2]: Leaving directory `/home/clawson/zabbix-1.1alpha11/src/zabbix_server'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/home/clawson/zabbix-1.1alpha11/src'
gmake: *** [all-recursive] Error 1

This looks like a MySQL client problem. I have both the 4.0.25 (latest 4.0 version) and an earlier 4.1.8 version avialable (these are the binary installations--I didn't compile MySQL or use packages). Using either version of MySQL has the same results. With either installation the headers files are available in /opt/mysql/include and libmysqlclient.a is avaliable at /opt/mysql/lib.

Can anyone provide help?

Thanks,
Dan

clawson
09-08-2005, 20:25
I found this posting at the SourceForge Zabbix site:

http://sourceforge.net/tracker/index.php?func=detail&aid=411660&group_id=23494&atid=378683

This bug report has a problem when the "-lmysqlclient -lm" flags were not include in the gcc command.

In my instance, the flags were set, but at the first part of the statement. I manually moved them to the end of the statement, along with "-lz" and it worked fine.

I got the idea of reordering the gcc command from this bug report:

http://sourceforge.net/tracker/index.php?func=detail&aid=415420&group_id=23494&atid=378683

I completed the make and make install after this without incident.

So here is the original gcc command that failed:

opt/sfw/bin/gcc -g -O2 -o zabbix_server -L/opt/mysql/lib -lmysqlclient -lm -lz evalfunc.o expression.o actions.o zlog.o functions.o server.o ../libs/zbxsysinfo/libzbxsysinfo.a ../libs/zbxlog/libzbxlog.a ../libs/zbxpid/libzbxpid.a ../libs/zbxconf/libzbxconf.a ../libs/zbxdbhigh/libzbxdbhigh.a ../libs/zbxcrypto/libzbxcrypto.a ../libs/zbxnet/libzbxnet.a pinger/libzbxpinger.a poller/libzbxpoller.a escalator/libzbxescalator.a housekeeper/libzbxhousekeeper.a alerter/libzbxalerter.a timer/libzbxtimer.a trapper/libzbxtrapper.a ../libs/zbxemail/libzbxemail.a ../libs/zbxcommon/libzbxcommon.a -lnsl -lkstat -lsocket -lresolv

And the statement that worked:

/opt/sfw/bin/gcc -g -O2 -o zabbix_server -L/opt/mysql/lib evalfunc.o expression.o actions.o zlog.o functions.o server.o ../libs/zbxsysinfo/libzbxsysinfo.a ../libs/zbxlog/libzbxlog.a ../libs/zbxpid/libzbxpid.a ../libs/zbxconf/libzbxconf.a ../libs/zbxdbhigh/libzbxdbhigh.a ../libs/zbxcrypto/libzbxcrypto.a ../libs/zbxnet/libzbxnet.a pinger/libzbxpinger.a poller/libzbxpoller.a escalator/libzbxescalator.a housekeeper/libzbxhousekeeper.a alerter/libzbxalerter.a timer/libzbxtimer.a trapper/libzbxtrapper.a ../libs/zbxemail/libzbxemail.a ../libs/zbxcommon/libzbxcommon.a -lnsl -lkstat -lsocket -lresolv -lmysqlclient -lm -lz


Interestingly enough, the second bug report mentioned above was posted in 2001 and then deleted. I am glad that it was still in the archive.