MySQL 8.0源码编译安装(二)

2.4.1.4.6 openEuler 22.03和24.03

进入mysql包解压的目录:

bash 复制代码
cd mysql-8.0.42/

安装cmake包:

复制代码
yum install -y cmake

执行cmake:

ini 复制代码
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.
​
​
-- Running cmake version 3.27.9
-- Could NOT find Git (missing: GIT_EXECUTABLE) 
-- CMAKE_MODULE_PATH is /usr/local/src/mysql-8.0.42/cmake
-- MySQL 8.0.42
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.  # 提示,CMake 错误:CMake 找不到与"Unix Makefiles"对应的构建程序。CMAKE_MAKE_PROGRAM 未设置。您可能需要选择其他构建工具。需要安装make。
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage # 提示,CMake 错误:EnableLanguage 后未设置 CMAKE_C_COMPILER,需要安装gcc。
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage # 提示,CMake 错误:在 EnableLanguage 之后未设置 CMAKE_CXX_COMPILER,需要安装gcc-c++。
-- Configuring incomplete, errors occurred!

安装make、gcc和gcc-c++包:

go 复制代码
yum install -y make gcc gcc-c++

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
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. # 提示,请安装相应的 openssl 开发人员软件包。
​
Call Stack (most recent call first):
  cmake/ssl.cmake:380 (FATAL_SSL_NOT_FOUND_ERROR)
  CMakeLists.txt:1826 (MYSQL_CHECK_SSL)
​
​
-- Configuring incomplete, errors occurred!

安装openssl-devel包:

复制代码
yum install -y openssl-devel

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
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. # 提示,找不到 Curses 库。请安装合适的软件包,删除 CMakeCache.txt 并重新运行 cmake。在 Debian/Ubuntu 上,包名称是 libncurses5-dev,在 Redhat 及其衍生产品上是 ncurses-devel。
Call Stack (most recent call first):
  cmake/readline.cmake:127 (FIND_CURSES)
  cmake/readline.cmake:221 (MYSQL_USE_BUNDLED_EDITLINE)
  CMakeLists.txt:1930 (MYSQL_CHECK_EDITLINE)
​
​
-- Configuring incomplete, errors occurred!

安装ncurses-devel:

复制代码
yum install -y ncurses-devel

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
CMake Warning at cmake/rpc.cmake:41 (MESSAGE):
  Cannot find RPC development libraries.  You need to install the required
  packages: # 提示,找不到 RPC 开发库。您需要安装所需的包:
