CentOS6.5下如何编译Ceph源码

发布时间:2021-11-15 15:55:24 作者:小新
来源:亿速云 阅读:183

这篇文章将为大家详细讲解有关CentOS6.5下如何编译Ceph源码,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

引言

ceph源码编译不是一件很容易的事情,中间报了很多错误,比如对C++11的依赖,对BOOST的依赖以及大量其他库的依赖,这些过程都要一一解决。本文对编译的过程进行了一个详细的说明,并对碰到的问题进行了记录。

具体过程
 

1. 源码下载

git clone https://github.com/ceph/ceph

2. 编译

./autogen.sh
./configure

环境检查的过程中报如下错误

CentOS6.5下如何编译Ceph源码
 

系统报错,缺少C++11的支持。需要升级GCC版本以支持C++11。 我咨询过使用CentOS7系列的同学,他们自带的GCC是高版本的,可以支持C++11.

3. GCC c++11支持
 

wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.1/gcc-4.8.1.tar.gz
tar xzf gcc-4.8.1.tar.gz  
cd gcc-4.8.1  
./contrib/download_prerequisites    //安装依赖库
cd ..  
mkdir build_gcc4.8.1
cd build_gcc4.8.1
../configure --prefix=/usr  -enable-checking=release --enable-languages=c,c++ --disable-multilib
make -j8
sudo make install

4. 编译Ceph源码
编译的过程中同样出现了很多问题

configure: error: in `/home/ceph/ceph-src/ceph':
configure: error: libsnappy not found
See `config.log' for more details.
------------------------------------------------------------------------------------

