Bug #12585 mysql-gui-common does not build against MySQL 4.0.x
Submitted: 15 Aug 2005 15:39 Modified: 19 Sep 2005 17:31
Reporter: Keith Richardson Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Administrator Severity:S3 (Non-critical)
Version:1.0.22a OS:Other (OpenBSD 3.7)
Assigned to: CPU Architecture:Any

[15 Aug 2005 15:39] Keith Richardson
Description:
mysql-gui-common has dependancies on 4.1.1 or better code which is contrary to build requirements (1).  

The file mysql-gui-common/library/source/myx_library.c (line 585) references two new mysql_options, MYSQL_OPT_USE_EMBEDDED_CONNECTION and MYSQL_OPT_USE_REMOTE_CONNECTION, that were added in 4.1.1.

This also happens when building gui-common that is distributed in the latest source release of query-browswer

I am building against 4.0.23p1 server and 4.0.23 client.

Here is the compiler error:

source='myx_library.c' object='myx_library.o' libtool=no \
depfile='.deps/myx_library.Po' tmpdepfile='.deps/myx_library.TPo' \
depmode=gcc3 /bin/sh ../../depcomp \
gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"mysql-gui-common\" -DVERSION=\"0.5.1\" -DGTKMM_VERSION=20000  -I. -I. -Wall -Wsign-compare -I../include -I../shared_include -I../public_interface/linux -I/usr/local/include/mysql -pipe -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/libxml2 -I/usr/local/include   -I/usr/local/include  -g -O2 -c `test -f 'myx_library.c' || echo './'`myx_library.c
In file included from ../include/myx_public_interface.h:25,
                 from ../include/myx_library.h:24,
                 from myx_library.c:25:
../include/myx_aux_functions.h:101: warning: redefinition of `ulong'
/usr/include/sys/types.h:58: warning: `ulong' previously declared here
myx_library.c: In function `myx_connect_to_instance':
myx_library.c:585: error: `MYSQL_OPT_USE_EMBEDDED_CONNECTION' undeclared (first use in this function)
myx_library.c:585: error: (Each undeclared identifier is reported only once
myx_library.c:585: error: for each function it appears in.)
myx_library.c:587: error: `MYSQL_OPT_USE_REMOTE_CONNECTION' undeclared (first use in this function)
gmake[2]: *** [myx_library.o] Error 1
gmake[2]: Leaving directory `/home/krichard/mysql/mysql-administrator-1.0.22a/mysql-gui-common/library/source'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/home/krichard/mysql/mysql-administrator-1.0.22a/mysql-gui-common/library'
gmake: *** [all-recursive] Error 1

Thanks,
Keith Alan Richardson

(1) http://dev.mysql.com/doc/administrator/en/mysql-gui-install-source-linux-prerequisites.htm...
(2) http://dev.mysql.com/doc/mysql/en/mysql-options.html

How to repeat:
download latest source releases of administrator or query-browser (1.0.22a and 1.1.12, respectively), unpack and build mysql-gui-common against 4.0.x.

I believe this may be for any system that builds from source but I have not tested any other OS)

Suggested fix:
Quick Fix:

if you're lucky enough (hint, hint) to have a binary distribution available for your OS, use that.  

If you are like me and required to build from source, you can install MySQL 4.1.1 or better and build against that (use configure --prefix=/usr/local/mysql-x.x.xx to avoid overwriting current 4.0.x installation.  See configure --help for more details)

Permanent:

Change requirements in administrator/query-browser to be MySQL 4.1.1

--or--

Remove the dependencies in the gui-common code on MySQL 4.1.1  It is only two lines although I haven't looked into alternatives in pre-4.1.1 code so this may not be a trivial task.

--or--

something else
[17 Aug 2005 19:00] Jorge del Conde
I was able to reproduce this bug when building under FC4 w/4.0.23 from bk
[19 Sep 2005 17:31] Alfredo Kojima
Hi

Thanks for the report. I have fixed the bug by placing the breaking code between #ifdefs  That code is only important for embedded MySQL uses, which isnt supported in MySQL 4.0 anyway.
[21 Sep 2005 1:03] Keith Richardson
I have successfully built mysql-admin against mysql server in 3.7 i386 packages.  The full steps will be submitted to openbsd users mailing list and http://www.openbsdsupport.org.  

I have not looked at what is in source code repository but the following worked for me:

$ diff -u ./mysql-gui-common/library/source/myx_library.c.dist ./mysql-gui-common/library/source/myx_library.c                                                                        
--- ./mysql-gui-common/library/source/myx_library.c.dist        Tue Sep 20 18:54:13 2005
+++ ./mysql-gui-common/library/source/myx_library.c     Tue Sep 20 18:54:45 2005
@@ -581,11 +581,14 @@
   //of mysql_real_connect are in utf8
   //mysql_options(mysql, MYSQL_SET_CHARSET_NAME, "utf8");
 
+#if defined(MYSQL_VESION_ID) && (MYSQL_VERSION_ID >= 40101) 
   if (myx_mysql_get_private(mysql)->embedded)
     mysql_options(mysql, MYSQL_OPT_USE_EMBEDDED_CONNECTION, (char *)1);
   else
     mysql_options(mysql, MYSQL_OPT_USE_REMOTE_CONNECTION, (char *)1);
 
+#endif
+
   if (!mysql_real_connect(mysql, user_conn->hostname, user_conn->username,
                           user_conn->password, user_conn->schema,
                           user_conn->port,