cmake编译问题解决

简介: <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。
3862 0
|
Android开发
我的Android进阶之旅------&gt;adbd cannot run as root in production builds 的解决方法
今天用adb root命令时候,报了错误:adbd cannot run as root in production builds C:\Documents and Settings\Administrator>adb root adbd cannot ...
5523 0
|
7月前
|
人工智能 前端开发 API
【cursor】前后端分离项目下的AI跨工程管理方案
针对前后端分离项目中AI编辑器难以跨工程协作的问题,提出通过统一文件夹管理方案,将前端与后端项目置于同一根目录下,利用AI编辑器打开根目录并结合@引用功能,实现对前后端代码的联合理解与开发,提升联调效率与代码生成准确性。
1669 0
|
移动开发 前端开发 API
鸿蒙H5离线包技术分享
鸿蒙H5离线包技术分享:本文基于鸿蒙NEXT Api 12,介绍H5离线包的下载、解压和加载三大核心问题。下载部分支持进度回调与重复下载;解压使用minizip实现并提供进度反馈;加载本地H5页面时处理本地资源与网页跳转,确保无网环境下H5页面正常显示。
613 0
|
Ubuntu Shell
【Ubuntu系统】三步更新自己的Cmake最新版本
Ubuntu系统中通过三步简单流程更新Cmake到最新版本的具体操作方法,包括卸载旧版本、下载并运行安装脚本以及创建软链接。
4666 1
|
域名解析 网络协议 关系型数据库
网站打不开数据库错误等常见问题解决方法合集
网站打不开数据库错误等常见问题解决方法合集
|
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
8035 4
|
存储 算法 网络安全
|
Python
求解带有限重的三维装箱问题——启发式深度优先搜索算法
求解带有限重的三维装箱问题——启发式深度优先搜索算法
569 4