​
    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:2066 (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:2066 (MYSQL_CHECK_RPC)
​
​
-- Configuring incomplete, errors occurred!

安装libtirpc-devel包:

复制代码
yum install -y libtirpc-devel

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
CMake Warning at cmake/rpc.cmake:30 (MESSAGE):
  Cannot find rpcgen executable.  You need to install the required packages:  # 提示,找不到 rpcgen 可执行文件。您需要安装所需的软件包:
​
    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包:

复制代码
yum install -y rpcgen

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
-- Configuring done (31.4s)
-- Generating done (1.8s)
-- Build files have been written to: /usr/local/src/mysql-8.0.42

执行make:

go 复制代码
make -j 4 && make install

总结编译过程:

ini 复制代码
# 安装依赖包
yum install -y cmake make gcc gcc-c++ openssl-devel ncurses-devel libtirpc-devel rpcgen
​
# 进入mysql包解压的目录
cd mysql-8.0.42/
​
# 执行cmake
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
​
# 执行make
make -j 4 && make install
2.4.1.4.7 OpenCloudOS 9

进入mysql包解压的目录:

bash 复制代码
cd mysql-8.0.42/

安装cmake包:

复制代码
yum install -y cmake

执行cmake:

ini 复制代码
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.
​
​
-- Running cmake version 3.26.5
-- Could NOT find Git (missing: GIT_EXECUTABLE) 
-- CMAKE_MODULE_PATH is /usr/local/src/mysql-8.0.42/cmake
-- MySQL 8.0.42
-- 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.  # 提示,通过设置环境变量 "CC" 或 CMake 缓存条目CMAKE_C_COMPILER到编译器,或者如果编译器名称在 PATH,需要安装gcc。
​
​
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. # 通过设置环境变量 "CXX" 或 CMake 缓存条目CMAKE_CXX_COMPILER完整路径添加到编译器,或者添加到编译器名称(如果它在 PATH 中),需要安装gcc-c++。
​
​
​
-- Configuring incomplete, errors occurred!

安装gcc和gcc-c++包:

r 复制代码
yum install -y gcc gcc-c++

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
CMake Error at cmake/systemd.cmake:60 (MESSAGE):
  Unable to detect systemd support on build machine, Aborting cmake build. # 提示,无法在构建计算机上检测到 systemd 支持,中止 cmake 构建。
Call Stack (most recent call first):
  cmake/systemd.cmake:80 (MYSQL_CHECK_SYSTEMD)
  CMakeLists.txt:1597 (INCLUDE)
​
​
-- Configuring incomplete, errors occurred!

安装systemd-devel包:

复制代码
yum install -y systemd-devel

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
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. # 提示,请安装相应的 openssl 开发人员软件包。
​
Call Stack (most recent call first):
  cmake/ssl.cmake:380 (FATAL_SSL_NOT_FOUND_ERROR)
  CMakeLists.txt:1826 (MYSQL_CHECK_SSL)
​
​
-- Configuring incomplete, errors occurred!

安装openssl-devel包:

复制代码
yum install -y openssl-devel

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
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. # 提示,找不到 Curses 库。请安装合适的软件包,删除 CMakeCache.txt 并重新运行 cmake。在 Debian/Ubuntu 上,包名称是 libncurses5-dev,在 Redhat 及其衍生产品上是 ncurses-devel。
Call Stack (most recent call first):
  cmake/readline.cmake:127 (FIND_CURSES)
  cmake/readline.cmake:221 (MYSQL_USE_BUNDLED_EDITLINE)
  CMakeLists.txt:1930 (MYSQL_CHECK_EDITLINE)
​
​
-- Configuring incomplete, errors occurred!

安装ncurses-devel:

复制代码
yum install -y ncurses-devel

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
CMake Warning at cmake/rpc.cmake:41 (MESSAGE):
  Cannot find RPC development libraries.  You need to install the required
  packages: # 提示,找不到 RPC 开发库。您需要安装所需的包:
​
    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:2066 (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:2066 (MYSQL_CHECK_RPC)
​
​
-- Configuring incomplete, errors occurred!

安装libtirpc-devel包:

复制代码
yum install -y libtirpc-devel

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
CMake Warning at cmake/rpc.cmake:30 (MESSAGE):
  Cannot find rpcgen executable.  You need to install the required packages: # 提示,找不到 rpcgen 可执行文件。您需要安装所需的软件包:
​
    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包:

复制代码
yum install -y rpcgen

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
-- Configuring done (45.9s)
-- Generating done (4.1s)
-- Build files have been written to: /usr/local/src/mysql-8.0.42

执行make:

go 复制代码
make -j 4 && make install

总结编译过程:

ini 复制代码
# 安装依赖包
yum install -y cmake gcc gcc-c++ systemd-devel openssl-devel ncurses-devel libtirpc-devel rpcgen
​
# 进入mysql包解压的目录
cd mysql-8.0.42/
​
# 执行cmake
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
​
# 执行make
make -j 4 && make install
2.4.1.4.8 Kylin Server V10

进入mysql包解压的目录:

bash 复制代码
cd mysql-8.0.42/

安装cmake包:

复制代码
yum install -y cmake

执行cmake:

ini 复制代码
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.
​
​
-- Running cmake version 3.16.5
-- Could NOT find Git (missing: GIT_EXECUTABLE) 
-- CMAKE_MODULE_PATH is /usr/local/src/mysql-8.0.42/cmake
-- MySQL 8.0.42
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool. # 提示,CMake 错误:CMake 找不到与"Unix Makefiles"对应的构建程序。CMAKE_MAKE_PROGRAM 未设置。您可能需要选择其他构建工具。需要安装make。
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage # 提示,CMake 错误:EnableLanguage 后未设置 CMAKE_C_COMPILER,需要安装gcc。
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage # 提示,CMake 错误:在 EnableLanguage 之后未设置 CMAKE_CXX_COMPILER,需要安装gcc-c++。
-- Configuring incomplete, errors occurred!
See also "/usr/local/src/mysql-8.0.42/CMakeFiles/CMakeOutput.log".

安装make、gcc和gcc-c++包:

ini 复制代码
yum install -y make gcc gcc-c++

[root@kylin10 mysql-8.0.42]# gcc --version
gcc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@kylin10 mysql-8.0.42]# g++ --version
g++ (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# MySQL 8.0需要gcc 8或更高版本,gcc和gcc-c++版本过低,需要编译安装gcc

编译安装gcc:

ruby 复制代码
cd ..
​
# 注意:这里需要编译安装gcc 11,不要装gcc 10,装了gcc 10在登录mysql之后就退出了,报错"Segmentation fault"。
wget https://mirrors.cloud.tencent.com/gnu/gcc/gcc-11.5.0/gcc-11.5.0.tar.gz
tar xf gcc-11.5.0.tar.gz
cd gcc-11.5.0
​
# 下载gcc依赖包
./contrib/download_prerequisites
2025-05-04 11:56:53 URL:https://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 [2383840/2383840] -> "gmp-6.1.0.tar.bz2" [1]
2025-05-04 11:56:56 URL:http://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.6.tar.bz2 [1287202/1287202] -> "mpfr-3.1.6.tar.bz2" [1]
2025-05-04 11:56:59 URL:http://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz [669925/669925] -> "mpc-1.0.3.tar.gz" [1]
2025-05-04 11:57:02 URL:http://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2 [1658291/1658291] -> "isl-0.18.tar.bz2" [1]
gmp-6.1.0.tar.bz2: OK
mpfr-3.1.6.tar.bz2: OK
mpc-1.0.3.tar.gz: OK
isl-0.18.tar.bz2: OK
All prerequisites downloaded successfully.
​
mkdir build
cd build/
​
# 执行configure
../configure --prefix=/usr --disable-multilib 
...
configure: creating ./config.status
config.status: creating Makefile
​
# 执行make
make -j 4 && make install
...
make[4]: Nothing to be done for 'install-data-am'.
make[4]: Leaving directory '/usr/local/src/gcc-11.5.0/build/x86_64-pc-linux-gnu/libatomic'
make[3]: Leaving directory '/usr/local/src/gcc-11.5.0/build/x86_64-pc-linux-gnu/libatomic'
make[2]: Leaving directory '/usr/local/src/gcc-11.5.0/build/x86_64-pc-linux-gnu/libatomic'
make[1]: Leaving directory '/usr/local/src/gcc-11.5.0/build'
​
[root@kylin10 build]# gcc --version
gcc (GCC) 11.5.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

再次进入mysql包解压的目录:

bash 复制代码
cd ../../mysql-8.4.5

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
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. # 提示,请安装相应的 openssl 开发人员软件包。
​
Call Stack (most recent call first):
  cmake/ssl.cmake:380 (FATAL_SSL_NOT_FOUND_ERROR)
  CMakeLists.txt:1826 (MYSQL_CHECK_SSL)
​
​
-- Configuring incomplete, errors occurred!
See also "/usr/local/src/mysql-8.0.42/CMakeFiles/CMakeOutput.log".
See also "/usr/local/src/mysql-8.0.42/CMakeFiles/CMakeError.log".

安装openssl-devel包:

复制代码
yum install -y openssl-devel

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
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. # 提示,找不到 Curses 库。请安装合适的软件包,删除 CMakeCache.txt 并重新运行 cmake。在 Debian/Ubuntu 上,包名称是 libncurses5-dev,在 Redhat 及其衍生产品上是 ncurses-devel。
Call Stack (most recent call first):
  cmake/readline.cmake:127 (FIND_CURSES)
  cmake/readline.cmake:221 (MYSQL_USE_BUNDLED_EDITLINE)
  CMakeLists.txt:1930 (MYSQL_CHECK_EDITLINE)
​
​
-- Configuring incomplete, errors occurred!
See also "/usr/local/src/mysql-8.0.42/CMakeFiles/CMakeOutput.log".
See also "/usr/local/src/mysql-8.0.42/CMakeFiles/CMakeError.log".

安装ncurses-devel:

复制代码
yum install -y ncurses-devel

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
CMake Warning at cmake/rpc.cmake:41 (MESSAGE):
  Cannot find RPC development libraries.  You need to install the required
  packages: # 提示,找不到 RPC 开发库。您需要安装所需的包:
​
    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:2066 (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:2066 (MYSQL_CHECK_RPC)
​
​
-- Configuring incomplete, errors occurred!
See also "/usr/local/src/mysql-8.0.42/CMakeFiles/CMakeOutput.log".
See also "/usr/local/src/mysql-8.0.42/CMakeFiles/CMakeError.log".

安装libtirpc-devel包:

复制代码
yum install -y libtirpc-devel

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
CMake Warning at cmake/rpc.cmake:30 (MESSAGE):
  Cannot find rpcgen executable.  You need to install the required packages: # 提示,找不到 rpcgen 可执行文件。您需要安装所需的软件包:
​
    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!
See also "/usr/local/src/mysql-8.0.42/CMakeFiles/CMakeOutput.log".
See also "/usr/local/src/mysql-8.0.42/CMakeFiles/CMakeError.log".

安装rpcgen包:

复制代码
yum install -y rpcgen

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
# 正常会有类似如下的输出
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/src/mysql-8.0.42

执行make:

go 复制代码
make -j 4 && make install
...
[ 21%] Linking CXX static library libmysqlgcs.a
make[2]: Leaving directory '/usr/local/src/mysql-8.0.42'
[ 21%] Built target mysqlgcs
make[1]: Leaving directory '/usr/local/src/mysql-8.0.42'

在编译参数添加下面内容:

ini 复制代码
-DCMAKE_BUILD_TYPE=RelWithDebInfo

需要重新执行cmake:

ini 复制代码
# 再次执行make之前先清理之前的操作
make clean
​
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1 \
-DCMAKE_BUILD_TYPE=RelWithDebInfo
...
CMake Error at sql/CMakeLists.txt:1313 (MESSAGE):
  Cannot find /usr/local/src/mysql-8.0.42/sql/sql_yacc.h
​
​
-- Configuring incomplete, errors occurred!
See also "/usr/local/src/mysql-8.0.42/CMakeFiles/CMakeOutput.log".
See also "/usr/local/src/mysql-8.0.42/CMakeFiles/CMakeError.log".

需要安装bison包

复制代码
yum -y install bison

需要重新执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1 \
-DCMAKE_BUILD_TYPE=RelWithDebInfo
...
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/src/mysql-8.0.42

重新执行make:

go 复制代码
make -j 4 && make install
...
[ 21%] Built target icui18n
make[1]: Leaving directory '/usr/local/src/mysql-8.0.42'
make: *** [Makefile:163: all] Error 2
​

总结编译过程:

ini 复制代码
# 安装依赖包
yum install -y cmake make gcc gcc-c++ openssl-devel ncurses-devel libtirpc-devel rpcgen
​
# 编译gcc
wget https://mirrors.cloud.tencent.com/gnu/gcc/gcc-11.5.0/gcc-11.5.0.tar.gz
tar xf gcc-11.5.0.tar.gz
cd gcc-11.5.0
./contrib/download_prerequisites
mkdir build
cd build/
../configure --prefix=/usr --disable-multilib
make -j 4 && make install
​
# 进入mysql包解压的目录
cd ../../mysql-8.0.42/
​
# 执行cmake
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
​
# 执行make
make -j 4 && make install
2.4.1.4.9 UOS Server V20

编译安装gcc:

ini 复制代码
[root@uos20 src]# gcc --version
gcc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
​
[root@uos20 src]# g++ --version
g++ (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# MySQL 8.0需要gcc 8或更高版本,gcc和gcc-c++版本过低,需要编译安装gccc
​
# 注意:这里需要编译安装gcc 11,不要装gcc 10,装了gcc 10在登录mysql之后就退出了,报错"Segmentation fault"。
wget https://mirrors.cloud.tencent.com/gnu/gcc/gcc-11.5.0/gcc-11.5.0.tar.gz
tar xf gcc-11.5.0.tar.gz
cd gcc-11.5.0
​
# 下载gcc依赖包
./contrib/download_prerequisites
2025-05-04 11:56:53 URL:https://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 [2383840/2383840] -> "gmp-6.1.0.tar.bz2" [1]
2025-05-04 11:56:56 URL:http://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.6.tar.bz2 [1287202/1287202] -> "mpfr-3.1.6.tar.bz2" [1]
2025-05-04 11:56:59 URL:http://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz [669925/669925] -> "mpc-1.0.3.tar.gz" [1]
2025-05-04 11:57:02 URL:http://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2 [1658291/1658291] -> "isl-0.18.tar.bz2" [1]
gmp-6.1.0.tar.bz2: OK
mpfr-3.1.6.tar.bz2: OK
mpc-1.0.3.tar.gz: OK
isl-0.18.tar.bz2: OK
All prerequisites downloaded successfully.
​
mkdir build
cd build/
​
# 执行configure
../configure --prefix=/usr --disable-multilib
...
configure: creating ./config.status
config.status: creating Makefile
​
# 执行make
make -j 4 && make install
...
make[4]: Nothing to be done for 'install-data-am'.
make[4]: Leaving directory '/usr/local/src/gcc-11.5.0/build/x86_64-pc-linux-gnu/libatomic'
make[3]: Leaving directory '/usr/local/src/gcc-11.5.0/build/x86_64-pc-linux-gnu/libatomic'
make[2]: Leaving directory '/usr/local/src/gcc-11.5.0/build/x86_64-pc-linux-gnu/libatomic'
make[1]: Leaving directory '/usr/local/src/gcc-11.5.0/build'
​
[root@anolis8 build]# gcc --version
gcc (GCC) 11.5.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

进入mysql包解压的目录:

bash 复制代码
cd mysql-8.0.42/

安装cmake包:

复制代码
yum install -y cmake

执行cmake:

ini 复制代码
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
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. # 提示,找不到 Curses 库。请安装合适的软件包,删除 CMakeCache.txt 并重新运行 cmake。在 Debian/Ubuntu 上,包名称是 libncurses5-dev,在 Redhat 及其衍生产品上是 ncurses-devel。
Call Stack (most recent call first):
  cmake/readline.cmake:127 (FIND_CURSES)
  cmake/readline.cmake:221 (MYSQL_USE_BUNDLED_EDITLINE)
  CMakeLists.txt:1930 (MYSQL_CHECK_EDITLINE)
​
​
-- Configuring incomplete, errors occurred!
See also "/usr/local/src/mysql-8.0.42/CMakeFiles/CMakeOutput.log".
See also "/usr/local/src/mysql-8.0.42/CMakeFiles/CMakeError.log".

安装ncurses-devel:

复制代码
yum install -y ncurses-devel

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
CMake Warning at cmake/rpc.cmake:41 (MESSAGE):
  Cannot find RPC development libraries.  You need to install the required
  packages: # 提示,找不到 RPC 开发库。您需要安装所需的包:
​
    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:2066 (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:2066 (MYSQL_CHECK_RPC)
​
​
-- Configuring incomplete, errors occurred!
See also "/usr/local/src/mysql-8.0.42/CMakeFiles/CMakeOutput.log".
See also "/usr/local/src/mysql-8.0.42/CMakeFiles/CMakeError.log".

安装libtirpc-devel包:

复制代码
yum install -y libtirpc-devel

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
CMake Warning at cmake/rpc.cmake:30 (MESSAGE):
  Cannot find rpcgen executable.  You need to install the required packages: # 提示,找不到 rpcgen 可执行文件。您需要安装所需的软件包:
​
    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!
See also "/usr/local/src/mysql-8.0.42/CMakeFiles/CMakeOutput.log".
See also "/usr/local/src/mysql-8.0.42/CMakeFiles/CMakeError.log".

安装rpcgen包:

复制代码
yum install -y rpcgen

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/src/mysql-8.0.42

执行make:

go 复制代码
make -j 4 && make install

总结编译过程:

ini 复制代码
# 安装依赖包
yum install -y cmake ncurses-devel libtirpc-devel rpcgen
​
# 编译gcc
wget https://mirrors.cloud.tencent.com/gnu/gcc/gcc-11.5.0/gcc-11.5.0.tar.gz
tar xf gcc-11.5.0.tar.gz
cd gcc-11.5.0
./contrib/download_prerequisites
mkdir build
cd build/
../configure --prefix=/usr --disable-multilib
make -j 4 && make install
​
# 进入mysql包解压的目录
cd ../../mysql-8.0.42/
​
# 执行cmake
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
​
# 执行make
make -j 4 && make install
2.4.1.4.10 openSUSE 15

进入mysql包解压的目录:

bash 复制代码
cd mysql-8.0.42/

安装cmake包:

复制代码
zypper install -y cmake

执行cmake:

ini 复制代码
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.
​
​
-- Running cmake version 3.28.3
-- Could NOT find Git (missing: GIT_EXECUTABLE) 
-- CMAKE_MODULE_PATH is /usr/local/src/mysql-8.0.42/cmake
-- MySQL 8.0.42
-- 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. # 提示,通过设置环境变量 "CC" 或 CMake 缓存条目CMAKE_C_COMPILER到编译器,或者如果编译器名称在 PATH,需要安装gcc。
​
​
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. # 通过设置环境变量 "CXX" 或 CMake 缓存条目CMAKE_CXX_COMPILER完整路径添加到编译器,或者添加到编译器名称(如果它在 PATH 中),需要安装gcc-c++。
​
​
-- Configuring incomplete, errors occurred!

安装gcc和gcc-c++包:

ini 复制代码
zypper install -y gcc gcc-c++
​
opensuse15:/usr/local/src/mysql-8.0.42 # gcc --version
gcc (SUSE Linux) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
​
opensuse15:/usr/local/src/mysql-8.0.42 # g++ --version
g++ (SUSE Linux) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# MySQL 8.0需要gcc 8或更高版本,gcc和gcc-c++版本过低,需要编译安装gcc

编译安装gcc:

ruby 复制代码
cd ..
​
# 注意:这里需要编译安装gcc 11,不要装gcc 10,装了gcc 10在登录mysql之后就退出了,报错"Segmentation fault"。
wget https://mirrors.cloud.tencent.com/gnu/gcc/gcc-11.5.0/gcc-11.5.0.tar.gz
tar xf gcc-11.5.0.tar.gz
cd gcc-11.5.0
​
# 下载gcc依赖包
./contrib/download_prerequisites
2025-05-04 15:17:24 URL:https://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 [2383840/2383840] -> "gmp-6.1.0.tar.bz2" [1]
2025-05-04 15:17:46 URL:http://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.6.tar.bz2 [1287202/1287202] -> "mpfr-3.1.6.tar.bz2" [1]
2025-05-04 15:18:00 URL:http://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz [669925/669925] -> "mpc-1.0.3.tar.gz" [1]
2025-05-04 15:18:26 URL:http://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2 [1658291/1658291] -> "isl-0.18.tar.bz2" [1]
gmp-6.1.0.tar.bz2: OK
mpfr-3.1.6.tar.bz2: OK
mpc-1.0.3.tar.gz: OK
isl-0.18.tar.bz2: OK
All prerequisites downloaded successfully.
​
mkdir build
cd build/
​
# 执行configure
../configure --prefix=/usr --disable-multilib
...
configure: creating ./config.status
config.status: creating Makefile
​
# 执行make
make -j 4 && make install
...
make[4]: Nothing to be done for 'install-data-am'.
make[4]: Leaving directory '/usr/local/src/gcc-11.5.0/build/x86_64-pc-linux-gnu/libatomic'
make[3]: Leaving directory '/usr/local/src/gcc-11.5.0/build/x86_64-pc-linux-gnu/libatomic'
make[2]: Leaving directory '/usr/local/src/gcc-11.5.0/build/x86_64-pc-linux-gnu/libatomic'
make[1]: Leaving directory '/usr/local/src/gcc-11.5.0/build'
​
opensuse15:/usr/local/src/gcc-11.5.0/build # gcc --version
gcc (GCC) 11.5.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

再次进入mysql包解压的目录:

bash 复制代码
cd ../../mysql-8.0.42/

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
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. # 提示,请安装相应的 openssl 开发人员软件包。
​
Call Stack (most recent call first):
  cmake/ssl.cmake:380 (FATAL_SSL_NOT_FOUND_ERROR)
  CMakeLists.txt:1826 (MYSQL_CHECK_SSL)
​
​
-- Configuring incomplete, errors occurred!

安装libopenssl-devel包:

复制代码
zypper install -y libopenssl-devel

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
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. # 提示,找不到 Curses 库。请安装合适的软件包,删除 CMakeCache.txt 并重新运行 cmake。在 Debian/Ubuntu 上,包名称是 libncurses5-dev,在 Redhat 及其衍生产品上是 ncurses-devel。
Call Stack (most recent call first):
  cmake/readline.cmake:127 (FIND_CURSES)
  cmake/readline.cmake:221 (MYSQL_USE_BUNDLED_EDITLINE)
  CMakeLists.txt:1930 (MYSQL_CHECK_EDITLINE)
​
​
-- Configuring incomplete, errors occurred!

安装ncurses-devel:

复制代码
zypper install -y ncurses-devel

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
CMake Warning at cmake/rpc.cmake:41 (MESSAGE):
  Cannot find RPC development libraries.  You need to install the required
  packages: # 提示,找不到 RPC 开发库。您需要安装所需的包:
​
    Debian/Ubuntu:              apt install libtirpc-dev
    RedHat/Fedora/Oracle Linux: yum install libtirpc-devel
    SuSE:                       zypper install glibc-devel # 注意,它提示安装的这个包是不行的,要安装libtirpc-devel
​
Call Stack (most recent call first):
  cmake/rpc.cmake:112 (WARN_MISSING_SYSTEM_TIRPC)
  CMakeLists.txt:2066 (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:2066 (MYSQL_CHECK_RPC)
​
​
-- Configuring incomplete, errors occurred!

安装libtirpc-devel包:

复制代码
zypper install -y libtirpc-devel

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
CMake Warning at cmake/rpc.cmake:30 (MESSAGE):
  Cannot find rpcgen executable.  You need to install the required packages: # 提示,找不到 rpcgen 可执行文件。您需要安装所需的软件包:
​
    Debian/Ubuntu:              apt install rpcsvc-proto
    RedHat/Fedora/Oracle Linux: yum install rpcgen
    SuSE:                       zypper install glibc-devel # 注意,它提示安装的这个包是不行的,要安装rpcgen
​
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包:

复制代码
zypper install -y rpcgen

继续执行cmake:

ini 复制代码
# 再次执行cmake之前先删除"CMakeCache.txt"文件
rm -f CMakeCache.txt
​
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
...
-- Configuring done (32.6s)
-- Generating done (2.1s)
-- Build files have been written to: /usr/local/src/mysql-8.0.42

执行make:

go 复制代码
make -j 4 && make install

总结编译过程:

ini 复制代码
# 安装依赖包
zypper install -y cmake gcc gcc-c++ libopenssl-devel ncurses-devel libtirpc-devel rpcgen
​
# 编译gcc
wget https://mirrors.cloud.tencent.com/gnu/gcc/gcc-11.5.0/gcc-11.5.0.tar.gz
tar xf gcc-11.5.0.tar.gz
cd gcc-11.5.0
./contrib/download_prerequisites
mkdir build
cd build/
../configure --prefix=/usr --disable-multilib 
make -j 4 && make install
​
# 进入mysql包解压的目录
cd ../../mysql-8.0.42/
​
# 执行cmake
cmake \
-DCMAKE_INSTALL_PREFIX=/apps/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/apps/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DWITH_BOOST=/usr/local/src/mysql-8.0.42/boost/boost_1_77_0/ \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_SYSTEMD=1
​
# 执行make
make -j 4 && make install
相关推荐
朱包林13 分钟前
数据库服务-日志管理-备份与恢复-主从同步
linux·运维·服务器·数据库·mysql·云计算
她说人狗殊途13 分钟前
MySQL事务ACID特性
数据库·mysql
btyzadt13 分钟前
记一次MySQL数据库的操作练习
数据库·mysql·oracle
李法师_24 分钟前
lwIP MQTT 心跳 Bug 分析与修复
linux·c语言·stm32·单片机·lwip
友莘居士2 小时前
Logstash数据迁移之mysql-to-kafka.conf两种路由决策对比
mysql·kafka·logstash·路由决策
超级大坏蛋20182 小时前
QT .pro文件的常见用法
java·linux·qt
我好饿14 小时前
Linux入门教程 第十五章 Linux 系统调优工具
linux·运维·网络
萌虎爱分享4 小时前
Linux 防火墙 (firewalld) 管理完整指南
linux·运维·防火墙·firewalld
mCell8 小时前
Docker 进阶教程
运维·docker·容器
mCell8 小时前
Docker 入门教程
运维·docker·操作系统