[Asterisk-Users] Trouble compiling asterisk-addons MySQL

James Freire JFreire at Comtech21.com
Wed Jul 28 06:57:29 MST 2004


Well. I have seemed to get a little farther with the problem. I added in a line in to the Makefile of

CFLAGS+=-I/usr/local/mysql/include/mysql
Now I get an error that has to do with mysqlclient below... I have also included my entire Makefile below the error.

Thanks


root at linux2:/usr/src/asterisk-addons# make install
./mkdep -fPIC -I../asterisk -I/usr/local/mysql/include/mysql 
-D_GNU_SOURCE -I/usr/local/mysql/include    `ls *.c`
cc -fPIC -I../asterisk -I/usr/local/mysql/include/mysql -D_GNU_SOURCE 
-I/usr/local/mysql/include      -c -o cdr_addon_mysql.o cdr_addon_mysql.c
cc -shared -Xlinker -x -o cdr_addon_mysql.so cdr_addon_mysql.o 
-lmysqlclient -lz   -L/usr/local/mysql/lib  
/usr/lib/gcc-lib/i486-slackware-linux/3.2.3/../../../../i486-slackware-linux/bin/ld: 
cannot find -lmysqlclient
collect2: ld returned 1 exit status
make: *** [cdr_addon_mysql.so] Error 1



#
# Asterisk -- A telephony toolkit for Linux.
#
# Makefile for CDR backends (dynamically loaded)
#
# Copyright (C) 1999, Mark Spencer
#
# Mark Spencer <markster at linux-support.net>
#
# This program is free software, distributed under the terms of
# the GNU General Public License
#

MODS=

CFLAGS+=-fPIC
CFLAGS+=-I../asterisk
CFLAGS+=-I/usr/local/mysql/include/mysql
CFLAGS+=-D_GNU_SOURCE

INSTALL=install
INSTALL_PREFIX=
ASTLIBDIR=$(INSTALL_PREFIX)/usr/lib/asterisk
MODULES_DIR=$(ASTLIBDIR)/modules

#
# MySQL stuff...  Autoconf anyone??
#
MODS+=$(shell if [ -d /usr/local/mysql/include/mysql ] || [ -d 
/usr/include/mysql ] || [ -d /usr
/local/include/mysql ] || [ -d /opt/mysql/include ]; then echo 
"cdr_addon_mysql.so"; fi)
CFLAGS+=$(shell if [ -d /usr/local/mysql/include/mysql ]; then echo 
"-I/usr/local/mysql/include"
; fi)
CFLAGS+=$(shell if [ -d /usr/include/mysql ]; then echo 
"-I/usr/include/mysql"; fi)
CFLAGS+=$(shell if [ -d /usr/local/include/mysql ]; then echo 
"-I/usr/local/include/mysql"; fi)
CFLAGS+=$(shell if [ -d /opt/mysql/include/mysql ]; then echo 
"-I/opt/mysql/include/mysql"; fi)
MLFLAGS=
MLFLAGS+=$(shell if [ -d /usr/lib/mysql ]; then echo "-L/usr/lib/mysql"; fi)
MLFLAGS+=$(shell if [ -d /usr/local/mysql/lib ]; then echo 
"-L/usr/local/mysql/lib"; fi)
MLFLAGS+=$(shell if [ -d /usr/local/lib/mysql ]; then echo 
"-L/usr/local/lib/mysql"; fi)
MLFLAGS+=$(shell if [ -d /opt/mysql/lib/mysql ]; then echo 
"-L/opt/mysql/lib/mysql"; fi)

all: depend $(MODS)

install: all
        for x in $(MODS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done

clean:
        rm -f *.so *.o .depend

%.so : %.o
        $(CC) -shared -Xlinker -x -o $@ $<

ifneq ($(wildcard .depend),)
include .depend
endif

cdr_addon_mysql.so: cdr_addon_mysql.o
        $(CC) -shared -Xlinker -x -o $@ $< -lmysqlclient -lz $(MLFLAGS)

depend: .depend

.depend:
        ./mkdep $(CFLAGS) `ls *.c`

-----Original Message-----
From: Oleg A. Arkhangelsky [mailto:sysoleg at progtech.ru]
Sent: Wednesday, July 28, 2004 9:48 AM
To: asterisk-users-admin at lists.digium.com; James Freire
Cc: asterisk-users at lists.digium.com
Subject: Re: [Asterisk-Users] Trouble compiling asterisk-addons MySQL


Hello James,

Wednesday, July 28, 2004, 5:23:16 PM, you wrote:

JF> root at linux2:/usr/src/asterisk-addons# make install
JF> ./mkdep -fPIC -I../asterisk -D_GNU_SOURCE     `ls *.c`
JF> cdr_addon_mysql.c:33:19: mysql.h: No such file or directory
JF> cdr_addon_mysql.c:34:20: errmsg.h: No such file or directory
JF> for x in  ; do install -m 755 $x /usr/lib/asterisk/modules ; done

    You need to install libmysqlclient-devel (or alike) package with
    relevant header files.

-- 
Best regards,
 Oleg                            mailto:sysoleg at progtech.ru




More information about the asterisk-users mailing list