Tuesday, August 15, 2023

Compiling all MySQL 5.7 versions on modern Ubuntu

This explains how I compiled all versions of MySQL 5.7 on Ubuntu 22.04 with gcc 11.4.0. It wasn't too bad but it would have been easier if some compiler warnings hadn't been ignored across multiple releases. Compiling old versions of Postgres is much easier.

First, install OpenSSL 1.0 and 1.1 as both will be needed and modern Ubuntu uses OpenSSL 3. Source is here. MySQL 5.7.29 and earlier releases use OpenSSL 1.0. MySQL 5.7.30 and later releases use OpenSSL 1.1.

./config --prefix=/path/to/ssl --openssldir=/path/to/ssl shared
make; make install


Second, hide the $SRC_ROOT/rapid directory. I moved it to rapid.hide. It has code that few of us use along with code that won't compile on modern gcc.


Get the patch files from here. These fix things that won't compile on modern gcc and most represent bug fixes.

  • The my5710.patch file patches 5.7.10 through 5.7.13
  • The my5714.patch file patches 5.7.14 through 5.7.18
  • The my5719.patch file patches 5.7.19 and 5.7.20
  • The my5721.patch file patches 5.7.21 through 5.7.33
  • Fortunately, no patches are needed for 5.7.33+
The CMake scripts are here for pre-5.7.30 and 5.7.30+. The only difference is that the former points to OpenSSL 1.0 and the later to OpenSSL 1.1.

Then I run this script, assuming the patch files are in $HOME.


for x in $( seq 10 13 ); do bash domkmy57.sh $x 5710 cmk.57.pre5730 ; done
for x in $( seq 14 18 ); do bash domkmy57.sh $x 5714 cmk.57.pre5730 ; done

for x in $( seq 19 20 ); do bash domkmy57.sh $x 5719 cmk.57.pre5730 ; done

for x in $( seq 21 29 ); do bash domkmy57.sh $x 5721 cmk.57.pre5730 ; done

for x in $( seq 30 33 ); do bash domkmy57.sh $x 5721 cmk.57.5730 ; done

for x in $( seq 34 43 ); do bash domkmy57.sh $x none cmk.57.5730 ; done

2 comments:

  1. Hope this is helpful for someone. I had some trouble building xbstream and ended up doing the following after downloading PXB source:

    apt install cmake libssl-dev libzstd-dev libncurses5-dev libreadline-dev bison pkg-config build-essential libgcrypt20-dev libevdev-dev libev-dev libldap-dev libprocps-dev libsasl2-dev libnuma-dev doxygen libaio-dev libcurl4-openssl-dev libicu-dev zlib1g-dev

    # some packages above may not have been needed but I was trying to figure out the build failures and did what seemed needed - part of the problem was ultimately solved below by creating an empty file

    cd mysql-server
    mkdir build
    touch extra/libkmip/CMakeLists.txt
    cd build
    cmake .. -DWITH_DEBUG=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=~/my_boost -DWITH_UNIT_TESTS=OFF
    make -j3

    ReplyDelete
    Replies
    1. Dependencies is an additional hurdle. My mostly complete list is https://github.com/mdcallag/mytools/blob/master/bench/conf/nuc8i7.ub1804/install

      I then add (with some dups):
      sudo apt install -y numactl fio sysstat libgflags-dev libsnappy-dev zlib1g-dev liblz4-dev libzstd-dev gcc g++ default-jdk make libjemalloc-dev clang bzip2 libreadline-dev bison flex

      And then when I build sysbench I add:
      sudo apt -y install make automake libtool pkg-config libaio-dev autoconf luajit

      Delete