I want to use some mysql functions and therefore I have to pass $(mysql_config --cflags --libs) to the compiler. I found different ways in the Makefile/configure script file to do it:
“./configure CFLAGS=-I/usr/include/mysql LDFLAGS=-L/usr/lib/i386-linux-gnu” before make OR
“make ASTCFLAGS=”$(mysql_config --cflags --libs)"".
But they both do not work. I also tried all sorts of combinations. When compiling a simple test program using “gcc -o test test.c $(mysql_config --cflags --libs)” everything works fine.
Have I done anything wrong or are there other possibilities?
I think it is used to configure an Asterisk Server, but I am developing. I need to use mysql functions in code.
If I turn on “res mysql_config” in menuselect, I get no undefined reference errors but though the program gets stuck at the first mysql command mysql_init.
I tried out literally every configuration combination concerning mysql but I wasn’t successful. If I activate the addon res_config_mysql, there is no undefined reference error but the program gets stuck at mysql_init (I do not really know but there might be some kind of race condition against res_config_mysql’s mysql_init). If I deactivate res_config_mysql, I get an undefined reference error although the configured paths to include and lib are valid. It seems that all mysql options only affect existing mysql addons not any other parts of Asterisk or at least only make an impact if a mysql addon is activated.
The specific part which tells Asterisk to link res_config_mysql against the MySQL client would be this at the top of the file:
/*** MODULEINFO
<depend>mysqlclient</depend>
***/
Adding that to yours would cause Asterisk to link the module against it, provided you are building it within the Asterisk build system. If you are building it outside then it’s up to you.
Now I have a similar problem. I want to use an XML parser. Since libxml2 doesn’t work for me, I want to try expat, but it doesn’t work either because of undefined symbol XML_ParserCreate. I used all information I could find, but I cannot help myself.
Expat needs expat.h. It is located in /usr/include. The libraries are in /lib/i386-linux-gnu and /usr/lib/i386-linux-gnu. So I added the following flags in the Makefile: