ceph编译

背景

想要修改或者调试ceph代码,编译代码是少不了的。一些升级工作,也是需要替换二进制,从而需要编译。

步骤do_cmake.sh

1 首先下载代码

参考https://github.com/ceph/ceph,切到你想要的分支,这里我想编译14.2.22,因此运行git checkout v14.2.22。注意这里代码下载要包含各个子模块git submodule update --init --recursive, 可能需要翻墙。 按理也可以通过tarball下载,参考https://download.ceph.com/tarballs/, 这里tarball用来制作rpm包。

2 编译

参考官网 https://docs.ceph.com/en/nautilus/install/build-ceph/编译步骤,按理是比较简单的,这里遇到几个问题。

2.1 python-scipy问题 (针对14.2.22)

参考python-scipy, 需要判断scipy

# diff ceph.spec.in ceph.spec.org (针对14.2.22)
299,303c299
< %if 0%{without python2}
< BuildRequires:       python3-scipy
< %else
< BuildRequires:       python27-scipy
< %endif
---
> BuildRequires:  python%{_python_buildid}-scipy

2.2 gcc 版本问题

参考 升级gcc, 因为c++17,需要升级gcc7, 需要升级gcc。。

2.3 Can't find sphinx-build.

解决办法:
yum install python-sphinx

2.4 systemed-sysusers依赖问题

添加skip-broken,参考下图


image.png

2.5 编译错误googletest

有人提交了解决方案,参考https://github.com/ceph/ceph/pull/43491/files

2.6 Could NOT find verbs (missing: VERBS_LIBRARIES VERBS_INCLUDE_DIR)

解决办法:
yum install rdma-core-devel

2.7 Could NOT find udev (missing: UDEV_LIBRARIES UDEV_INCLUDE_DIR)

解决办法:
yum install systemd-devel

2.8 Could NOT find blkid (missing: BLKID_LIBRARIES BLKID_INCLUDE_DIR)

解决办法:
yum install libblkid-devel

2.9 Could NOT find keyutils (missing: KEYUTILS_LIBRARIES KEYUTILS_INCLUDE_DIR)

yum install keyutils-libs-devel

2.10 Could NOT find OpenLdap (missing: OPENLDAP_INCLUDE_DIR LDAP_LIBRARY

yum install openldap-devel

2.11 Could NOT find leveldb (missing: LEVELDB_LIBRARIES LEVELDB_INCLUDE_DIR)

yum install leveldb-devel

2.12 Could NOT find snappy (missing: SNAPPY_LIBRARIES SNAPPY_INCLUDE_DIR)

yum install snappy-devel

2.13 Could NOT find LZ4 (missing: LZ4_LIBRARY LZ4_INCLUDE_DIR) (Required is at

least version "1.7")
yum install lz4-devel

2.14 12.Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)

yum install curl-devel

2.15 no package nss found

yum install nss-devel.x86_64

2.16 PythonLibs

yum install python-devel.x86_64

2.17

yum install Cython.x86_64
yum install ncurses-devel

2.15 其它

yum install libaio-devel openssl-devel expat-devel liboath-devel lttng-ust-devel libbabeltrace-devel python36-Cython fuse-devel libnl3-devel librabbitmq-devel libcap-ng-devel gperf librabbitmq-devel librdkafka-devel nss

2.16 需要使用vscode的,要在CMakelist.txt的这个位置上加上CMAKE_EXPORT_COMPILE_COMMANDS

set(VERSION 14.2.16)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

2.7 最后编译rpm有几个问题

参考http://strugglesquirrel.com/2019/01/03/%E6%89%8B%E5%8A%A8%E7%BC%96%E8%AF%91ceph/, 这里面都有说明,不再详述

步骤build (14.2.16)

参考:
[1] https://blog.csdn.net/helloanthea/article/details/103728684

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容