GA

2025/12/07

今年もConoHaのVPSでMySQLをビルドする 2025年

この記事は ConoHa - Qiita Advent Calendar 2025 の7番目の窓です。

昨日は 8mitsu さんの ConoHaをMCPで操作してみた でした。

この記事は MySQL - Qiita Advent Calendar 2025 の7番目の窓でもあります。

こちらは昨日は @taka_yuki_04 さんの MySQL キーリングプラグインからコンポーネントへの移行 でした。


今年はビルドのために 6コア6GBのOracle Linux 10を起動しました。去年までは1コア2GBで頑張っていましたがそれで最近のMySQLをビルドしていると一晩かかるのでもうつらい。


OSはOracle Linuxの10にしてみた。


$ cat /etc/os-release

NAME="Oracle Linux Server"

VERSION="10.1"

ID="ol"

ID_LIKE="fedora"

VARIANT="Server"

VARIANT_ID="server"

VERSION_ID="10.1"

PLATFORM_ID="platform:el10"

PRETTY_NAME="Oracle Linux Server 10.1"

ANSI_COLOR="0;31"

CPE_NAME="cpe:/o:oracle:linux:10:1:server"

HOME_URL="https://linux.oracle.com/"

BUG_REPORT_URL="https://github.com/oracle/oracle-linux"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 10"

ORACLE_BUGZILLA_PRODUCT_VERSION=10.1

ORACLE_SUPPORT_PRODUCT="Oracle Linux"

ORACLE_SUPPORT_PRODUCT_VERSION=10.1

まずは来年、2026年4月にEOLになるMySQL 8.0シリーズの最新版、8.0.44。


$ wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-boost-8.0.44.tar.gz

$ tar xf mysql-boost-8.0.44.tar.gz
$ cmake .
-bash: cmake: command not found

$ sudo dnf install -y cmake

$ cmake .
-- Running cmake version 3.30.5
-- Could NOT find Git (missing: GIT_EXECUTABLE)
Hint: The project() command has not yet been called.  It sets up system-specific search paths.
-- This is .el10. as found from 'rpm -qf /'
-- CMAKE_MODULE_PATH is /home/yoku0825/mysql-8.0.44/cmake
-- MySQL 8.0.44
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:585 (PROJECT):
  No CMAKE_C_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.

CMake Error at CMakeLists.txt:585 (PROJECT):
  No CMAKE_CXX_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

-- Configuring incomplete, errors occurred!

コンパイラがないので入れる。去年(Rocky Linux 9.4)の時は「このgcc-toolsetを入れろ」って書いてあったけど10系だからかそんなに親切ではない感じ。

$ sudo dnf install -y gcc gcc-c++

$ cmake .
..
-- Binary directory /home/yoku0825/mysql-8.0.44
CMake Error at CMakeLists.txt:639 (MESSAGE):
  Please do not build in-source.  Out-of source builds are highly
  recommended: you can have multiple builds for the same source, and there is
  an easy way to do cleanup, simply remove the build directory (note that
  'make clean' or 'make distclean' does *not* work)

  You *can* force in-source build by invoking cmake with
  -DFORCE_INSOURCE_BUILD=1

-- Configuring incomplete, errors occurred!

忘れてた。インソースビルドでいいので足す。あとBoost同梱版なのでそれも足す。さらについでにインストール先の指定もくっつける。

$ cmake -DCMAKE_INSTALL_PREFIX=/usr/mysql/8.0.44 -DFORCE_INSOURCE_BUILD=1 -DWITH_BOOST=./boost .
..
-- ZSTD_LEGACY_SUPPORT not defined!
--
Not a supported openssl version in WITH_SSL=system.
Make sure you have specified a supported SSL version.
Valid options are :
openssl[0-9]+ (use alternative system library)
yes (synonym for system)
</path/to/custom/openssl/installation>

CMake Error at cmake/ssl.cmake:84 (MESSAGE):
  Please install the appropriate openssl developer package.

Call Stack (most recent call first):
  cmake/ssl.cmake:406 (FATAL_SSL_NOT_FOUND_ERROR)
  CMakeLists.txt:1848 (MYSQL_CHECK_SSL)

