[GRASS5] MySQL and PostgreSQL DBMI drivers for GRASS 5.1

Hi,

written and uploaded at the CVS are two new DBMI drivers,
one for PostgreSQL and one for MySQL. To compile them one needs grass51
and 'libpq' or 'libmysqlclient', respectively.

The code is at grass51/db/drivers catalog.

Alex Shevlakov,

Free Software Consulting 'Motivation',
Moscow, Russia.
----------------

http://motivation.ru

t. +7(902)1739952
f. +7(095)7773992

On Fri, Nov 22, 2002 at 02:06:41PM +0300, Alex Shevlakov wrote:

Hi,

written and uploaded at the CVS are two new DBMI drivers,
one for PostgreSQL and one for MySQL. To compile them one needs grass51
and 'libpq' or 'libmysqlclient', respectively.

The code is at grass51/db/drivers catalog.

Thanks, Alex!

Glynn, may I ask you to add a test to 'configure[.in]' for the mysql
libs and include directories?

Thanks,

Markus

Markus Neteler wrote:

> written and uploaded at the CVS are two new DBMI drivers,
> one for PostgreSQL and one for MySQL. To compile them one needs grass51
> and 'libpq' or 'libmysqlclient', respectively.
>
> The code is at grass51/db/drivers catalog.

Glynn, may I ask you to add a test to 'configure[.in]' for the mysql
libs and include directories?

What should it be testing for?

What is the header called, what is the library called, which other
libraries (or sets of libraries) might be required, and which function
should configure expect to find in that library?

--
Glynn Clements <glynn.clements@virgin.net>

On Sat, Nov 23, 2002 at 11:33:24AM +0000, Glynn Clements wrote:

Markus Neteler wrote:

> > written and uploaded at the CVS are two new DBMI drivers,
> > one for PostgreSQL and one for MySQL. To compile them one needs grass51
> > and 'libpq' or 'libmysqlclient', respectively.
> >
> > The code is at grass51/db/drivers catalog.
>
> Glynn, may I ask you to add a test to 'configure[.in]' for the mysql
> libs and include directories?

What should it be testing for?

What is the header called, what is the library called, which other
libraries (or sets of libraries) might be required, and which function
should configure expect to find in that library?

According to
grass51/db/drivers/mysql/Makefile
and
grass51/db/drivers/mysql/globals.h

it needs
-L/usr/local/lib/mysql
-lmysqlclient

and
#include <mysql/mysql.h>

Markus

Markus Neteler wrote:

> > > written and uploaded at the CVS are two new DBMI drivers,
> > > one for PostgreSQL and one for MySQL. To compile them one needs grass51
> > > and 'libpq' or 'libmysqlclient', respectively.
> > >
> > > The code is at grass51/db/drivers catalog.
> >
> > Glynn, may I ask you to add a test to 'configure[.in]' for the mysql
> > libs and include directories?
>
> What should it be testing for?
>
> What is the header called, what is the library called, which other
> libraries (or sets of libraries) might be required, and which function
> should configure expect to find in that library?

According to
grass51/db/drivers/mysql/Makefile
and
grass51/db/drivers/mysql/globals.h

it needs
-L/usr/local/lib/mysql
-lmysqlclient

and
#include <mysql/mysql.h>

That's 2 out of 4; I still need to know a symbol which will be present
in libmysqlclient, and which libraries libmysqlclient might depend
upon.

I'll take a guess at mysql_query() being defined in libmysqlclient (it
is referenced in db/drivers/mysql, but doesn't appear to be defined
anywhere), and I'll assume that no other libraries need to be
specified.

--
Glynn Clements <glynn.clements@virgin.net>

On Sat, Nov 23, 2002 at 06:09:20PM +0000, Glynn Clements wrote:

Markus Neteler wrote:

