Re: Error compiling MySQL support on RedHat 9 - SOLVED!

James Coleman <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
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
> conftest  -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!)
> 
>
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.