cmake编译问题解决

本文涉及的产品
RDS AI 助手,专业版
RDS MySQL DuckDB 分析主实例,集群系列 4核8GB
简介: <p><br></p> <p></p> <p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; font-family:Arial; font-size:14px; line-height:26px"> <strong>2 安装cmake软件包</strong><br> yu


2 安装cmake软件包
yum install cmake

3 create account of mysql
groupadd mysql           
useradd -g mysql mysql           
autoreconf --force --install
libtoolize --automake --force
automake --force --add-missing


4  complie the sources
mkdir -p /data/mbdata
tar -xvf mysql-5.6.13.tar.gz 


5 cmake

 time cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql56 -DMYSQL_DATADIR=/data56 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR==/data56/mysql.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci

[root@472322 mysql-5.6.13]# time cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql56 -DMYSQL_DATADIR=/data56 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR==/data56/mysql.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
-- Running cmake version 2.6.4
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 Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:/root/mysql-5.6.13/CMakeFiles/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:/root/mysql-5.6.13/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!


real    0m0.017s
user    0m0.006s
sys     0m0.005s


6 上一步cmake报错了,google得知需要重新yum make下

yum install make
ok


再继续去cmake
[root@472322 mysql-5.6.13]# time cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql56 -DMYSQL_DATADIR=/data56 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR==/data56/mysql.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
-- Running cmake version 2.6.4
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error: your C compiler: "CMAKE_C_COMPILER-NOTFOUND" was not found.   Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found.   Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
-- Searching 16 bit integer
CMake Error at /usr/share/cmake/Modules/TestBigEndian.cmake:31 (MESSAGE):
  no suitable type found
Call Stack (most recent call first):
  configure.cmake:621 (TEST_BIG_ENDIAN)
  CMakeLists.txt:314 (INCLUDE)

这个错误很诡异,google上面有很多,但是每种情况都不同,我只好一个个去try了

-- Configuring incomplete, errors occurred!

报错如下: CMake Error: your C compiler: "CMAKE_C_COMPILER-NOTFOUND" was not found.
 没有安装 gcc 和 gcc-c++,执行cmake报如上错误:
 第一次尝试,执行
yum install -y gcc
yum install -y gcc-c++


7  继续cmake

time cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql56 -DMYSQL_DATADIR=/data56 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR==/data56/mysql.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci


-- Searching 16 bit integer
CMake Error at /usr/share/cmake/Modules/TestBigEndian.cmake:31 (MESSAGE):
  no suitable type found
Call Stack (most recent call first):
  configure.cmake:621 (TEST_BIG_ENDIAN)
  CMakeLists.txt:314 (INCLUDE)
-- Configuring incomplete, errors occurred!

第二次尝试,有人说需要安装至少5种包
[root@472322 mysql-5.6.13]# 
yum install gcc gcc-c++
    yum install -y ncurses-devel.x86_64
    yum install -y cmake.x86_64
    yum install -y libaio.x86_64
    yum install -y bison.x86_64
yum install -y gcc-c++.x86_64

然后再cmake,还是报原来的错误


最后决定用土办法了,删除所有的已经安装过的,重新再来做一遍吧。

[解决办法]:删除原来的mysql-5.6.13目录,重新解压缩tar.gz包

rm -rf /root/mysql-5.6.13
cd /root/
tar -xvf mysql-5.6.13.tar.gz 
cd /root/mysql-5.6.13
time cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql56 -DMYSQL_DATADIR=/data56 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR==/data56/mysql.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci

OK,成功了,对linux底层不太熟悉,难道是因为前面没有事先安装好各种包而cmake出来错误的东西导致后面继续cmake就一直报错吗? 是否是需要准备好各种lib包然后才能yum install cmake呢?然后再安装mysql才能不报错呢?



8 build the db directy
time make 
time make install


9 init db
ll /usr/local/mysql56/
cd /usr/local/mysql56/
chown -R mysql .
chgrp -R mysql .
cp support-files/my-default.cnf /etc/my56.cnf
scripts/mysql_install_db  --user=mysql --basedir=/usr/local/mysql56 --datadir=/data56 --defaults-file=/etc/my56.cnf
[root@472322 mysql56]# scripts/mysql_install_db  --user=mysql --basedir=/usr/local/mysql56 --datadir=/data56 --defaults-file=/etc/my56.cnf


  /usr/local/mysql56/bin/mysqladmin -u root password 'new-password'
  /usr/local/mysql56/bin/mysqladmin -u root -h 472322.ea.com password 'new-password'


