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!)