Appendix B. Installing From Source

Table of Contents

B.1. Introduction
B.2. Downloading The Source Code
B.3. Building from Source under Windows
B.3.1. Prerequisites
B.3.2. Compiling and Building
B.4. Building from Source under Linux
B.4.1. Prerequisites
B.5. Compiling and Building
B.5.1. Building Static Binaries
B.5.2. Building RPMs

B.1. Introduction

Normally, you will want to install the MySQL GUI tools from binaries. We put a lot of effort into making sure that our binaries are built with the best possible options. If, for whatever reason, you wish to compile the tools yourself, follow these instructions.

B.2. Downloading The Source Code

The source code for the MySQL GUI tools is available from our public Subversion trees at http://dev.mysql.com/tech-resources/sources.html.

You will need the mysql-gui-common tree regardless of which GUI tools you intend to build. The mysql-gui-common tree contains source and graphics files used for all MySQL GUI tools.

To be able to access these trees, you must have Subversion installed. Subversion is freely available from http://subversion.tigris.org/.

B.3. Building from Source under Windows

Installing from source under Windows requires multiple commercial compilers and because of this it is preferable to install from binaries. If you meet the prerequisites needed you can build the MySQL GUI tools from source under Windows.

B.3.1. Prerequisites

To compile the MySQL GUI tools from source under Windows, you need Borland Delphi 7, Microsoft Visual Studio.NET 2003, and some libraries which are available on the internet as open source software. Make sure the programs DCC32.exe and DEVENV.exe /? can be launched from the command line.

You will need the following libraries to build from source:

  • glib-2.0

  • libxml-2

  • mysql client libraries (4.0 or newer, 5.0 prefered)

  • pcre-1.4

  • MS Visual C runtime libraries 7.1

  • Java include files 1.4.2_04

  • Lua 5.0.2

B.3.2. Compiling and Building

Make sure you have cloned the mysql-administrator, mysql-gui-common, and mysql-query-browser trees, and that their local directories are located in the same directory, for example in Personal Files\MySQLGUI\.

The source files and libraries should be placed into the following tree structure:

  Working Directory
  |
  |- mysql-administrator
  |- mysql-gui-common
  |- mysql-query-browser
  |- mysql-gui-win-res
     |
     |-include
     | |
     | |-glib-2.0
     | |-java
     | | |
     | | |-win32
     | |
     | |-libxml
     | |-lua
     | |-mysql
     | |-pcre
     | |-windows
     |
     |-lib
       |
       |-glib-2.0
       |-java
       |-libxml
       |-lua
       |-mysql
       |-pcre
       |-windows

B.3.2.1. Building from Command Line

To build from the command line open a windows command line prompt and change into the main repository of the tool (i.e. for MySQL Administrator this is work\mysql-administrator). There are three batch-files to start the build:

  • build_debug.cmd

  • build_release.cmd

  • build_commercial.cmd

Execute one of those to generate a runtime image of the application. It will be generated in a bin\windows directory.

Another method is to doubleclick on one of the build_buildtype.cmd files, where buildtype is one of debug, release, and commercial. The commercial build script is for users with commercial licenses, and makes use of the commercial version of the MySQL client library.

B.3.2.2. Building from the IDE

Before you can open any projects, you have to install these components. Otherwise some of the forms will not open and you will receive error messages.

To install the components, goto the mysql-gui-common\source\windows\ directory. Copy the following directories to your Delphi source directory (C:\Program Files\Borland\Delphi7\Source\).

  • png

  • SynEdit

  • TNT

  • UniCodeEditor

  • VirtualTreeview

Then doubleclick each *.dpk file outlined below. It will open Delphi. Press compile and install to install the components. Repeat this for each *.dpk file.

  • SynEdit\Packages\SynEdit_D7.dpk

  • TNT\Packages\TntUnicodeVcl_D70.dpk

  • VirtualTreeview\Packages\VirtualTreesD7D.dpk

  • UniCodeEditor\Packages\UniCodeEditorD7.dpk

These components have to be installed via the Install option of the Component menu. Click on the Browse button and select the files below. Press OK after each file.

  • png\PNGImage.pas

After installing the components you can open the projects as outlined below.

To build the application from the Delphi 7 IDE simply doubleclick the edit_xxxx.cmd. This will launch Delphi 7 and open the file. To generate the complete runtime image select Build All Projects option from the Project menu.