-- Configuring incomplete, errors occurred!

openssl-develが必要、はい。

$ sudo dnf install -y openssl-devel

$ cmake -DCMAKE_INSTALL_PREFIX=/usr/mysql/8.0.44 -DFORCE_INSOURCE_BUILD=1 -DWITH_BOOST=./boost .

..
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:93 (MESSAGE):
  Curses library not found.  Please install appropriate package,

      remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
  cmake/readline.cmake:127 (FIND_CURSES)
  cmake/readline.cmake:221 (MYSQL_USE_BUNDLED_EDITLINE)
  CMakeLists.txt:1952 (MYSQL_CHECK_EDITLINE)

-- Configuring incomplete, errors occurred!

ncurses-develも必要。で入れたらCMakeCache.txtを消せと(なんでこのパッケージだけ消さないとダメなのか俺はよくわかっていない…)

$ sudo dnf install -y ncurses-devel
$ rm CMakeCache.txt
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/mysql/8.0.44 -DFORCE_INSOURCE_BUILD=1 -DWITH_BOOST=./boost .
..
-- Checking for module 'libtirpc'
--   Package 'libtirpc', required by 'virtual:world', not found
CMake Warning at cmake/rpc.cmake:41 (MESSAGE):
  Cannot find RPC development libraries.  You need to install the required
  packages:

    Debian/Ubuntu:              apt install libtirpc-dev
    RedHat/Fedora/Oracle Linux: yum install libtirpc-devel
    SuSE:                       zypper install glibc-devel

Call Stack (most recent call first):
  cmake/rpc.cmake:112 (WARN_MISSING_SYSTEM_TIRPC)
  CMakeLists.txt:2088 (MYSQL_CHECK_RPC)

CMake Error at cmake/rpc.cmake:113 (MESSAGE):
  Could not find rpc/rpc.h in /usr/include or /usr/include/tirpc
Call Stack (most recent call first):
  CMakeLists.txt:2088 (MYSQL_CHECK_RPC)

-- Configuring incomplete, errors occurred!

毎年リポジトリがよくわからなくなるtirpc-devel 。Oracle Linux 10では ol10_codeready_builder らしい。

$ sudo dnf install libtirpc-devel

Last metadata expiration check: 0:23:40 ago on Sat 06 Dec 2025 06:44:15 PM JST.
No match for argument: libtirpc-devel
Error: Unable to find a match: libtirpc-devel

$ sudo dnf install -y --enablerepo="*" libtirpc-devel
..
=======================================================================================================================================
 Package                         Architecture            Version                         Repository                               Size
=======================================================================================================================================
Installing:
 libtirpc-devel                  x86_64                  1.3.5-1.el10                    ol10_codeready_builder                  187 k
..

$ cmake -DCMAKE_INSTALL_PREFIX=/usr/mysql/8.0.44 -DFORCE_INSOURCE_BUILD=1 -DWITH_BOOST=./boost .
..

-- Performing Test X_PUTLONG_NOT_USE_CONST - Failed
CMake Warning at cmake/rpc.cmake:30 (MESSAGE):
  Cannot find rpcgen executable.  You need to install the required packages:

    Debian/Ubuntu:              apt install rpcsvc-proto
    RedHat/Fedora/Oracle Linux: yum install rpcgen
    SuSE:                       zypper install glibc-devel

Call Stack (most recent call first):
  plugin/group_replication/libmysqlgcs/cmake/rpcgen.cmake:113 (WARN_MISSING_RPCGEN_EXECUTABLE)
  plugin/group_replication/libmysqlgcs/CMakeLists.txt:51 (INCLUDE)

CMake Error at plugin/group_replication/libmysqlgcs/cmake/rpcgen.cmake:114 (MESSAGE):
  Could not find rpcgen
Call Stack (most recent call first):
  plugin/group_replication/libmysqlgcs/CMakeLists.txt:51 (INCLUDE)

-- Configuring incomplete, errors occurred!

また毎年リポジトリのはぐれるrpcgen

$ sudo dnf install -y --enablerepo="*" rpcgen

..
=======================================================================================================================================
 Package                     Architecture                Version                             Repository                           Size
