[PATCH] RE: Error compiling MySQL support on RedHat 9 - SOLVED!

"Rene Kluwen" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
I came up for the same solution for the same problem. Great minds think
alike, they say.

Attached is a patch for configure.in to solve this problem.

Can somebody patch configure.in for me and run autoconf?
Unfortunately my autoconf gives me troubles (probably a RedHat thingy
again), so I would appreciate it if configure and configure.in will be
commited to CVS after that.

Rene Kluwen
Chimit

-----Original Message-----
From: [email protected] [mailto:[email protected]]On
Behalf Of Alejandro Guerrieri
Sent: dinsdag 31 augustus 2004 17:24
To: [email protected]
Subject: Re: Error compiling MySQL support on RedHat 9 - SOLVED!


Yep, I agree it would be good if it's fixed. The "sed" method I've
tried worked for me, it's just a little mod on one line of the script
and it shouldn't break anything in other platforms.

BTW, 1.3.2 and MySQL DLR are working like a charm on RH9.

Regards,


On Tue, 31 Aug 2004 10:14:12 +0100, James Coleman <[email protected]> wrote:
> Brilliant Alejandro! You and Stipe did all the work. Not me.
>
> mysql_config
> Usage: /usr/bin/mysql_config [OPTIONS]
> Options:
>        --cflags        [-I'/usr/include/mysql']
>        --libs
         [-L'/usr/lib/mysql' -lmysqlclient -lz -lcrypt -lnsl -lm]
>        --socket        [/var/lib/mysql/mysql.sock]
>        --port          [3306]
>        --version       [3.23.58]
>
> Hmmm. The configure for 1.2.1 works with this.
> I wonder does it use mysql_config ?
> yes. And lots of the code in configure looks the same ... but I boggle
> again. :(   Possibly in 1.2.1 the mysql_config check fails but
> a later check sets up mysql libs and vars correctly ... urngh.
>
> I went through the configure script for 1.2.1 to try see what was
happening
> and how it works there but it would take me more time that I don't have
now.
> I think it would be good to fix this in the configure as I
> guess it happens at least on all redhat systems.
>
> James.
>
> On Fri, Aug 27, 2004 at 02:23:39AM +0200, Alejandro Guerrieri wrote:
> > Hi list,
> >
> > I've finally managed to find the problem compiling MySQL support on
RedHat
> > 9.
> >
> > The error comes from the single quotes around the library path on
> > mysql_config output.
> >
> > James, you were right on the nail!:
> > >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
> >
> > :)
> >
> > It seems at least that version of mysql (RedHat RPMs: mysql-3.23.58-1.9
and
> > mysql-devel-3.23.58-1.9) output libraries that way...
> >
> > ]$ mysql_config
> > Usage: /usr/bin/mysql_config [OPTIONS]
> > Options:
> >         --cflags        [-I'/usr/include/mysql']
> >         --libs
> >          [-L'/usr/lib/mysql' -lmysqlclient -lz -lcrypt -lnsl -lm]
> >         --socket        [/var/lib/mysql/mysql.sock]
> >         --port          [3306]
> >         --version       [3.23.58]
> >
> > And more specifically:
> >
> > ]$ mysql_config --libs
> > -L'/usr/lib/mysql' -lmysqlclient -lz -lcrypt -lnsl -lm
> >
> > Probably a silly status bug on mysql_config output. Fortunately, a very
> > easy-to-solve one!
> >
> > Looking at configure.log, those buggers are there on -L'/usr/lib/mysql'
> >
> > configure:4459: checking for mysql_init in -lmysqlclient
> > configure:4478: gcc -o
> >
nftest  -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -I/usr/include/libxml2   -rdynam
> > ic
> >
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
> >
> > The funny part is, if you run that line on the terminal, the shell
mangles
> > things somehow and it works, but from the sh script it causes trouble.
> >
> > So, what I did was to modify the configure script on line 4453:
> >
> > Before:
> >         MYSQL_LIBS="$($MYSQL_CONFIG --libs)"
> >
> > After:
> >         MYSQL_LIBS="$($MYSQL_CONFIG --libs | sed 's/\x27//g')"
> >
> > Very simple: I've run the output for mysql_config through "sed" and
removed
> > hex character 27 (the single quote character) globally.
> >
> > After that, it compiled like a charm!
> >
> > I also did the mod on configure.in and tried to run autoconf, but it
> > complained about libobjs:
> >
> > ]$ autoconf
> > configure.in:135: error: do not use LIBOBJS directly, use AC_LIBOBJ (see
> > section `AC_LIBOBJ vs LIBOBJS'
> >       If this token and others are legitimate, please use
m4_pattern_allow.
> >       See the Autoconf documentation.
> >
> > So I left the excercise for you autoconf gurus ;)
> >
> > Anyway, the change to make on configure.in is on line 798:
> >
> > Before:
> >         MYSQL_LIBS="$($MYSQL_CONFIG --libs)"
> >
> > After:
> >         MYSQL_LIBS="$($MYSQL_CONFIG --libs | sed 's/\x27//g')"
> >
> > (Sorry, I'm too lazy to make a diff just for this small mod ;)  )
> >
> > The mod could be applied harmlessly to any installation. If the single
> > quotes are missing (as they should be!) sed won´t change anything and it
> > will compile as always, so I suggest this (or at least an equivalent
mod)
> > could be applied to CVS to allow to us RedHat 9 Kannellers to compile
MySQL
> > support. Moreover, sed is used many times on the configure script, so it
> > won´t add any new dependencies.
> >
> > Hope it helps someone!
> >
> > Best regards and thank you all people who helped me to find the solution
> > (Stipe and James specially!)
> >
> >
>
>
mysqlclientfix.txt (text/plain, 492 B)
--- configure.in        28 Aug 2004 13:29:10 -0000      1.145
+++ configure.in        4 Oct 2004 11:36:08 -0000
@@ -873,7 +873,7 @@
             [ MYSQL_LIBS="" ], [ $MYSQL_LIBS ])
     fi
     if test -z "$MYSQL_LIBS" ; then
-        MYSQL_LIBS="$($MYSQL_CONFIG --libs)"
+        MYSQL_LIBS=`$MYSQL_CONFIG --libs | sed -e "s/\x27//g"`
         AC_MSG_CHECKING([mysql libs])
         AC_MSG_RESULT([ $MYSQL_LIBS ])
         AC_CHECK_LIB(mysqlclient, mysql_init, [ LIBS="$LIBS $MYSQL_LIBS" ],
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.