Re: Problem compiling with MySql support

James Coleman <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi Alejandro, Stipe,

I think I see the same thing as Alejandro?
kannel 1.3.2 and cvs head with mysql, redhat 9.1.

>From Alejandro's original msg:

>Configuring DB support ...
>checking whether to compile with MySQL support... searching
>checking for mysql_config... /usr/bin/mysql_config
>checking mysql version... 3.23.58
>checking mysql
>libs...  -L'/usr/lib/mysql' -lmysqlclient -lz -lcrypt -lnsl -lm
>checking for mysql_init in -lmysqlclient... no
>configure: error: Unable to find MySQL client libraries

And me:

[jamesc@betty] ~/src/kannel/gateway-cvshead/$ ./configure --disable-ssl --with-mysql --with-mysql-dlr=/usr
creating cache ./config.cache
checking cvs checkout date... 20040826
.....

Configuring DB support ...
checking whether to compile with MySQL support... searching
checking for mysql_config... /usr/bin/mysql_config
checking mysql version... 3.23.58
checking mysql libs...  -L'/usr/lib/mysql' -lmysqlclient -lz -lcrypt -lnsl -lm 
checking for mysql_init in -lmysqlclient... no
configure: error: Unable to find MySQL client libraries

[jamesc@betty] ~/src/kannel/gateway-cvshead/$ tail -n 20 config.log
configure:4500: checking for mysql_init in -lmysqlclient
configure:4519: gcc -o conftest  -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -I/usr/include/libxml2   -rdynamic conftest.c -lmysqlclient  -L'/usr/lib/mysql' -lmysqlclient -lz -lcrypt -lnsl -lm  -lresolv -lnsl -lm  -lpthread -L/usr/lib -lxml2 -lz -lm 1>&5
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
configure: failed program was:
#line 4508 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char mysql_init();

int main() {
mysql_init()
; return 0; }

[jamesc@betty] ~/src/kannel/gateway-cvshead/$ ls /usr/lib/mysql
libdbug.a         libmysqlclient_r.a          libmysqlclient.so.10.0.0
libheap.a         libmysqlclient_r.so         libmystrings.a
libmerge.a        libmysqlclient_r.so.10      libmysys.a
libmyisam.a       libmysqlclient_r.so.10.0.0  libnisam.a
libmyisammrg.a    libmysqlclient.so
libmysqlclient.a  libmysqlclient.so.10

[jamesc@betty] ~/src/kannel/gateway-1.3.2rc1/$ ls /usr/include/mysql/
dbug.h      my_config.h  my_no_pthread.h  mysql.h          sslopt-case.h
errmsg.h    my_global.h  my_pthread.h     mysql_version.h  sslopt-longopts.h
m_ctype.h   my_list.h    mysql_com.h      my_sys.h         sslopt-usage.h
m_string.h  my_net.h     mysqld_error.h   raid.h           sslopt-vars.h


The configure options for mysql in 1.2.1 were different ....

[jamesc@betty] ~/src/kannel/gateway-1.2.1/$ 
./configure --disable-ssl --with-mysql=/usr --enable-mysql --with-dlr=mysql

Configuring DB support ...
checking whether to compile with MySQL support... searching in /usr
checking for /usr/include/mysql/mysql.h... yes
checking for mysql/mysql.h... yes
checking for mysql/mysql_com.h... yes
checking for mysql/mysql_version.h... yes
checking for mysql_init in -lmysqlclient... yes
checking whether to compile with MySQL support... yes
checking whether to compile with LibSDB support... disabled

I just did that now and build so mysql definately alright.



I argued a bit with the configure script and looked inside it.
I do think there is an error there ... but well my poor little head is getting confused!
Where kannel configure is testing mysql and figuring out stuff
 it does some tests on gcc and ... well it is a bit convoluted/complicated
 right there and I'm struggling.
But anyway in the configure gcc test for musql_init ... something slightly
 weird happens.




On the commandline with that c prog and confdefs.h the following line is good:

gcc -o conftest  -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -I/usr/include/libxml2   -rdynamic conftest.c -lmysqlclient  -L'/usr/lib/mysql' -lmysqlclient -lz -lcrypt -lnsl -lm  -lresolv -lnsl -lm  -lpthread -L/usr/lib -lxml2 -lz -lm 

doesn't report "/usr/bin/ld: cannot find -lmysqlclient"

BUT that is what seems to happen when that gcc line is called from the configure script.

SO ... ??? could it be the  -L'/usr/lib/mysql'  those single quotes?
I've looked but nasty to find exactly where that is set in $LIBS

If I do a HUGE cheat and after the test force it to be a success then
kannel build is good. (last two lines of snippet here:)


        echo $ac_n "checking for mysql_init in -lmysqlclient""... $ac_c" 1>&6
echo "configure:4500: checking for mysql_init in -lmysqlclient" >&5
ac_lib_var=`echo mysqlclient'_'mysql_init | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  ac_save_LIBS="$LIBS"
LIBS="-lmysqlclient  $MYSQL_LIBS  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4508 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char mysql_init();

int main() {
mysql_init()
; return 0; }
EOF
if { (eval echo configure:4519: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"

fi

echo james cheat Force this test to pass. YEAST EYS YES YES!
eval "ac_cv_lib_$ac_lib_var=yes"


Make sure to:
 rm config.cache
  after editing configure file.



For now I give up on trying to figure out why the gcc line works on commandline and not 
in configure script. :(


James.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.