=======================================================================================================================================
Installing:
 rpcgen                      x86_64                      1.4-17.el10                         ol10_appstream                       55 k
..

$ cmake -DCMAKE_INSTALL_PREFIX=/usr/mysql/8.0.44 -DFORCE_INSOURCE_BUILD=1 -DWITH_BOOST=./boost .
..

-- CMAKE_SHARED_LINKER_FLAGS
-- Configuring done (3.2s)
-- Generating done (5.2s)
-- Build files have been written to: /home/yoku0825/mysql-8.0.44

$ time make -j$(nproc)
..
real    41m31.176s
user    225m37.415s
sys     15m19.890s

$ sudo make install

$ du -sh /usr/mysql/8.0.44/
1.5G    /usr/mysql/8.0.44/

OK。次に今のメインストリームの8.4.7。Boostは同梱されるようになったから -DWITH_BOOST はもういらない。

$ wget https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-8.4.7.tar.gz
$ tar xf mysql-8.4.7.tar.gz
$ cd mysql-8.4.7/
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/mysql/8.4.7 -DFORCE_INSOURCE_BUILD=1 .

$ time make -j$(nproc)
..
/home/yoku0825/mysql-8.4.7/extra/boost/boost_1_84_0/boost/multiprecision/cpp_bin_float.hpp:40:10: fatal error: quadmath.h: No such file or directory
   40 | #include <quadmath.h>
      |          ^~~~~~~~~~~~
compilation terminated.
make[2]: *** [sql/CMakeFiles/sql_gis.dir/build.make:90: sql/CMakeFiles/sql_gis.dir/gis/buffer.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:49710: sql/CMakeFiles/sql_gis.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

real    39m24.234s
user    217m18.669s
sys     13m42.765s

エラった…。 libquadmath-devel が必要そう。

$ sudo dnf install libquadmath-devel
$ time make -j$(nproc)
..
real    19m49.002s
user    106m29.194s
sys     6m19.764s

合計49分くらい。サイズはそんな変わらない。

$ sudo make install
$ du -sh /usr/mysql/8.4.7/
1.5G    /usr/mysql/8.4.7/

最後にInnovation Releaseの9.5.0

$ wget https://dev.mysql.com/get/Downloads/MySQL-9.5/mysql-9.5.0.tar.gz

$ tar xf mysql-9.5.0.tar.gz
$ cd mysql-9.5.0/
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/mysql/9.5.0 -DFORCE_INSOURCE_BUILD=1 .
..
-- Could NOT find BISON (missing: BISON_EXECUTABLE)
CMake Warning at cmake/bison.cmake:119 (MESSAGE):
  No bison found!!
Call Stack (most recent call first):
  router/src/routing_guidelines/src/CMakeLists.txt:25 (INCLUDE)

CMake Warning at cmake/bison.cmake:120 (MESSAGE):
  If you have bison in a non-standard location, you can do 'cmake
  -DBISON_EXECUTABLE=</path/to/bison-executable>
Call Stack (most recent call first):
  router/src/routing_guidelines/src/CMakeLists.txt:25 (INCLUDE)

CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Could NOT find BISON (missing: BISON_EXECUTABLE)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindBISON.cmake:306 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  router/src/routing_guidelines/src/CMakeLists.txt:27 (FIND_PACKAGE)

-- Configuring incomplete, errors occurred!

Bisonが必須になったみたい(以前は任意でワーニングは出たけどエラーではなかった)

$ sudo dnf install -y bison
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/mysql/9.5.0 -DFORCE_INSOURCE_BUILD=1 .

$ time make -j$(nproc)
..
real    59m43.890s
user    328m0.973s
sys     19m57.807s

6コア使って1時間じゃ、1コアだとホントにメモリも足りないしダメなんではなかろうか。。

$ du -sh /usr/mysql/9.5.0/
1.6G    /usr/mysql/9.5.0/
明日は ConoHa - Qiita Advent Calendar 2025 が @che_azure さん、 MySQL - Qiita Advent Calendar 2025 が @HrsUed さんです! ​
a

0 件のコメント :

コメントを投稿