Monday, January 22, 2007

Compiling MySQL From Source on Linux: Check your Tools

I hear a lot of people say: "Well, compiling MySQL from source might pose a problem to Windows users, but it's straight forward for Linux users." Quite often, the difference is explained by claiming that Linux users are used to doing things themselves, and gaining an extra bit of customization by doing so.

My impression is that a large part of the people that say this, are already quite experienced Linux users that are quite comfortable with compiling software from source. The entire toolchain that is involved is already set up on their system, and some of them probably already forgot what they had to do in order for it to make it work.

What is quite often not mentioned is that the required toolchain does not magically land on your system. If you are experiencing prolems compiling MySQL source it's quite likely the toolchain is broken somewhere.

Those that want to compile MySQL from source on Linux: please take some time to read some of the excellent advise from Jay Pipes. Although rather inconspicously titled Making a Corresponding Test Case for your Patch, his HOWTO contains very important information to set up your building environment.

For those that can't wait:

...here are the things you should have installed to avoid headaches:

* automake version 1.9.6
* autoconf version 2.60
* bison version 2.3
* m4 version 1.4.4
* libtool version 1.5.22
...
Note that it is important what order you install these tools! libtool must be installed last to avoid linking with older versions of the other tools. If you don't, you get weird errors.

I'm running Kubuntu Edgy, and I could get packages for all of these things, except one, Bison. I had to compile that one from source too.

8 comments:

Anonymous said...

your link is bad. The correct link appears to be http://jpipes.com/index.php?/archives/128-HOWTO-Making-a-Corresponding-Test-Case-for-your-Patch.html

rpbouman said...

Thanks! It's fixed now.

Anonymous said...

can just help me wiyh where i can find the source for mysql for centos 5 and do i need to install this to support dovecot with mysql

rpbouman said...

Anonymous,

please download mysql source at dev.mysql.com, or use your disto's package manager. I don't know what dovecot is, but I wish you good luck supporting it.

Anonymous said...

After compiling fom source,iam getting foll error on starting mysql:
The program 'mysql' can be found in the following packages:
* mysql-client-core-5.1
* mysql-client-5.0
* mysql-cluster-client-5.1
Also,data directory inside /usr/local/mysql even though mysql_install_db script ran successfully

Any Ideas??

rpbouman said...

Hi Anonymous,

no, can't judge from here what might be wrong. It's been a while since I compiled but you may try to use several of the "prefix" configure options to control what paths will be used.

see: http://dev.mysql.com/doc/refman/5.1/en/configure-options.html

Anonymous said...

Thanks Roland for your reply,but i cannot even get it running from Binary distributions where there is no need of configure,make,etc...
Iam just unziping the files to /usr/local/mysql,changing ownership to mysql,and running mysql-install_db script.THis time 'data ' directory is created in /usr/local/mysql,but on starting mysql,i still get the above error..
really getting frustrated with Ubuntu now(it is now close to 2 weeks for a simple package installation)
i doubt whether it is LUcid issue as i installed it on Hardy before in the very 1st attempt,but may be iam wrong

rpbouman said...

Anonymous,

sorry to hear you're having these issues. I'm running ubuntu too, and I also run a mysql installed from the packages. For me it works without issue.

Sorry I can't be of more help.

DuckDB bag of tricks: Processing PGN chess games with DuckDB - Rolling up each game's lines into a single game row (6/6)

DuckDB bag of tricks is the banner I use on this blog to post my tips and tricks about DuckDB . This post is the sixth installment of a s...