Build Percona XtraDB ClusterPercona XtraDB Cluster (PXC) is a database clustering solution for MySQL. It ensures high availability, prevents downtime and data loss, and provides linear scalability for a growing environment.

Lately, the number of questions about how to build Percona software has increased. More and more people try to add their own patches, add some modifications, and build software by themselves. But this raises the question of how to do this in the same way as Percona does, as sometimes the compiler flag can make a drastic impact on the final binary. This is a really essential question and let’s look at how we build Percona XtraDB Cluster here at Percona.

At the first glance, the building process is not something difficult. Everyone knows that magic make install all command and suppose that as a result everything will be built and installed on the system. But databases are very essential for applications and it is needed to do everything carefully.

Let’s divide the build process into the stages:

  1. Prepare build environments
  2. Prepare source tarballs
  3. Prepare source package
  4. Prepare binary packages

We can skip the third stage, but in this case, we wouldn’t be able to make repeatable builds so I would suggest always creating source packages.

So let’s move forward and discuss each step.

One of the key points during a build is that the environment should be clean and it is necessary to install all needed dependencies, and so on. For each version, the dependency list would be different. How do you get the correct dependency list? You can get all build requirements from the spec file (on rpm-based systems) or from the control file( on deb-based systems).

As for source tarball, you can easily do the following:

  • Get source tarball from the website

We publish source tarball for each release we issue, and you can easily get it for any released version (this is the link for the 8.0.28 version):

https://downloads.percona.com/downloads/Percona-XtraDB-Cluster-LATEST/Percona-XtraDB-Cluster-8.0.28/source/tarball/Percona-XtraDB-Cluster-8.0.28-19.tar.gz

  • Download tarball from GitHub

Here is the link:

https://github.com/percona/percona-xtradb-cluster/archive/refs/tags/Percona-XtraDB-Cluster-8.0.28-19.1.tar.gz

You can use build instructions from our website and proceed with the compilation process:

https://www.percona.com/doc/percona-xtradb-cluster/LATEST/install/compile.html#compile

So everything looks easy. But what is the way we use, internally, to prepare our release packages? As I mentioned earlier, each compiler option can make a significant effect.

Everyone tries to make life easier and automate all tasks. It is great, as automation is one of the keys to success as you can work on other tasks once the release build is in progress. So we have created a build script that is used for making builds. It can be found in the PXC GitHub repo and can be used by anyone to make his own builds.

This script can install all needed dependencies for the build environment, create binary tarballs, source RPMs and debs, RPMs, debs itself, and the binary tarball. So it covers all build cycles. So how do we use it?

The script has various params:

 

So let’s see how we can make the build process easier:

1. Download the build script:

2. Create a build directory where you are going to perform all build actions:

3. Install dependencies(please note root permissions are required):

4. Download source code:

– From Percona repo (it is used by default):

– From your own repo and branch:

5. Prepare src rpm:

Please note if you already have your source tarball, just create a directory named source_tarball in the build directory and put it into it.

6. Prepare source deb:

Please note if you already have your source tarball, just create a directory named source_tarball in the build directory and put it into it.

7. Prepare rpm:

8. Prepare deb:

9. Prepare tarball:

So as you can see, the build procedure becomes easier and you don’t need to think about what dependencies are needed, what cmake params should be used, etc. This build script will make everything for you and will use all build flags (if you didn’t change them in your sources) that we use for release builds.

Subscribe
Notify of
guest

3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Yves Trudeau

What if you cloned the repo, patched a few files and just want to build what you have?

R B

How to do make install instead of building rpm or deb packages?