configure: error: in `/home/ceph/ceph-src/ceph':
configure: error: libleveldb not found
See `config.log' for more details.
-------------------------------------------------------------------------------------
checking blkid/blkid.h usability... no
checking blkid/blkid.h presence... no
checking for blkid/blkid.h... no
configure: error: blkid/blkid.h not found (libblkid-dev, libblkid-devel)
-------------------------------------------------------------------------------------
checking libudev.h usability... no
checking libudev.h presence... no
checking for libudev.h... no
configure: error: libudev.h not found (libudev-dev, libudev-devel)
-------------------------------------------------------------------------------------
checking for malloc in -ltcmalloc... no
configure: error: in `/home/ceph/ceph-src/ceph':
configure: error: no tcmalloc found (use --without-tcmalloc to disable)
-------------------------------------------------------------------------------------
checking for FCGX_Init in -lfcgi... no
checking for LIBFUSE... yes
checking atomic_ops.h usability... no
checking atomic_ops.h presence... no
checking for atomic_ops.h... no
configure: error: in `/home/ceph/ceph-src/ceph':
configure: error: no libatomic-ops found (use --without-libatomic-ops to disable)
See `config.log' for more details.
-------------------------------------------------------------------------------------
checking xfs/xfs.h usability... no
checking xfs/xfs.h presence... no
checking for xfs/xfs.h... no
configure: error: xfs/xfs.h not found (--without-libxfs to disable)
----------------------------------------------------------------------------------------
Boost random library not found.

..........................................


主要采用如下办法解决

4.1先把能安装的依赖包给安装

sudo yum install make automake autoconf  boost-devel fuse-devel gcc-c++ libtool libuuid-devel libblkid-devel keyutils-libs-devel cryptopp-devel fcgi-devel libcurl-devel expat-devel gperftools-devel libedit-devel libatomic_ops-devel snappy-devel leveldb-devel libaio-devel xfsprogs-devel git libudev-devel libcrypto++-dev libcrypto++-utils

4.2 yum找不到,手工rpm安装

4.3 部分包不需要,直接without

./configure  --without-tcmalloc  --without-libatomic-ops

4.4 BOOST 库缺失问题 

最后一个问题就是boost random lib can not found问题

yum显示boost 和boost dev都有安装,为什么boost库有一部分存在,有一部分没有呢。无奈之下采用编译boost源码的方法重装BOOST

[root@gnop029-ct-zhejiang_wenzhou-16-12 home]# ls
boost_1_59_0  boost_1_59_0.tar.gz  c11  ceph  ceph.log  civetweb  dlftp  gcc4.7_build.tar.bz2  gcc-4.8.1  gcc-4.8.1.tar.bz2  usr  wget-log

 ./bootstrap.sh
 ./bjam -sTOOLS=gcc install


 

5 最后对ceph源码进行

./autogen.sh
./configure
make

此处同样出现了很多问题,编译过程中出现了大量undefined reference boost库的情况。

CentOS6.5下如何编译Ceph源码
 

但是我在/usr/local/中可以找到boost的头文件以及二进制库。
 于是追查makefile文件,发现其中涉及到的BOOST库内容如下:

BOOST_PROGRAM_OPTIONS_LIBS = -lboost_program_options-mt 
BOOST_RANDOM_LIBS = -lboost_random 
BOOST_REGEX_LIBS = -lboost_regex-mt 
BOOST_THREAD_LIBS = -lboost_thread-mt

于是去相关路径下找库,发现regex,thread库后面都是没有-mt后缀的
CentOS6.5下如何编译Ceph源码


上网查资料发现,带mt和不带mt,分别意味这对多线程的支持。不禁让我想到在WINDOWS 平台下开发时,在VS2010下进行项目配置时,同样会涉及到对运行时库配置时,也有mutlithread版本的。应是类似道理。于是我对boost进行了重新编译。

./bjam --TOOLS=gcc  --build-type=complete  --layout=tagged  install


用complete的模式进行编译,在相关路径下可以发现对应的二进制文件:可以发现采用新模式编译后,很多库的release版本,debug版本,多线程支持版本都编译出来了,想用哪个用那个。

CentOS6.5下如何编译Ceph源码


 

最后,重复步骤5,编译ceph.


------------------------------------------------------------------------------------------------------------

在后来的编译中,mon,osd,mds等等都编译成功,却发现rgw没有编译出来。通过显示的增加
./configure --with-radosgw,得知了错误,是缺少fcgi的相关依赖。但是系统中已经安装fcgi于是清理重装。

[root@gnop029-ct-zhejiang_wenzhou-16-12 yum.repos.d]# sudo yum install fcgi-devel

58 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package fcgi-devel.x86_64 0:2.4.0-12.el6 will be installed
--> Processing Dependency: fcgi = 2.4.0-12.el6 for package: fcgi-devel-2.4.0-12.el6.x86_64
--> Processing Dependency: libfcgi.so.0()(64bit) for package: fcgi-devel-2.4.0-12.el6.x86_64
--> Processing Dependency: libfcgi++.so.0()(64bit) for package: fcgi-devel-2.4.0-12.el6.x86_64
--> Running transaction check
---> Package fcgi.x86_64 0:2.4.0-10.el6 will be installed
---> Package fcgi-devel.x86_64 0:2.4.0-12.el6 will be installed
--> Processing Dependency: fcgi = 2.4.0-12.el6 for package: fcgi-devel-2.4.0-12.el6.x86_64
--> Finished Dependency Resolution
Error: Package: fcgi-devel-2.4.0-12.el6.x86_64 (epel)
           Requires: fcgi = 2.4.0-12.el6
           Available: fcgi-2.4.0-10.el6.x86_64 (Ceph)
               fcgi = 2.4.0-10.el6
Error: Package: fcgi-devel-2.4.0-12.el6.x86_64 (epel)
           Requires: fcgi = 2.4.0-12.el6
           Installing: fcgi-2.4.0-10.el6.x86_64 (Ceph)
               fcgi = 2.4.0-10.el6
 You could try using --skip-broken to work around the problem


将yum.repo.d文件夹下所有的repo文件删除,只保留163的源,重新更新fcgi。后来编译的过程中又提示

rgw/rgw_fcgi.cc:10:22: fatal error: fcgiapp.h: No such file or directory
 # include "fcgiapp.h"
                      ^
compilation terminated.

于是又安装fcgi-devel,后成功找到头文件,并进行编译。


关于“CentOS6.5下如何编译Ceph源码”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。

推荐阅读:
  1. Thrift 源码编译
  2. Centos6.5 下php5.6.2的编译安装方法

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

ceph centos6.5

上一篇:Redis如何实现订阅发布与批量发送短信

下一篇:centos6.5中如何使用NAT方式连接网络

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》