
MySQL 8.0.16以上版本是C++14标准,编译安装时需gcc 5.3以上版本。本人在结合cmake编译工具的情况下,经过多版本测试,gcc版本10.2.1是最好的选择,同时cmake的版本为3.19.8。
下面是在测试过程中遇到的错误信息详情。
1.使用gcc9.3.1时,cmake版本不能超过3.19.0
## 若使用3.19.1-3.19.8版本的cmake,就会出现如下的错误信息,无法完成编译。错误信息中已提示找不到gcc 10编译器
Could not find devtoolset compiler in /opt/rh/devtoolset-10
## 若使用3.20.x版本的cmake,则会出现如下的错误信息,无法完成编译。错误信息中也提示找不到gcc 10编译器

2.使用gcc10.2.1时,cmake最好不要使用3.20.x版本,使用3.20.x版本会出现Warning提示(如下所示),但能完成cmake配置,也能完成MySQL的安装,简单测试使用也无问题。MySQL后续使用中是否会出现问题不知道。个人提议在安装过程中尽量避免出现一些不正常的提示信息。
-- Running cmake version 3.20.1
-- Found Git: /bin/git (found version "1.8.3.1")
CMake Deprecation Warning at cmake/cmake_policies.cmake:54 (CMAKE_POLICY):
The OLD behavior for policy CMP0075 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
CMakeLists.txt:233 (INCLUDE)
-- CMP0073 OLD
CMake Deprecation Warning at cmake/cmake_policies.cmake:62 (CMAKE_POLICY):
The OLD behavior for policy CMP0073 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
CMakeLists.txt:233 (INCLUDE)
-- This is .el7. as found from 'rpm -qf /'
-- Looking for a devtoolset compiler
-- Using /opt/rh/devtoolset-10/root/usr/bin/gcc
-- Using /opt/rh/devtoolset-10/root/usr/bin/g++

