Building MySQL Workbench from sources on Ubuntu/Debian

To build MySQL Workbench one would need to install dependencies, fetch source code, configure it and actually do a build. Here’s how to do it on a Ubuntu/Debian system

 

1) Get source code

Open the browser and go to http://www.mysql.com/downloads/workbench/

When in that page, select “Source Code” from the select box. Usually the TAR file will do the job, so download the “Generic Linux” option and uncompress it:

$> tar xf mysql-workbench-community-<version>-src.tar.gz

 

2) Install dependencies necessary to build

We’ll need to remove iodbc, if it’s installed

$> sudo apt-get remove iodbc

 

Now, we can install the full set of dependencies needed to build Workbench

$> sudo apt-get install build-essential cmake cmake-data autoconf automake pkg-config libtool libzip-dev libxml2-dev libsigc++-2.0-dev libglade2-dev libgtkmm-2.4-dev libglu1-mesa-dev libgl1-mesa-glx mesa-common-dev libmysqlclient-dev libmysqlcppconn-dev uuid-dev libpixman-1-dev libpcre3-dev libgnome2-dev libgnome-keyring-dev libgtk2.0-dev libpango1.0-dev libcairo2-dev python-dev libboost-dev libctemplate-dev mysql-client python-pysqlite2 libsqlite3-dev libtinyxml-dev swig libvsqlitepp-dev libgdal-dev libproj0

 

3) Prepare to build

Go to the directory where you uncompressed the TAR file

$> cd mysql-workbench-community-<version>-src

Now, create the directory where the build files will reside and go there

$> mkdir wb-build

$> cd wb-build

 

4) Build and install

Build and install Workbench, and optionally set the install prefix (defaults to /usr/local)

$> cmake [-DCMAKE_INSTALL_PREFIX=/usr] ..
$> make
$> sudo make install

If you don’t want to install it on the system directories or don’t have permissions to do so, try to install on the current directory. Be aware that the Workbench launch script must be updated to the proper directories

$> make install DESTDIR=.

 

Notes:

  • You will need swig 1.3 to build WB
  • Antlr 3.4 is needed, but the current release has many bugs. You will need it patched with https://github.com/antlr/antlr3/pull/43 if you don’t want to use the bundled version. Then you’ll need to

          export ANTLR_JAR_PATH=<path_to_antlr_complete_file>

  • Instead of iodbc you can use unixodbc, to do that you need to install unixodbc and add -DUSE_UNIXODBC=True to cmake
  • Ubuntu Packages require unixodbc, so if you’re using it, there won’t be any problem. If you want to use iodbc, you’ll need to build it from source.
  • On a Core2 Quad 2.4 GHz and a 4G of RAM it takes about 30-40 minutes to build Workbench. Also it uses about 5G of hard drive space to build and install.

