Summary:ASTERISK-07285: [patch] MySQL addons not building
Reporter:John Martin (jfp_martin)Labels:
Date Opened:2006-07-05 04:32:27Date Closed:2006-07-12 20:21:25
Versions:Frequency of
Environment:Attachments:( 0) configure.patch
Description:The addons/trunk was not building with the new menuselect/configure support on my system. The configure script could not find the mysqlclient or header files.


Linux CentOS 4.1
Asterisk/trunk rev 36910 Addons/trunk rev 256

Russell and I had a brief IRC and he submitted revision 256.
This didn't fix the problem so I've been looking into the problem some more.

I think the problem is that if you install mysql from source you get all the installation below one directory. If you use a distribution then you get the libs in one place and the includes in another.

On my system I have

Russell added a second -L directory to configure and acinclude.m4 that didn't quite find both the lib and the header files.

The included patch modifies Russell's change so that if you specify:
./configure --with-mysqlclient=/usr
it will find both the lib and include on my system, and shouldn't affect already working systems.

*** I also had to change the case of the mysqlclient_DIR to MYSQLCLIENT_DIR to get it to work ***

Comments:By: Matt O'Gorman (mogorman) 2006-07-05 17:20:52

fixed in trunk already

By: John Martin (jfp_martin) 2006-07-06 03:25:44

I'm a bit confused about why this was closed.

I don't think the problem is fixed in trunk.

To fix trunk my patch is needed or prehaps someone could explain how trunk can work in some way I've missed.

Many thanks, John

By: Russell Bryant (russell) 2006-07-07 14:28:57

Try running "./configure --with-mysqlclient=/usr/lib/mysql" with what is currently there

By: dea (dea) 2006-07-07 14:39:49

With changing the case of mysqlclient to MYSQLCLIENT the configure script does find the library, but now I am getting usibility/presence failures.

The script was looking for the headers in the library directory, so I changed the MYSQLCLIENT_INCLUDE to point to the header files, and modified the tests to
use MYSQLCLIENT_INCLUDE instead of MYSQLCLIENT_DIR.  I am still getting usability and presence failures.

By: dea (dea) 2006-07-07 14:46:20

Of course it moves right along after I post a note.  Since I really have no idea what I am doing in the configure script, I am not posting a patch.

That said, changed MYSQLCLIENT_INCLUDE to "/usr" (dropped the -I is critical)
and replaced every instance of MYSQLCLIENT_DIR between 5867 and 6009 with

Now all tests pass.

[disclaimer on file, if it matters in this case]

By: John Martin (jfp_martin) 2006-07-08 04:22:26

Hi Dea,
 what OS are you using? And how is MySQL installed (from distro or source)?

On my CentOS the patch I posted worked as long as you do:

./configure --with-mysqlclient=/usr

Hi Russel,
 I tried the ./configure --with-mysqlclient=/usr/lib/mysql about 5 minutes after you posted the patch. The problem with that configure (as DEA found out) is that it finds the lib ok but then uses $DIR/include/mysql to find the mysql.h (where it would have to be looking in $DIR/../../include/mysql - which it too convoluted).

With my patch the search starts in the dir you give and looks in $DIR/lib/mysql for the lib and $DIR/include/mysql for the .h which works for my with only one line changed from what's currently in trunk.


By: Russell Bryant (russell) 2006-07-08 10:50:50

Alright, I understand.  Since those locations are common, I'll see if I can come up with a better test in configure that will find them without any extra options.  It will probably be sometime later this week when I can work on it.

It is really annoying that the library would be put in a location that is not in the default search path of the linker.  Oh well :)

By: gnudialer gnudialer (gnudialer) 2006-07-12 12:07:44

How about $(shell mysql_config --libs) ?



By: Russell Bryant (russell) 2006-07-12 14:54:52

Yes, that certainly looks like the right way to do it.  :)

The old Makefile was not using that method to get that information so I didn't know about it.  oops ...

By: Russell Bryant (russell) 2006-07-12 15:52:23

A check using mysql_config has been implemented and committed.  Please test and let me know if it files everything successfully.

By: dea (dea) 2006-07-12 18:31:01

Looks good.  Oddly mysql_config --libs points to /usr/local/mysql/lib
while previous builds used /usr/lib/mysql and /usr/include/mysql

It looks like a fellow engineer may have upgraded MySQL on this system using
the source instead of package files.  In any case the new detection code finds
valid libraries and the resulting code works.

By: Russell Bryant (russell) 2006-07-12 20:21:24

Alright.  I am going to consider this fixed, then.  Please open a new issue if there are any further issues.