Building MariaDB starting from 5.5
Compiling MariaDB with full debug information includes all code symbols and also new code to do internal testing of structures and allow one to trace MariaDB execution. A full debug binary will be notable slower than a normal binary (30%).
On Unixes you need to pass
-DCMAKE_BUILD_TYPE=Debug to cmake to compile with debug information.
The other option is to use the scripts in the BUILD directory that will compile MariaDB with most common debug options and plugins:
There are separate build scripts for different configurations in the BUILD directory.
Example of building MariaDB with build scripts
Here is an example of how to compile MariaDB for debugging in your home directory with MariaDB 5.2.9 as an example:
cd ~ mkdir mariadb cd mariadb tar xvf mariadb-5.2.9.tar.gz ln -s mariadb-5.2.9 current cd current ./BUILD/compile-pentium64-debug-max
The last command will produce a debug version of
If you have a system other than 64 bit Intel/AMD on Linux you can use a
BUILD/...-debug-max file. If this fails, you can
./BUILD/autorun.sh ./configure --with-debug=full -with-extra-charsets=complex \ --with-plugin-aria --with-aria-tmp-tables --without-plugin-innodb_plugin \ --with-plugins=max \ --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static make
Building with debug symbols
To build MariaDB with symbols, to get better stack traces and to be able to debug the binary with
gdb, you need to supply the
-g3 option to the
Just compiling with
-g3 will make the binary much bigger but the slowdown of the server should be negligible.
One way to do this is to edit the script
and add the -g3 last on the line with
extra_flags, like this:
extra_flags="$pentium64_cflags $fast_cflags -g3"
After that you can compile MariaDB with debugging symbols by just execution the above script.