FreeBSD, Asterisk and RealTime

Hello!
I have a FreeBSD#amd64 based server
(# uname -a
FreeBSD mail.priceufo.ru 7.2-RELEASE-p6 FreeBSD 7.2-RELEASE-p6 #0: Fri Jan 8 22:28:21 VOLT 2010 bxxxxn@XXXXXXXXX.ru:/usr/src/sys/amd64/compile/MAIL amd64)
with asterisk 1.6.2.14 installed from sources. I have already installed asterisk-addons 1.6.2.2 from sources too with:
./configure --with-mysqlclient=/usr/local/mysql --with-asterisk=/usr/local
gmake && gmake install

It was compiled successfully and asterisk is working now… BUT…:
mailCLI> module load cdr_addon_mysql.so
Unable to load module cdr_addon_mysql.so
Command ‘module load cdr_addon_mysql.so’ failed.
[2010-11-19 15:49:11] WARNING[94458]: loader.c:429 load_dynamic_module: Error loading module ‘cdr_addon_mysql.so’: /usr/local/lib/asterisk/modules/cdr_addon_mysql.so: Undefined symbol “mysql_real_escape_string”
[2010-11-19 15:49:11] WARNING[94458]: loader.c:797 load_resource: Module ‘cdr_addon_mysql.so’ could not be loaded.
mail
CLI>

mailCLI> module load res_config_mysql.so
Unable to load module res_config_mysql.so
Command ‘module load res_config_mysql.so’ failed.
[2010-11-19 15:49:43] WARNING[94458]: loader.c:429 load_dynamic_module: Error loading module ‘res_config_mysql.so’: /usr/local/lib/asterisk/modules/res_config_mysql.so: Undefined symbol “mysql_real_escape_string”
[2010-11-19 15:49:43] WARNING[94458]: loader.c:797 load_resource: Module ‘res_config_mysql.so’ could not be loaded.
mail
CLI>

Please, Could you tell me about what do asterisk want?

I’ve upgraded ports with portsnap fetch && portsnap update then I compiled asterisk-1.2.6.13 from ports by make && make install (I done it at first time with asterisk).
I selected ODBC, ILBC, SPANDSP and some other options.
After that I tried to installed asterisk-addons-1.6.2.2 from ports.
Here is a problem - It did not compile with mysql support as I have already installed mysql from sources in /usr/local/mysql. So asterisk-addons port did not see any mysql files. I did not googgle any and added CONFIG_ARGS= --with-mysqlclient=/usr/local/mysql to Makefile in root directory of the port.
Then I tried to rebuild it and saw that the next problem appears:
mail*CLI> module load cdr_addon_mysql.so
Unable to load module cdr_addon_mysql.so
Command 'module load cdr_addon_mysql.so ’ failed.
[2010-11-23 12:05:57] WARNING[3945]: loader.c:429 load_dynamic_module: Error loading module ‘cdr_addon_mysql.so’: /usr/local/lib/asterisk/modules/cdr_addon_mysql.so: Undefined symbol “mysql_real_escape_string”
[2010-11-23 12:05:57] WARNING[3945]: loader.c:797 load_resource: Module ‘cdr_addon_mysql.so’ could not be loaded.

So I saw the config.log and see:
checking /usr/local/mysql/bin/mysql_config not found

I added symbolic link in /usr/local/bin to mysql_config:
ln -s /usr/local/mysql/bin/mysql_config mysql_config
and rebuild port.

Oh, YES!!!
mail*CLI> module load cdr_addon_mysql.so
Loaded cdr_addon_mysql.so
== Parsing ‘/usr/local/etc/asterisk/cdr_mysql.conf’: == Found
Loaded cdr_addon_mysql.so => (MySQL CDR Backend)

Ok. Now I am trying to do same actions with sources of asterisk-1.2.6.14 and asterisk-addons-1.6.2.2.
I hope it will be built successfully .

Hi, again!
So, FreeBSD 7.2#amd64, spandsp-0.0.6pre17, Asterisk 1.6.2.14, asterisk-addons-1.6.2.2, mysql-5.1.41
I have also installed newt, ltdl, unixodbc and some other things which are can be used as optional.
BEFORE start:
I have installed mysql in /usr/local/mysql
so, I need make:
cd /usr/local/bin
ln -s /usr/local/mysql/bin/mysql_config mysql_config
and other links for mysqladmin, libmysqlclient.so and etc.

I have built all from sources:

  1. spandsp:
    ./configure CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib --disable-doc --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info --build=amd64-portbld-freebsd7.2
    make && make install

  2. asterisk:
    ./configure --prefix=/usr/local
    gmake menuselect (check app_fax and other)
    gmake
    gmake install
    gmake samples

  3. asterisk-addons:
    ./configure --with-asterisk=/usr/local --with-mysqlclient=/usr/local/mysql
    gmake
    gmake install
    gmake samples

  4. Startup script:
    cd /usr/ports/net/asterisk16/files
    cp asterisk.sh.in /usr/local/etc/rc.d/asterisk
    replace all entires of “%%PREFIX%%” by "/usr/local"
    add “asterisk_enable” to /etc/rc.conf
    cd /usr/local/etc/rc.d
    ./asterisk start

  5. Loading module cdr_addon_mysql.so
    asterisk -cvvvvvvvvvr
    load module cdr_addon_mysql.so

if you will see:
Loaded cdr_addon_mysql.so
== Parsing ‘/usr/local/etc/asterisk/cdr_mysql.conf’: == Found
Loaded cdr_addon_mysql.so => (MySQL CDR Backend)
mail*CLI> module unload cdr_addon_mysql.so

Module is loaded ok.