Thursday 14 November 2013

working with the source-code

For my journey I use these sources:

MySQL: version 5.5.8
MariaDB: version 10.0.4

Things change, and in the case of these two products they change quite often (it's hard to stay in sync with the development-teams of these products). But I don't want to look at the recent progress so I will stay with these version for a while (the MySQL-source I used is a bit outdated, I know, but for my journey it is sufficient). Sometime in the future I will switch to a newer version, but in this case I will report this.

MySQL

This is the file with the sources I use: mysql-5.5.8.tar.gz
You will find it here:  http://downloads.mysql.com/archives.php?p=mysql-5.5&o=other
Please look for this entry on the page:




MariaDB

This is the file with the sources I use: mariadb-10.0.4.tar.gz
You will find it here:https://downloads.mariadb.org/mariadb/10.0.4/
This is the place on the page where you find the download-link:


download the 2 files (MySQL- and MariaDB-sources) to any place you can remember later.


how to use thes files

As you already may know I use Linux so I used nautilus (the file-manager of Ubuntu) and did the following steps:
  • created a directory MySQL-Src
  • copied the gz-file with the MySQL-sources into this directory
  • double-clicked on the gz-file in this directory
  • file-roller (the archive-manager of Ubuntu) opened
  • I extracted the files from the archive
 now I have a directory-structure like this:
$HOME/workspace/MySQL-Src/mysql-5.5.8
and in the last subdirectory I see all the directories and the files of MySQL.

And now for MariaDB: the steps are similar. as a result the structure of the duirectories look like:
$HOME/workspace/MariaDB/mariadb-10.0.4

As you can see the pathnames are not identically named: MySQL-Src and MariaDB. Please excuse the confusion.

On Microsoft Windows I used TotalCommander for the same purpose with similar steps.

installation

Here you will find a description on how to install the software from the source-files:

I needed some adjustments to make the software work on my machine and in the way I wanted it. On a console I did this step:

MariaDB
august@AMD4:~/workspace/MariaDB/mariadb-10.0.4$ cmake -DCMAKE_BUILD_TYPE=Debug  -DMYSQL_DATADIR=/home/august/MariaDB/data  -DCMAKE_INSTALL_PREFIX=/home/august/MariaDB/pgm

MySQL
august@AMD4:~/workspace/MySQL-Src/mysql-5.5.8$ cmake -DWITH_DEBUG=1  -DMYSQL_DATADIR=/home/august/MySQL/data  -DCMAKE_INSTALL_PREFIX=/home/august/MySQL/pgm

to check:
cmake  .  -LH

But I didn't want to work in a console, I prefer Eclipse. So I started Eclipse and created two new projects:
File -> Import -> Existing Code as MAKEFILE Project

Select the location of your project as described above.

In the project-explorer of Eclipse I marked one of these newly created projects and right-clicked on it. Select Properties and in the dialog look for Build, Now I can change the make-command to build the server and do the installation of the just created software:

As you can see it now executes a make install instead of the usual make all.

For starting the server via Eclipse I need to give it some additional information. So I opened the dialog for the Debug Configurations and added the directories for the data and programs as parameters:
and I also did this for the Run Configuration, for MySQL and MariaDB.

Sometime I encountered the message that the server couldn't start:


In this case I opened a console and entered these two lines:
sudo  mkdir  /var/run/mysqld
sudo  chmod  0777  /var/run/mysqld

And that's all. Now let the journey begin.