千家信息网

CentOS6.5下如何编译Ceph源码

发表于:2026-11-02 作者:千家信息网编辑
千家信息网最后更新 2026年11月02日,这篇文章将为大家详细讲解有关CentOS6.5下如何编译Ceph源码,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。引言ceph源码编译不是一件很容易的事情,中间报了
千家信息网最后更新 2026年11月02日CentOS6.5下如何编译Ceph源码

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

引言

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

具体过程

1. 源码下载

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

2. 编译

./autogen.sh./configure

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


系统报错,缺少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.1cd build_gcc4.8.1../configure --prefix=/usr  -enable-checking=release --enable-languages=c,c++ --disable-multilibmake -j8sudo make install

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

configure: error: in `/home/ceph/ceph-src/ceph':configure: error: libsnappy not foundSee `config.log' for more details.------------------------------------------------------------------------------------configure: error: in `/home/ceph/ceph-src/ceph':configure: error: libleveldb not foundSee `config.log' for more details.-------------------------------------------------------------------------------------checking blkid/blkid.h usability... nochecking blkid/blkid.h presence... nochecking for blkid/blkid.h... noconfigure: error: blkid/blkid.h not found (libblkid-dev, libblkid-devel)-------------------------------------------------------------------------------------checking libudev.h usability... nochecking libudev.h presence... nochecking for libudev.h... noconfigure: error: libudev.h not found (libudev-dev, libudev-devel)-------------------------------------------------------------------------------------checking for malloc in -ltcmalloc... noconfigure: error: in `/home/ceph/ceph-src/ceph':configure: error: no tcmalloc found (use --without-tcmalloc to disable)-------------------------------------------------------------------------------------checking for FCGX_Init in -lfcgi... nochecking for LIBFUSE... yeschecking atomic_ops.h usability... nochecking atomic_ops.h presence... nochecking for atomic_ops.h... noconfigure: 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... nochecking xfs/xfs.h presence... nochecking for xfs/xfs.h... noconfigure: 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]# lsboost_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./configuremake

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


但是我在/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后缀的


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

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


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



最后,重复步骤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-devel58 packages excluded due to repository priority protectionsResolving 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 ResolutionError: 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.el6Error: 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源码"这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。

编译 源码 过程 文件 版本 问题 支持 篇文章 错误 二进制 更多 模式 系统 线程 路径 配置 不错 实用 成功 不禁 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 互联网科技巨头监管 科技与互联网 河南真二互联网科技有限公司 齐家互联网科技有限公司 科技类的互联网平台 联恩商钥互联网科技有限公司 科技与互联网的利与弊 允成互联网科技有限公司融资 如何创新互联网科技 华夏恒生互联网科技013171 互联网科技的全部知识 南博望互联网科技有限公司 互联网金融科技元年 雨阳互联网卡科技有限公司 江苏互联网智能科技软件 互联网与数字科技关系 互联网领先科技活动 绵阳真晨互联网科技有限公司 互联网科技创新方面的资料 互联网科技快速发展优美句子 没上市的科技互联网公司 善班互联网科技有限公司 广州凡科互联网科技 宁夏众和广鑫互联网科技有限公司 互联网对科技的发展 深圳互联网科技的发展 广州梦谷互联网科技有限公司领导 上海万顺科技互联网有限公司招聘 互联网科技收购价值 小牛互联网科技有限公司地址
0