Description:
Building MySQL 9.0.0 rpms from source seems to have missing BuildRequires: dependencies vs 8.0.37 builds.
I see the rpm spec file template setup changes to use gcc-toolset-13 instead of gcc-toolset-12 used in 8.0. However, you still need to build the 8.0 lib-compat libraries and if the gcc-toolset-12 rpms are required to do this and are not added to the build environment then the build will fail.
I notice that trying to build from a clean ol9 docker image the build fails if I don't pre-install the gcc-toolset-12 rpms. These are NOT mentioned in the spec file's BuildRequires: section and the build failure code explicitly says that gcc-toolset-12 rpms are needed.
How to repeat:
Build from an empty container, ensure that only the BuildRequires rpms are installed
building shows:
~/rpmbuild/BUILD/mysql-9.0.0/mysql-8.0.37 ~/rpmbuild/BUILD/mysql-9.0.0
+ mkdir build
+ pushd build
~/rpmbuild/BUILD/mysql-9.0.0/mysql-8.0.37/build ~/rpmbuild/BUILD/mysql-9.0.0/mysql-8.0.37 ~/rpmbuild/BUILD/mysql-9.0.0
+ cmake .. -DBUILD_CONFIG=mysql_release -DINSTALL_LAYOUT=RPM -DCMAKE_BUILD_TYPE=RelWithDebInfo -DMYSQL_MAINTAINER_MODE=0 '-DCMAKE_C_FLAGS=-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe
-Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x8
6-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' '-DCMAKE_CXX_FLAGS=-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-sec
urity -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -f
asynchronous-unwind-tables -fstack-clash-protection -fcf-protection' -DWITH_SYSTEMD=0 -DWITH_BOOST=../boost -DWITH_ROUTER=0 -DWITH_AUTHENTICATION_CLIENT_PLUGINS=0 -DWITHOUT_SERVER=1 -DMYSQL_UNIX_ADDR=/var/lib/mysql
/mysql.sock -DMYSQLX_UNIX_ADDR=/var/run/mysqld/mysqlx.sock '-DCOMPILATION_COMMENT=MySQL Community - GPL' '-DCOMPILATION_COMMENT_SERVER=MySQL Community Server - GPL' -DMYSQL_SERVER_SUFFIX=
-- Running cmake version 3.26.5
-- Found Git: /usr/bin/git (found version "2.43.5")
-- This is .el9. as found from 'rpm -qf /'
-- Looking for a devtoolset compiler
CMake Warning at CMakeLists.txt:407 (MESSAGE):
Could not find devtoolset compiler/linker in /opt/rh/gcc-toolset-12
CMake Warning at CMakeLists.txt:409 (MESSAGE):
You need to install the required packages:
yum install gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-binutils gcc-toolset-12-annobin-annocheck gcc-toolset-12-annobin-plugin-gcc
Suggested fix:
1. Add these rpms to the BuildRequires: section in https://github.com/mysql/mysql-server/blob/trunk/packaging/rpm-oel/mysql.spec.in
2. Consider trying to build your environment from a clean, empty environment as by doing this you'll catch these build failures. Your build setup may be more complex as you need to build for many OS versions and also build the Enterprise and Community and now Cloud versions but by doing a clean build from an empty environment this sort of missing configuration will become more visible to you. It is not the first time that I have reported such issues.
3. Also please document your build process so that others can reproduce it more easily. My code at https://github.com/sjmudd/mysql-rpm-builder is updated to ensure that I can build new rpms directly from a clean empty environment. You may consider there are better ways to do this but it's allowed me to at least be sure that if I want to rebuild rpms I am able to do this and can be confident I will be find the process fails unexpectedly.
I'm currently rebuilding the MySQL 9.0.0 rpms against OL9. Once done I'll push the latest change to my repo.