Alternatively you can ru
--defaults-file argument to mysqld_safe when starting the server

感到信息有warning,那就重新再执行一遍,原来在做5.6.10安装测试的时候,init db不管第一次执行失败或者成功,都可以再执行第二遍的。


相关实践学习
每个IT人都想学的“Web应用上云经典架构”实战
本实验从Web应用上云这个最基本的、最普遍的需求出发,帮助IT从业者们通过“阿里云Web应用上云解决方案”,了解一个企业级Web应用上云的常见架构,了解如何构建一个高可用、可扩展的企业级应用架构。
MySQL数据库入门学习
本课程通过最流行的开源数据库MySQL带你了解数据库的世界。 &nbsp; 相关的阿里云产品:云数据库RDS MySQL 版 阿里云关系型数据库RDS(Relational Database Service)是一种稳定可靠、可弹性伸缩的在线数据库服务,提供容灾、备份、恢复、迁移等方面的全套解决方案,彻底解决数据库运维的烦恼。 了解产品详情:&nbsp;https://www.aliyun.com/product/rds/mysql&nbsp;
目录
相关文章
|
网络协议 Linux
Centos IP、DNS设置
1、CentOS 修改DNS 修改对应网卡的DNS的配置文件# vi /etc/resolv.conf 修改以下内容 nameserver 8.8.8.8 #google域名服务器nameserver 8.8.4.4 #google域名服务器2、CentOS 修改网关 修改对应网卡的网关的配置文件[root@centos]# vi /etc/sysconfig/network 修改以下内容NETWORKING=yes(表示系统是否使用网络,一般设置为yes。
3550 0
用IAR打开STM8时,出现“Unable to create configuration 'Debug' using tool chain ‘STM8’
用IAR打开STM8时,出现“Unable to create configuration 'Debug' using tool chain ‘STM8’
783 0
|
机器学习/深度学习 人工智能 自然语言处理
全新开源通义千问Qwen3上架阿里云百炼
Qwen3是Qwen系列大型语言模型的最新成员,作为混合推理模型,其旗舰版本Qwen3-235B-A22B在代码、数学和通用能力测试中表现出色,与顶级模型DeepSeek-R1、o1、o3-mini等相比具有竞争力。小型MoE模型Qwen3-30B-A3B激活参数仅为QwQ-32B的10%,性能更优,甚至小规模模型Qwen3-4B也能匹敌Qwen2.5-72B-Instruct。Qwen3支持思考与非思考两种模式,可根据任务需求灵活调整推理深度,并支持119种语言,Qwen3在推理、工具调用及多语言处理等方面显著提升,目前已开源并在阿里云百炼平台上线,提供便捷体验。
3971 0
|
域名解析 网络协议 关系型数据库
网站打不开数据库错误等常见问题解决方法合集
网站打不开数据库错误等常见问题解决方法合集
|
Linux Windows
Installing, this may take a few minutes...WslRegisterDistribution failed with error: 0x80370114Err
Installing, this may take a few minutes...WslRegisterDistribution failed with error: 0x80370114Err
5358 3
|
设计模式 算法 Java
go语言进阶篇——面向对象(一)
go语言进阶篇——面向对象(一)
254 0
go语言进阶篇——面向对象(一)
|
算法 新能源
Simulink|【免费】虚拟同步发电机(VSG)惯量阻尼自适应控制仿真模型
Simulink|【免费】虚拟同步发电机(VSG)惯量阻尼自适应控制仿真模型
报错:cannot read properties of undefined(reading ‘forEach‘)
报错:cannot read properties of undefined(reading ‘forEach‘)
1327 1
报错:cannot read properties of undefined(reading ‘forEach‘)
Centos7.6 cmake版本升级至3.21.0
Centos7.6 cmake版本升级至3.21.0
1024 0
|
Ubuntu Linux 开发工具
【Matter】esp-matter环境下的应用实践(程序烧录及串口监视)
【Matter】esp-matter环境下的应用实践(程序烧录及串口监视)
573 0