このエントリは ConoHa Advent Calendar 2021 と MySQL Advent Calendar 2021 の1日目の記事です。
ついに6回目を迎えた、「定点観測っぽく1GBのVPSでひたすらビルドするシリーズ」、最近のMySQLのビルドにはパワーが必要ですね。
今年はビルド用のVPSを起動するタイミングでCentOS Stream 9が選べたのでそれを選択。
$ cat /etc/centos-release
CentOS Stream release 9
MySQL 5.6はEOLになったので、5.7と8.0のみ。
まずはMySQL 5.7から。
$ wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-boost-5.7.36.tar.gz
$ tar xf mysql-boost-5.7.36.tar.gz
$ cd mysql-5.7.36/
$ cmake .
-bash: cmake: command not found
cmakeが無かったのでインストール。
CentOS Stream 8がどうだったか全く忘れたけど、もう cmake
だけでもちゃんと cmake3
がインストールされてくれるのね。
$ sudo dnf install -y cmake
$ cmake .
..
CMake Error at CMakeLists.txt:146 (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:146 (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.
..
gccも入り用だった。
$ sudo dnf install -y gcc gcc-c++
$ cmake .
..
CMake Error at cmake/boost.cmake:88 (MESSAGE):
You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory>
This CMake script will look for boost in <directory>. If it is not there,
it will download and unpack it (in that directory) for you.
..
-DWITH_BOOST=./boost
つけ忘れてた。もう一度。
$ cmake -DWITH_BOOST=./boost .
..
Cannot find appropriate system libraries for WITH_SSL=system.
Make sure you have specified a supported SSL version.
Valid options are :
system (use the OS openssl library),
yes (synonym for system),
</path/to/custom/openssl/installation>
CMake Error at cmake/ssl.cmake:63 (MESSAGE):
Please install the appropriate openssl developer package.
Call Stack (most recent call first):
cmake/ssl.cmake:280 (FATAL_SSL_NOT_FOUND_ERROR)
CMakeLists.txt:568 (MYSQL_CHECK_SSL)
..
そういえばデフォルトでOpenSSLを使ったSSLを有効にしようとするようになったのであった。
$ sudo dnf install -y openssl-devel
$ cmake -DWITH_BOOST=./boost .
..
Cannot find appropriate system libraries for WITH_SSL=system.
Make sure you have specified a supported SSL version.
Valid options are :
system (use the OS openssl library),
yes (synonym for system),
</path/to/custom/openssl/installation>
CMake Error at cmake/ssl.cmake:63 (MESSAGE):
Please install the appropriate openssl developer package.
Call Stack (most recent call first):
cmake/ssl.cmake:280 (FATAL_SSL_NOT_FOUND_ERROR)
CMakeLists.txt:568 (MYSQL_CHECK_SSL)
..
あれまた同じエラー出た。
CMakeCache.txtクリアしないといけなかったかな。
$ rm CMakeCache.txt
$ cmake -DWITH_BOOST=./boost .
..
Cannot find appropriate system libraries for WITH_SSL=system.
Make sure you have specified a supported SSL version.
Valid options are :
system (use the OS openssl library),
yes (synonym for system),
</path/to/custom/openssl/installation>
CMake Error at cmake/ssl.cmake:63 (MESSAGE):
Please install the appropriate openssl developer package.
Call Stack (most recent call first):
cmake/ssl.cmake:280 (FATAL_SSL_NOT_FOUND_ERROR)
CMakeLists.txt:568 (MYSQL_CHECK_SSL)
..
違った。
なんかどうも このへん とかを見る限り、OpenSSLのヘッダの書き方とか変わって認識できてないんじゃないか疑惑。
openssl-devel-1.0.2k-21.el7_9.x86_64
/usr/include/openssl/opensslv.h
# define OPENSSL_VERSION_NUMBER 0x100020bfL
vs.
openssl-devel-3.0.0-3.el9.x86_64
/usr/include/openssl/opensslv.h
# define OPENSSL_VERSION_NUMBER \
( (OPENSSL_VERSION_MAJOR<<28) \
|(OPENSSL_VERSION_MINOR<<20) \
|(OPENSSL_VERSION_PATCH<<4) \
|_OPENSSL_VERSION_PRE_RELEASE )
サポートされていないんだろうな、とそっと閉じてCentOS Stream 8でやることを決意。
(そもそもMySQL 5.7はRHEL系の8.xでもサポートされていない MySQL :: Supported Platforms: MySQL Database )
ではやりなおし。
$ cat /etc/centos-release
CentOS Stream release 8
$ wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-boost-5.7.36.tar.gz
$ tar xf mysql-boost-5.7.36.tar.gz
$ cd mysql-5.7.36/
$ sudo dnf install -y cmake gcc gcc-c++ openssl-devel
$ cmake -DWITH_BOOST=./boost .
..
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:71 (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:105 (FIND_CURSES)
cmake/readline.cmake:198 (MYSQL_USE_BUNDLED_EDITLINE)
CMakeLists.txt:570 (MYSQL_CHECK_EDITLINE)
ああ、いつもの ncurses-devel
入れ忘れた。
$ sudo dnf install -y ncurses-devel
$ rm CMakeCache.txt
$ cmake -DWITH_BOOST=./boost .
..
-- Package 'libtirpc', required by 'virtual:world', not found
CMake Error at cmake/rpc.cmake:76 (MESSAGE):
Could not find rpc/rpc.h in /usr/include or /usr/include/tirpc
Call Stack (most recent call first):
rapid/plugin/group_replication/configure.cmake:60 (MYSQL_CHECK_RPC)
rapid/plugin/group_replication/CMakeLists.txt:25 (INCLUDE)
おととし も引っかかったやつ。
PowerToolsリポジトリが全部小文字になってたのに数分溶かす。
$ sudo dnf --enablerepo=powertools install -y rpcgen libtirpc-devel
$ cmake -DWITH_BOOST=./boost .
$ time make
..
real 62m14.359s
user 49m11.136s
sys 5m38.007s
1時間ちょい。こんなもんだったっけかあ。
MySQL 8.0、インソースビルドのためのcmakeオプションつけて。
$ sudo dnf install --enablerepo=powertools -y cmake gcc gcc-c++ openssl-devel ncurses-devel rpcgen libtirpc-devel
$ wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-boost-8.0.27.tar.gz
$ tar xf mysql-boost-8.0.27.tar.gz
$ cd mysql-8.0.27
$ cmake -DWITH_BOOST=./boost -DFORCE_INSOURCE_BUILD=1 .
..
CMake Warning at CMakeLists.txt:349 (MESSAGE):
You need to install the required packages:
yum install gcc-toolset-10-gcc gcc-toolset-10-gcc-c++ gcc-toolset-10-binutils
..
お、devtoolsetってgcc-toolsetに改名したのか、と思いながらインストール。
$ sudo dnf install -y gcc-toolset-10-gcc gcc-toolset-10-gcc-c++ gcc-toolset-10-binutils
$ cmake -DWITH_BOOST=./boost -DFORCE_INSOURCE_BUILD=1 .
$ time make
..
[ 54%] Linking CXX shared library library_output_directory/libserver_unittest_library.so
/opt/rh/gcc-toolset-10/root/usr/bin/ld: error: library_output_directory/libserver_unittest_library.so(.debug_info) is too large (0x1caaed01 bytes)
collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
make[2]: *** [CMakeFiles/server_unittest_library.dir/build.make:183: library_output_directory/libserver_unittest_library.so] Error 1
make[2]: *** Deleting file 'library_output_directory/libserver_unittest_library.so'
make[1]: *** [CMakeFiles/Makefile2:4481: CMakeFiles/server_unittest_library.dir/all] Error 2
make: *** [Makefile:166: all] Error 2
real 223m36.642s
user 152m41.797s
sys 18m1.107s
Σ(゚д゚lll) 落ちた
$ free -h
total used free shared buff/cache available
Mem: 808Mi 684Mi 49Mi 0.0Ki 74Mi 26Mi
Swap: 2.0Gi 1.9Gi 107Mi
swap 2GBでも足りないなんて、もう1GBで戦える時代じゃないんですかね……どうするか…(普段使いのところはswap 4GB使ってまだMySQLをビルドしてはいるが)
0 件のコメント :
コメントを投稿