How to Compile XtraBackup

This page explains how to get and compile the source code for Percona XtraBackup.


The following packages and tools must be installed to compile Percona XtraBackup from source. These might vary from system to system.

  • gcc, the GNU Compiler Collection, version 4.1 or newer
  • patch
  • ncurses-devel
  • libtermcap-devel
  • bison

Getting the Source Code

The source code is available from the Launchpad project. The easiest way to get the code is with bzr branch of the desired release, such as the following:

bzr branch lp:percona-xtrabackup/release-4.0


bzr branch lp:percona-xtrabackup/trunk

You should then have a directory named after the release you branched, such as 'trunk'.

Compiling the Code

The xtrabackup binary depends on the libinnodb library, so first you need to build InnoDB, and then you can build xtrabackup. Perhaps the easiest way is to use the provided build script:

  • Change your working directory to the downloaded source code.
  • Execute utils/build.sh. You must pass it an option indicating which version of MySQL you want to compile against. The script's output will list the available options.
  • The script will download the appropriate source and compile against it.
  • Afterwards, use the 'find' command to locate the generated xtrabackup and tar4ibd binaries. Their locations depend on which option you give to build.sh.

If you want, there are also separate build scripts for building against MySQL 5.0 and MySQL 5.1 source tarballs. These are more of a manual process, and could take more steps. If you use this method, then the resulting xtrabackup binary will be in the xtrabackup-build/mysql-5.x.x/innobase/xtrabackup directory:

  • For MySQL 5.0:
    • Download a source .tar.gz package for MySQL 5.0.75 or 5.0.77. You can get older source versions from the MySQL download archives.
    • From the utils/ subdirectory of the XtraBackup source you got from Launchpad, execute the buildtree.sh script, passing the full path of the MySQL source .tar.gz package.
    • The final xtrabackup binary will work against any version of MySQL 5.0, not just 5.0.75/77.
  • For MySQL 5.1:
    • Download a source .tar.gz package for MySQL 5.1.50.
    • Follow similar steps as for MySQL 5.0, but note that the patch file is named fix_innodb_for_backup51.patch, and the InnoDB source code is in storage/innobase.
  • For MySQL 5.1 with the InnoDB Plugin 1.0.7:
    • Download a source .tar.gz package for MySQL 5.1.46.
    • Follow similar steps as for MySQL 5.0, but note that the patch file is named fix_innodb_for_backup_5.1_plugin_1.0.7.patch, and the InnoDB source code should be in storage/innodb_plugin.

If you don't want to use the build script, you can do it even more manually:

  • Extract the MySQL source tarball.
  • Move the xtrabackup source directory into the InnoDB source directory. In MySQL 5.0, this is the innobase/ directory; in MySQL 5.1 it is storage/innobase.
  • Apply fix_innodb_for_backup.patch or fix_innodb_for_backup51.patch. For MySQL 5.0.75 or 5.0.77, you should move the patch into the mysql-5.0.75 source code directory, and execute patch -p1 < fix_innodb_for_backup.patch. Follow a similar step for MySQL 5.1.
  • execute ./configure; make.
  • execute make in the innobase/xtrabackup source directory.
percona-xtrabackup/installation/from-source.txt · Last modified: 2015/08/05 15:37 (external edit)
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Contact Us 24 Hours A Day
SupportContact us 24×7
Emergency? Contact us for help now!
Sales North America(888) 316-9775 or
(208) 473-2904
+44-208-133-0309 (UK)
0-800-051-8984 (UK)
0-800-181-0665 (GER)
Training(855) 55TRAIN or
(925) 271-5054


Share This
]]> ]]>