Like for building from command line there are three different files.

  • edit_debug.cmd

  • edit_release.cmd

  • edit_commercial.cmd

The runtime image will be generated in a bin\windows directory.

Opening the Delphi project not using the edit_*.cmd script will lead to incorrect project settings and problems while building the projects.

B.4. Building from Source under Linux

B.4.1. Prerequisites

The easiest way to install required packages is by using an automatic dependency resolving package manager, such as apt-get or yum. You can install these dependencies by hand, but it will be a very tedious process since some of them require other packages that require other packages and so on.

Common requirements are listed below. For some distributions the package name is also mentioned.

Table B.1. Required Components

SoftwareVersionUbuntu 6SuSE 10.x
gcc/g++4g++gcc-c++
autoconf, automake libtool   
x11-libs libx11-devxorg-x11-devel
glibc libc6-devxorg-xll-devel
libstdc++ libstdc++6-4.0-devlibstdc++devel
glib2.6+libglib2.0-devglib2-devel
gtk+2.6+libgtk2.0-devgtk2-devel
libglade22.5+libglade2-devlibglade2-devel
libsigc++2.0.xlibsigc++-2.0-devlibsigc++2-devel
glibmm-2.42.4libglibmm-2.4-devglibmm24-devel
gtkmm-2.42.4libgtkmm-2.4-devgtkmm24-devel
pcre4.x or newerlibpcre3-devpcre-devel
pkgconfig0.15+pkg-configpkgconfig
libxml22.6.xlibxml2-devlibxml2-devel
MySQL 5.0 or 5.1 client libs and headers libmysqlclient15-dev 

Additional requirements for building MySQL Query Browser are:

Table B.2. Requirements for MySQL Query Browser

SoftwareVersionUbuntu 6SuSE 10.x
libgtkhtml2.11 or 3.xlibgtkhtml2-dev 
libgnomeprint2.2libgnomeprint2.2-dev 

B.5. Compiling and Building

To build any of the tools, you need to have the source tree for mysql-gui-common and the tree for the desired app (i.e.: mysql-administrator, mysql-query-browser) in the same top-level directory.

First build mysql-gui-common:

  1. cd mysql-gui-common

  2. sh ./autogen.sh

  3. ./configure --prefix=/opt/mysql-administrator

  4. make

  5. make install

The --prefix option can have whatever value you want, normally one would specify /usr/local (the default) or /usr, but for making precompiled binaries, something in /opt might be more appropriate.

After you have successfully built mysql-gui-common, you can build the individual tools (in this example we will build mysql-administrator):

  1. cd mysql-administrator

  2. sh ./autogen.sh

  3. ./configure --prefix=/opt/mysql-administrator

  4. make

  5. make install

If everything went well, things should be properly built and installed.

B.5.1. Building Static Binaries

Building static binaries is non-trivial under Linux, due to the enormous number of library dependencies that come from GNOME and associated libraries. Additionally:

  • Many libraries do not come with their static (lib*.a) versions shipped, so we need to build them ourselves.

  • Some libraries can't be linked statically, such as glibc, because of libnss*.so.

  • Some libraries depend on data files and modules from the original package, esp. in case of gtk/gnome. Problems don't only appear when the user is missing these data files; things may not work because different distributions put files in different paths.

The current solution is to build a partially static binary, with the most common libraries left dynamically linked (glibc and gtk). gtkmm, gtksourceview, gtkhtml and dependencies (like gnome) are linked statically. The ideal solution would be to build custom binaries for each major/chosen distribution, but we don't have time/resources for that at the moment.

To build these binaries:

  1. Look at the source/linux/static_make script for all the files that should be removed/moved out of /usr/lib.

  2. Run the script.

That's needed to force the linker to look for the static version of each library and also to explicitly list the dependency libs that were otherwise linked to the dynamic libs.

B.5.2. Building RPMs

For building RPMs, a spec file is already supplied and will be made automatically after ./configure is ran. The spec file expects a source tarball with the following structure:

mysql-administrator/ mysql-administrator/mysql-gui-common/* »
mysql-administrator/mysql-administrator/*

The contents of each subdirectory is the entire source tree for each tool (Windows specific files and source metadata are optional, of course). You must make a tar.gz file and put it in /usr/src/redhat/SOURCES (or whatever is your rpm SOURCES directory).

Then, execute: rpmbuild -ba mysql-administrator.spec

That should build the srpm and rpm files for the tool.