Script tested on Rocky Linux 8.9 and mysql 8.0.36
export MYSQL_VERSION="8.0.36"
dnf install git cmake3 gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-binutils gcc-toolset-12-annobin-annocheck gcc-toolset-12-annobin-plugin-gcc elfutils openssl-devel
ncurses-devel libtirpc-devel patch automake libtool mysql-devel libudev-devel bison curl-devel python2 -y
dnf -y --enablerepo=powertools install rpcgen
scl enable gcc-toolset-12 bash
wget -q -N https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-boost-${MYSQL_VERSION}.tar.gz -O mysql-boost-${MYSQL_VERSION}.tar.gz
git clone https://github.com/trellix-enterprise/mysql-audit.git
cd mysql-audit
git checkout tags/v1.1.13
tar zxvf ../mysql-boost-${MYSQL_VERSION}.tar.gz
cd mysql-${MYSQL_VERSION}
cmake3 -DFORCE_INSOURCE_BUILD=ON -DWITH_BOOST=boost .
make -j`nproc --all` -C libservices
make -j`nproc --all` -C include
cd ..
perl -pi -e 's/TABLE_LIST/Table_ref/g' `grep -rlw TABLE_LIST include/ src/ offset-extract/`
cd src
patch --verbose --ignore-whitespace audit_handler.cc << EOF --- audit_handler.cc 2024-01-24 17:19:37.247677405 +0000 +++ audit_handler.cc.2 2024-01-24 17:23:21.295862210 +0000 @@ -841,7 +841,7 @@ const char *well_formed_error_pos = NULL, *cannot_convert_error_pos = NULL, *from_end_pos = NULL; copy_length = well_formed_copy_nchars( - &my_charset_utf8_bin + &my_charset_utf8mb4_bin , dest , dest_size , from_cs @@ -1089,7 +1089,7 @@ #if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100504 &my_charset_utf8mb3_general_ci, #else - &my_charset_utf8_general_ci, + &my_charset_utf8mb4_general_ci, #endif query, qlen, col_connection, & errors); EOFcd ..
chmod +x bootstrap.sh
./bootstrap.sh
CXX='gcc -static-libgcc' CC='gcc -static-libgcc' ./configure --with-mysql=mysql-${MYSQL_VERSION} --with-mysql-libservices=mysql-${MYSQL_VERSION}/libservices/libmysqlservices.a
perl -pi -e 's/automake-1.15/automake/g' pcre/Makefile
perl -pi -e 's/aclocal-1.15/aclocal/g' pcre/Makefile
alternatives --config python
make -j`nproc --all`
ls -la src/.libs
and finally: cp src/.libs/libaudit_plugin.so* /usr/lib64/mysql/plugin/
Issue and discussion:
https://github.com/trellix-enterprise/mysql-audit/issues/261
One more mention: