[Asterisk-Users] Re: R: Re: cdr_addon_mysql compiling error

Tony Mountifield tony at softins.clara.co.uk
Mon Jun 21 10:00:02 MST 2004


In article <EEF25CC3E5C95F4392737AAF6B21657B9C475D at ticinocom.ticinocomsa.ibbs.net>,
Manuel Wenger <manuel.wenger at ticinocom.com> wrote:
> >> I'm trying to compile cdr_addon_mysql but keep getting this error. 
> >> Again, searching the Wiki and the mailing list archive didn't bring up 
> >> anything useful. Any help? Yes, I'm using MySQL 4.0. Maybe I have to 
> >> switch back to 3.23?
> >> 
> >> 
> >> # make
> >> cc -fPIC -I../asterisk -D_GNU_SOURCE  -I/usr/include/mysql     -c -o cdr_addon_mysql.o
> >> cdr_addon_mysql.c
> >> cdr_addon_mysql.c:50: warning: parameter names (without types) in 
> >> function declaration
> >> cdr_addon_mysql.c:50: warning: data definition has no type or storage class
> >> cdr_addon_mysql.c: In function `mysql_log':
> >> cdr_addon_mysql.c:108: error: `mysql_lock' undeclared (first use in this function)
> >> cdr_addon_mysql.c:108: error: (Each undeclared identifier is reported only once
> >> cdr_addon_mysql.c:108: error: for each function it appears in.)
> >> cdr_addon_mysql.c: In function `usecount':
> >> cdr_addon_mysql.c:420: error: `mysql_lock' undeclared (first use in this function)
> >> make: *** [cdr_addon_mysql.o] Error 1
> >
> >Two things:
> >
> >1. Make sure you have the mysql-devel package installed, or equivalent.
> 
> It is installed:
> # rpm -qa|grep MySQL
> MySQL-client-4.0.20-0
> MySQL-devel-4.0.20-0
> MySQL-shared-compat-4.0.18-0
> MySQL-server-4.0.20-0
> 
> Do you know if MySQL 4 is supposed to work at all, or do I need to downgrade to 3.23?

I believe 4 should work, but your problem is related to Asterisk, not MySQL.

> >2. Make sure you have done a "make install" in "asterisk", before trying
> >   to do a "make" in "asterisk-addons".
> 
> Done that...
> 
> Any ideas please?

Yes. The error on line 50 is due to the line:

AST_MUTEX_DEFINE_STATIC(mysql_lock);

It thinks it is a function declaration, rather than a macro invocation.
AST_MUTEX_DEFINE_STATIC is a macro that declares a mutex in a portable
way. Your other errors are due to the failure to declare mysql_lock.
AST_MUTEX_DEFINE_STATIC was fairly recently added to CVS HEAD, but is
not in the "stable" branch. Update your asterisk tree from CVS HEAD,
make, make install, and then you will find that cdr_addon_mysql compiles.

Cheers
Tony
-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org



More information about the asterisk-users mailing list