この記事は ConoHaのカレンダー | Advent Calendar 2023 と MySQLのカレンダー | Advent Calendar 2023 の5日目の記事です。
去年は CentOS 9 Stream でビルドしたらしい。
- 日々の覚書: また今年もConoHaの上でMySQLをビルドする季節がやってきた
- 2021年 ConoHaの上でひたすらMySQLをビルドする 2021
- 2019年 日々の覚書: ConoHaの上でひたすらMySQLをビルドする簡単なおしごと in 2019年
- 2017年 日々の覚書: ConoHaの上でひたすらMySQLをビルドする簡単なお仕事
- 2016年 日々の覚書: MySQLのビルド環境にConoHaを選んでいる理由
今年は Rocky Linux 8, 9 が正式にMySQLのSupported PlatformになったのでRocky Linux 9でやってみる。
(cppを足しておけば Rocky Linux 9でもビルドできた可能性がある)
$ cat /etc/os-release
NAME="Rocky Linux"
VERSION="9.2 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.2"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.2 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2032-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.2"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.2"
MySQLは折角だから8.2.0を選ぶぜ!
$ wget https://dev.mysql.com/get/Downloads/MySQL-8.2/mysql-boost-8.2.0.tar.gz
$ tar xf mysql-boost-8.2.0.tar.gz
$ mkdir build
$ cd build
$ cmake -DWITH_BOOST=../mysql-8.2.0/boost ../mysql-8.2.0
-bash: cmake: command not found
まずはcmake
$ sudo dnf install -y cmake
$ cmake -DWITH_BOOST=../mysql-8.2.0/boost ../mysql-8.2.0
..
CMake Warning at CMakeLists.txt:397 (MESSAGE):
Could not find devtoolset compiler/linker in /opt/rh/gcc-toolset-12
CMake Warning at CMakeLists.txt:399 (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
CMake Error at CMakeLists.txt:401 (MESSAGE):
Or you can set CMAKE_C_COMPILER and CMAKE_CXX_COMPILER explicitly.
-- Configuring incomplete, errors occurred!
メッセージの通りgcc, gcc-c++, binutilsとかを突っ込む
$ sudo dnf install -y gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-binutils gcc-toolset-12-annobin-annocheck gcc-toolset-12-annobin-plugin-gcc
$ cmake -DWITH_BOOST=../mysql-8.2.0/boost ../mysql-8.2.0
..
-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)
--
Could not find system OpenSSL
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:346 (FATAL_SSL_NOT_FOUND_ERROR)
cmake/ssl.cmake:518 (FIND_SYSTEM_OPENSSL)
CMakeLists.txt:1831 (MYSQL_CHECK_SSL)
次はopenssl-devel
$ sudo dnf install -y openssl-devel
$ cmake -DWITH_BOOST=../mysql-8.2.0/boost ../mysql-8.2.0
..
CMake Error at cmake/readline.cmake:92 (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:126 (FIND_CURSES)
cmake/readline.cmake:220 (MYSQL_USE_BUNDLED_EDITLINE)
CMakeLists.txt:1934 (MYSQL_CHECK_EDITLINE)
ncurses-devel. これはCMaKeCache.txt消してあげないといけないやつ。
$ sudo dnf install -y ncurses-devel
$ rm CMakeCache.txt
$ cmake -DWITH_BOOST=../mysql-8.2.0/boost ../mysql-8.2.0
..
CMake Warning at cmake/rpc.cmake:40 (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:96 (WARN_MISSING_SYSTEM_TIRPC)
plugin/group_replication/libmysqlgcs/cmake/configure.cmake:34 (MYSQL_CHECK_RPC)
plugin/group_replication/libmysqlgcs/CMakeLists.txt:31 (INCLUDE)
CMake Error at cmake/rpc.cmake:97 (MESSAGE):
Could not find rpc/rpc.h in /usr/include or /usr/include/tirpc
Call Stack (most recent call first):
plugin/group_replication/libmysqlgcs/cmake/configure.cmake:34 (MYSQL_CHECK_RPC)
plugin/group_replication/libmysqlgcs/CMakeLists.txt:31 (INCLUDE)
毎年引っかかるrpc.h
$ sudo dnf install -y libtirpc-devel
Last metadata expiration check: 0:10:10 ago on Mon Dec 4 15:11:45 2023.
No match for argument: libtirpc-devel
Error: Unable to find a match: libtirpc-devel
エラーメッセージの通りにやるとそんなものないと言われる… 去年の自分に助けられ て、crbなるリポジトリにあることが判明。
$ sudo dnf install -y --enablerepo=crb libtirpc-devel
$ cmake -DWITH_BOOST=../mysql-8.2.0/boost ../mysql-8.2.0
..
CMake Warning at cmake/rpc.cmake:29 (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:122 (WARN_MISSING_RPCGEN_EXECUTABLE)
plugin/group_replication/libmysqlgcs/CMakeLists.txt:50 (INCLUDE)
CMake Error at plugin/group_replication/libmysqlgcs/cmake/rpcgen.cmake:123 (MESSAGE):
Could not find rpcgen
Call Stack (most recent call first):
plugin/group_replication/libmysqlgcs/CMakeLists.txt:50 (INCLUDE)
rpcgenと同じものなのかと思ったらrpcgenはrpcgenでいるらしい。
$ sudo dnf install -y --enablerepo=crb rpcgen
$ cmake -DWITH_BOOST=../mysql-8.2.0/boost ../mysql-8.2.0
..
-- Build files have been written to: /home/yoku0825/build
cmake完了。 今年は ~さっさと終わらせたくて~ 奮発して4コア4GBのインスタンスを使ってるので少しは快適か
$ time make -j$(nproc)
..
[ 52%] Building CXX object plugin/group_replication/libmysqlgcs/CMakeFiles/mysqlgcs.dir/src/bindings/xcom/xcom/pax_msg.cc.o
In file included from /home/yoku0825/mysql-8.2.0/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/pax_msg.cc:30:
/home/yoku0825/mysql-8.2.0/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/app_data.h:43:1: error: ‘app_data_ptr’ does not name a type
43 | app_data_ptr clone_app_data(app_data_ptr a);
| ^~~~~~~~~~~~
/home/yoku0825/mysql-8.2.0/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/app_data.h:44:1: error: ‘app_data_ptr’ does not name a type
44 | app_data_ptr clone_app_data_single(app_data_ptr a);
| ^~~~~~~~~~~~
/home/yoku0825/mysql-8.2.0/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/app_data.h:45:1: error: ‘app_data_ptr’ does not name a type
45 | app_data_ptr new_app_data();
| ^~~~~~~~~~~~
..
/home/yoku0825/mysql-8.2.0/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/site_def.h:67:22: warning: ‘node_no_exists’ defined but not used [-Wunused-variable]
67 | static inline bool_t node_no_exists(node_no n, site_def const *site) {
| ^~~~~~~~~~~~~~
/home/yoku0825/mysql-8.2.0/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/synode_no.h:44:19: warning: ‘group_mismatch’ defined but not used [-Wunused-variable]
44 | static inline int group_mismatch(synode_no x, synode_no y) {
| ^~~~~~~~~~~~~~
make[2]: *** [plugin/group_replication/libmysqlgcs/CMakeFiles/mysqlgcs.dir/build.make:99: plugin/group_replication/libmysqlgcs/CMakeFiles/mysqlgcs.dir/src/bindings/xcom/xcom/pax_msg.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:9709: plugin/group_replication/libmysqlgcs/CMakeFiles/mysqlgcs.dir/all] Error 2
make: *** [Makefile:166: all] Error 2
real 2m5.571s
user 7m22.443s
sys 0m50.147s
あれ、転けた。。
なんかどうもこれと同じような気がするけど解決方法が全く分からない…。
諦めてRocky Linux 8にすることにする!
改めて。
$ cat /etc/os-release
NAME="Rocky Linux"
VERSION="8.7 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.7"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.7 (Green Obsidian)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:8:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-8"
ROCKY_SUPPORT_PRODUCT_VERSION="8.7"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.7"
$ sudo dnf install -y cmake gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-binutils gcc-toolset-12-annobin-annocheck gcc-toolset-12-annobin-plugin-gcc openssl-devel ncurses-devel --enablerepo=powertools libtirpc-devel rpcgen
$ wget https://dev.mysql.com/get/Downloads/MySQL-8.2/mysql-boost-8.2.0.tar.gz
$ tar xf mysql-boost-8.2.0.tar.gz
$ mkdir build
$ cd build
$ cmake -DWITH_BOOST=../mysql-8.2.0/boost ../mysql-8.2.0
$ time make -j$(nproc)
..
[ 13%] Generating xdr_gen/xcom_vp.h, xdr_gen/xcom_vp_xdr.c
cannot find C preprocessor: cpp
/usr/bin/rpcgen: C preprocessor failed with exit code 1
[ 13%] Building CXX object extra/icu/CMakeFiles/icuuc.dir/icu-release-73-1/source/common/ucnv_lmb.cpp.o
cannot find C preprocessor: cpp
/usr/bin/rpcgen: C preprocessor failed with exit code 1
cannot find C preprocessor: cpp
/usr/bin/rpcgen: C preprocessor failed with exit code 1
cannot find C preprocessor: cpp
/usr/bin/rpcgen: C preprocessor failed with exit code 1
cannot find C preprocessor: cpp
/usr/bin/rpcgen: C preprocessor failed with exit code 1
[ 13%] Building CXX object mysys/CMakeFiles/mysys_objlib.dir/my_kdf.cc.o
cannot find C preprocessor: cpp
/usr/bin/rpcgen: C preprocessor failed with exit code 1
cannot find C preprocessor: cpp
/usr/bin/rpcgen: C preprocessor failed with exit code 1
cannot find C preprocessor: cpp
/usr/bin/rpcgen: C preprocessor failed with exit code 1
cannot find C preprocessor: cpp
/usr/bin/rpcgen: C preprocessor failed with exit code 1
cannot find C preprocessor: cpp
/usr/bin/rpcgen: C preprocessor failed with exit code 1
[ 13%] Building CXX object extra/icu/CMakeFiles/icui18n.dir/icu-release-73-1/source/i18n/nortrans.cpp.o
cannot find C preprocessor: cpp
/usr/bin/rpcgen: C preprocessor failed with exit code 1
cannot find C preprocessor: cpp
/usr/bin/rpcgen: C preprocessor failed with exit code 1
[ 13%] Building CXX object plugin/group_replication/libmysqlgcs/CMakeFiles/mysqlgcs.dir/src/bindings/xcom/xcom/pax_msg.cc.o
In file included from /home/yoku0825/mysql-8.2.0/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/pax_msg.cc:30:
/home/yoku0825/mysql-8.2.0/plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/app_data.h:43:1: error: 'app_data_ptr' does not name a type
43 | app_data_ptr clone_app_data(app_data_ptr a);
| ^~~~~~~~~~~~
..
もしかして cannot find C preprocessor: cpp を見落としてた?
$ sudo dnf install cpp
$ time make -j$(nproc)
..
違った。 なんかrpcgenをもう一度やってない気がしたのでビルドディレクトリを綺麗にしてもう一度makeしてみる。
$ rm -r *
$ cmake -DWITH_BOOST=../mysql-8.2.0/boost ../mysql-8.2.0
$ make -j$(nproc)
..
[100%] Building CXX object unittest/gunit/CMakeFiles/merge_large_tests-t.dir/__/__/storage/example/ha_example.cc.o
[100%] Linking CXX executable ../../runtime_output_directory/merge_large_tests-t
[100%] Built target merge_large_tests-t
上手くいったじゃん…。
ということはcppを足してからやり直せばRocky Linux 9でも上手くいくかも知れない。初回で見落として繰り返してしまったか…。
けど、それは来年にでもやるとして今年もお疲れさまでした。
0 件のコメント :
コメントを投稿