您好,登錄后才能下訂單哦!
這篇文章將為大家詳細(xì)講解有關(guān)CentOS6.5下如何編譯Ceph源碼,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
引言
ceph源碼編譯不是一件很容易的事情,中間報(bào)了很多錯(cuò)誤,比如對(duì)C++11的依賴,對(duì)BOOST的依賴以及大量其他庫(kù)的依賴,這些過(guò)程都要一一解決。本文對(duì)編譯的過(guò)程進(jìn)行了一個(gè)詳細(xì)的說(shuō)明,并對(duì)碰到的問(wèn)題進(jìn)行了記錄。
具體過(guò)程
1. 源碼下載
git clone https://github.com/ceph/ceph
2. 編譯
./autogen.sh ./configure
環(huán)境檢查的過(guò)程中報(bào)如下錯(cuò)誤
系統(tǒng)報(bào)錯(cuò),缺少C++11的支持。需要升級(jí)GCC版本以支持C++11。 我咨詢過(guò)使用CentOS7系列的同學(xué),他們自帶的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 //安裝依賴庫(kù) 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源碼
編譯的過(guò)程中同樣出現(xiàn)了很多問(wèn)題
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 庫(kù)缺失問(wèn)題
最后一個(gè)問(wèn)題就是boost random lib can not found問(wèn)題
yum顯示boost 和boost dev都有安裝,為什么boost庫(kù)有一部分存在,有一部分沒(méi)有呢。無(wú)奈之下采用編譯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 最后對(duì)ceph源碼進(jìn)行
./autogen.sh ./configure make
此處同樣出現(xiàn)了很多問(wèn)題,編譯過(guò)程中出現(xiàn)了大量undefined reference boost庫(kù)的情況。
但是我在/usr/local/中可以找到boost的頭文件以及二進(jìn)制庫(kù)。
于是追查makefile文件,發(fā)現(xiàn)其中涉及到的BOOST庫(kù)內(nèi)容如下:
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
于是去相關(guān)路徑下找?guī)?,發(fā)現(xiàn)regex,thread庫(kù)后面都是沒(méi)有-mt后綴的
上網(wǎng)查資料發(fā)現(xiàn),帶mt和不帶mt,分別意味這對(duì)多線程的支持。不禁讓我想到在WINDOWS 平臺(tái)下開發(fā)時(shí),在VS2010下進(jìn)行項(xiàng)目配置時(shí),同樣會(huì)涉及到對(duì)運(yùn)行時(shí)庫(kù)配置時(shí),也有mutlithread版本的。應(yīng)是類似道理。于是我對(duì)boost進(jìn)行了重新編譯。
./bjam --TOOLS=gcc --build-type=complete --layout=tagged install
用complete的模式進(jìn)行編譯,在相關(guān)路徑下可以發(fā)現(xiàn)對(duì)應(yīng)的二進(jìn)制文件:可以發(fā)現(xiàn)采用新模式編譯后,很多庫(kù)的release版本,debug版本,多線程支持版本都編譯出來(lái)了,想用哪個(gè)用那個(gè)。
最后,重復(fù)步驟5,編譯ceph.
------------------------------------------------------------------------------------------------------------
在后來(lái)的編譯中,mon,osd,mds等等都編譯成功,卻發(fā)現(xiàn)rgw沒(méi)有編譯出來(lái)。通過(guò)顯示的增加
./configure --with-radosgw,得知了錯(cuò)誤,是缺少fcgi的相關(guān)依賴。但是系統(tǒng)中已經(jīng)安裝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。后來(lái)編譯的過(guò)程中又提示
rgw/rgw_fcgi.cc:10:22: fatal error: fcgiapp.h: No such file or directory # include "fcgiapp.h" ^ compilation terminated.
于是又安裝fcgi-devel,后成功找到頭文件,并進(jìn)行編譯。
關(guān)于“CentOS6.5下如何編譯Ceph源碼”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。