21 thoughts on “Building MySQL Workbench from sources on Ubuntu/Debian”

  1. Thanks for this!

    When I try running:
    sudo apt-get install build-essential autoconf automake libtool libzip-dev libxml2-dev libsigc++-2.0-dev libglade2-dev libgtkmm-2.4-dev libglu1-mesa-dev libmysqlclient15-dev uuid-dev liblua5.1-dev libglitz-dev libglitz-glx-dev libpcre3-dev g++ libglade2-dev libgnome2-dev python-pexpect libboost-dev libsqlite3-dev python-dev libgnome-keyring-dev libctemplate-dev

    I get the following message:
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Note, selecting ‘libmysqlclient-dev’ instead of ‘libmysqlclient15-dev’
    Note, selecting ‘liblua5.1-0-dev’ instead of ‘liblua5.1-dev’
    E: Unable to locate package libglitz-dev
    E: Unable to locate package libglitz-glx-dev

    If I then try to run ./autogen.sh –prefix=/usr/local I get:
    **Error**: You must have `autoconf’ installed.
    Download the appropriate package for your distribution,
    or get the source tarball at ftp://ftp.gnu.org/pub/gnu/
    ./autogen.sh: 31: autoheader: not found

    **Error**: You must have `libtool’ installed.
    You can get it from: ftp://ftp.gnu.org/pub/gnu/

    **Error**: You must have `automake’ installed.
    You can get it from: ftp://ftp.gnu.org/pub/gnu/

    Any idea about what I’m doing wrong? Thanks!

  2. Works great, thank you.

    For anyone trying this on Ubuntu 11.10, the dependencies are slightly different than what is in the post. Here’s what worked for me:

    sudo apt-get install build-essential autoconf automake libtool libzip-dev libxml2-dev libsigc++-2.0-dev libglade2-dev libgtkmm-2.4-dev libglu1-mesa-dev libmysqlclient-dev uuid-dev liblua5.1-0-dev libpcre3-dev g++ libglade2-dev libgnome2-dev python-pexpect libboost-dev libsqlite3-dev python-dev libgnome-keyring-dev libctemplate-dev

    Other than that, build was done in just over 7 minutes on my AMD hexacore.

  3. Ubuntu Oneric haven’t libglitz-dev, libglitz-glx-dev in repositories!
    However Workbench builds fine.
    Splash screen do not freeze aplication, BUT SQL-editor doesn’t opens!
    ER-Models opens, but don’t display!
    Works only administration.
    Workbench totaly useless in Oneric now

  4. Thank you for these instructions, they work perfectly on Ubuntu 11.10 (after applying that patch you provided).

    I (or rather apt-get) couldn’t find libglitz-dev and libglitz-glx-dev, but it worked anyway without these two libs.

  5. Pingback: 100 Days - Day 37
  6. When I attempting step 1 (install deps), I get the following error message:

    E: Unable to locate package libglitz-dev
    E: Unable to locate package libglitz-glx-dev

    Where are Ubuntu 11.10 compatible versions of these packages?

  7. Links to the patch are on this blog at the bottom:

    http://100days.demonpenguin.co.uk/

    PS-I tried doing this and without a step by step I keep getting messages that block me from doing the whole process of making a deb to install. I’ll wait until it’s really fixed and a version for 11.10 is a real downloadable deb. Wasted enough time on this already.

  8. Hi,
    I try to install on Oneiric version of Ubuntu but it failed and finished with :

    In file included from mdc_canvas_view.h:31:0,
    from mdc_area_group.cpp:28:
    /usr/include/glib-2.0/glib/gthread.h:28:2: error: #error “Only can be included directly.”
    make[4]: *** [mdc_area_group.lo] Erreur 1
    make[4]: quittant le répertoire « /opt/mysql-workbench-gpl-5.2.35-src/library/canvas/src »
    make[3]: *** [all-recursive] Erreur 1
    make[3]: quittant le répertoire « /opt/mysql-workbench-gpl-5.2.35-src/library/canvas »
    make[2]: *** [all-recursive] Erreur 1
    make[2]: quittant le répertoire « /opt/mysql-workbench-gpl-5.2.35-src/library »
    make[1]: *** [all-recursive] Erreur 1
    make[1]: quittant le répertoire « /opt/mysql-workbench-gpl-5.2.35-src »
    make: *** [all] Erreur 2

    Could the problem come frome gtk or glib?
    Any ideas?

  9. Hi, what do you mean by “get in the source directory”… Can u show us more details? like : (Home->Documents->blablabla…)

    thx…
    i appreciate ur answer…

  10. configure: error: Required library libiodbc is missing. Use –with-unixodbc if you want to use unixODBC instead

    what should I do
    (debian 6, gnome desktop)

  11. Hi,

    I have a problem when I try to start mysql-workbench by command line:

    bruno@notebookBruno:~$ mysql-workbench-bin
    Initializing AdvancedSidebar factory method
    Initializing mforms factory
    Crating WBOptions
    Segmentation fault

    What should I do?

  12. Hi I would like to know if you plan to create new instructions for linux, this seems to be outdated, and I would like to compile for ubuntu 15.10

Leave a Reply

Your email address will not be published. Required fields are marked *