> > > > written and uploaded at the CVS are two new DBMI drivers,
> > > > one for PostgreSQL and one for MySQL. To compile them one needs grass51
> > > > and 'libpq' or 'libmysqlclient', respectively.
> > > >
> > > > The code is at grass51/db/drivers catalog.
> > >
> > > Glynn, may I ask you to add a test to 'configure[.in]' for the mysql
> > > libs and include directories?
> >
> > What should it be testing for?
> >
> > What is the header called, what is the library called, which other
> > libraries (or sets of libraries) might be required, and which function
> > should configure expect to find in that library?
>
> According to
> grass51/db/drivers/mysql/Makefile
> and
> grass51/db/drivers/mysql/globals.h
>
> it needs
> -L/usr/local/lib/mysql
> -lmysqlclient
>
> and
> #include <mysql/mysql.h>

That's 2 out of 4; I still need to know a symbol which will be present
in libmysqlclient, and which libraries libmysqlclient might depend
upon.

I'll take a guess at mysql_query() being defined in libmysqlclient (it
is referenced in db/drivers/mysql, but doesn't appear to be defined
anywhere), and I'll assume that no other libraries need to be
specified.

Probably Alex can help. I just tried it:

checking for mysql_query in -lmysqlclient... no
configure: error: *** Unable to locate MySQL library.

thuille:grass51[273.17] locate libmysqlclient
/usr/lib/mysql/libmysqlclient.so.10
/usr/lib/mysql/libmysqlclient.so.10.0.0
/usr/lib/mysql/libmysqlclient.a
/usr/lib/mysql/libmysqlclient.so
/usr/lib/mysql/libmysqlclient.so.9
/usr/lib/mysql/libmysqlclient.so.9.0.0

thuille:grass51[274.18] nm /usr/lib/mysql/libmysqlclient.so | grep
mysql_query
0000a210 T mysql_query

cat config.log
[...]
configure:9326: checking whether to use MySQL
configure:9346: checking for location of MySQL includes
configure:9372: checking for mysql/mysql.h
configure:9380: gcc -E conftest.c >/dev/null 2>conftest.out
configure:9418: checking for location of MySQL library
configure:9443: checking for mysql_query in -lmysqlclient
configure:9460: gcc -o conftest -g -O2 conftest.c -lmysqlclient 1>&5
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
configure: failed program was:
#line 9449 "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_query();

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

Probably the library is not found?

Markus

Markus Neteler wrote:

> I'll take a guess at mysql_query() being defined in libmysqlclient (it
> is referenced in db/drivers/mysql, but doesn't appear to be defined
> anywhere), and I'll assume that no other libraries need to be
> specified.

Probably Alex can help. I just tried it:

checking for mysql_query in -lmysqlclient... no
configure: error: *** Unable to locate MySQL library.

thuille:grass51[273.17] locate libmysqlclient
/usr/lib/mysql/libmysqlclient.so.10
/usr/lib/mysql/libmysqlclient.so.10.0.0
/usr/lib/mysql/libmysqlclient.a
/usr/lib/mysql/libmysqlclient.so
/usr/lib/mysql/libmysqlclient.so.9
/usr/lib/mysql/libmysqlclient.so.9.0.0

Then you will need --with-mysql-libs=/usr/lib/mysql

thuille:grass51[274.18] nm /usr/lib/mysql/libmysqlclient.so | grep
mysql_query
0000a210 T mysql_query

OK, so that's probably the right symbol to be checking for.

--
Glynn Clements <glynn.clements@virgin.net>

On Sat, Nov 23, 2002 at 11:07:58PM +0000, Glynn Clements wrote:
[...]

> thuille:grass51[273.17] locate libmysqlclient
> /usr/lib/mysql/libmysqlclient.so.10
> /usr/lib/mysql/libmysqlclient.so.10.0.0
> /usr/lib/mysql/libmysqlclient.a
> /usr/lib/mysql/libmysqlclient.so
> /usr/lib/mysql/libmysqlclient.so.9
> /usr/lib/mysql/libmysqlclient.so.9.0.0

Then you will need --with-mysql-libs=/usr/lib/mysql

great, this did the trick.

> thuille:grass51[274.18] nm /usr/lib/mysql/libmysqlclient.so | grep
> mysql_query
> 0000a210 T mysql_query

OK, so that's probably the right symbol to be checking for.

Yep. Now the driver get's compiled, if present.
Thanks to Alex and Glynn,

Markus