

How to Build Percona Server for MySQL From Sources
source link: https://www.percona.com/blog/2021/03/10/how-to-build-percona-server-for-mysql-from-sources/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Lately, the number of questions about how to build Percona software has been 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.
First of all, let’s talk about the stages of compiling software.
I would say that at the beginning you need to prepare the build environment, install all the 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).
The next stage is to get the source code of Percona Server for MySQL. You can do it in different ways:
- 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 latest 8.0.22 version).
- Download tarball from GitHub
Here is the link: https://github.com/percona/percona-server/releases/tag/Percona-Server-8.0.22-13
Once you have prepared the build environment, you need to decide what result you should get: binary tarball, rpm, or deb package.
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 builder script that is used for making builds. It can be found in the Percona Server GitHub repo and can be used by anyone to make his own builds.
Have open source expertise to share? Submit your talk for Percona Live ONLINE!
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 you use it?
The script has various params:
So let’s see how we can make the build process easier:
1. Download 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.
Recommend
-
68
This article is inspired by Percona blog post comparing MySQL 8.0 and Percona Server 5.7 on IO-bound workload with Intel Optane...
-
5
MySQL 5.6 and Percona Server for MySQL 5.6 are End of Life Back to the Blog
-
11
Online DDL with Group Replication In Percona Server for MySQL 8.0.22 (and MySQL 8.0.23) Back to the Blog
-
9
was released last week and I wanted to take a minute to call out some of the interesting new features that we have introduced in this release. These are included in addition to the features and improvements in MySQL 8.0.23 that were introduc...
-
5
Skipping Percona Server for MySQL Version 8.0.24 and Releasing 8.0.25 Next Back to the Blog Afte...
-
4
Back to the Blog This quickstart shows you...
-
7
Percona Server for MySQL is a drop-in replacement for MySQL More enterprises rely on MySQL® performance, resilience and security to power the applications and websites that make achieving their...
-
34
Installing Percona Server for MySQL on Rocky Linux 8 Back to the Blog
-
7
How to Build Percona XtraDB Cluster From Sources Back to the Blog
-
2
Raspberry on the Rocks: Build Percona Server for MySQL With MyRocks on Your Raspberry Pi Back to the Blog
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK