ceph16.2.5编译

ceph 16.25工程管理脚本用了dnf和dnf-utlis,centos(软件库比较老)安装部署比较麻烦,所以最好用最新的fedora做编译环境。

Checking out the source

You can clone from github with

git clone [email protected]:ceph/ceph

or, if you are not a github user,

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

Ceph contains many git submodules that need to be checked out with

git submodule update --init --recursive

Build Prerequisites

The list of Debian or RPM packages dependencies can be installed with:

./install-deps.sh

[root@localhost ceph]# ./install-deps.sh
Using dnf to install dependencies
Last metadata expiration check: 0:22:34 ago on Thu Nov 18 19:25:30 2021.
No match for argument: dnf-utils
Error: Unable to find a match: dnf-utils

 

rpm -iUvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y update

Building Ceph

Note that these instructions are meant for developers who are compiling the code for development and testing. To build binaries suitable for installation we recommend you build deb or rpm packages or refer to the ceph.spec.in or debian/rules to see which configuration options are specified for production builds.

Build instructions:

./do_cmake.sh
cd build
ninja

(do_cmake.sh now defaults to creating a debug build of ceph that can be up to 5x slower with some workloads. Please pass "-DCMAKE_BUILD_TYPE=RelWithDebInfo" to do_cmake.sh to create a non-debug release.

The number of jobs used by ninja is derived from the number of CPU cores of the building host if unspecified. Use the -j option to limit the job number if the build jobs are running out of memory. On average, each job takes around 2.5GiB memory.)

This assumes you make your build dir a subdirectory of the ceph.git checkout. If you put it elsewhere, just point CEPH_GIT_DIR to the correct path to the checkout. Any additional CMake args can be specified by setting ARGS before invoking do_cmake. See cmake options for more details. Eg.

ARGS="-DCMAKE_C_COMPILER=gcc-7" ./do_cmake.sh

To build only certain targets use:

ninja [target name]

To install:

ninja install

CMake Options

If you run the cmake command by hand, there are many options you can set with "-D". For example, the option to build the RADOS Gateway is defaulted to ON. To build without the RADOS Gateway:

cmake -DWITH_RADOSGW=OFF [path to top-level ceph directory]

Another example below is building with debugging and alternate locations for a couple of external dependencies:

cmake -DLEVELDB_PREFIX="/opt/hyperleveldb" \
-DCMAKE_INSTALL_PREFIX=/opt/ceph -DCMAKE_C_FLAGS="-Og -g3 -gdwarf-4" \
..

To view an exhaustive list of -D options, you can invoke cmake with:

cmake -LH

If you often pipe ninja to less and would like to maintain the diagnostic colors for errors and warnings (and if your compiler supports it), you can invoke cmake with:

cmake -DDIAGNOSTICS_COLOR=always ...

Then you'll get the diagnostic colors when you execute:

ninja | less -R

Other available values for 'DIAGNOSTICS_COLOR' are 'auto' (default) and 'never'.

Building a source tarball

To build a complete source tarball with everything needed to build from source and/or build a (deb or rpm) package, run

./make-dist

This will create a tarball like ceph-$version.tar.bz2 from git. (Ensure that any changes you want to include in your working directory are committed to git.)

Running a test cluster

To run a functional test cluster,

cd build
ninja vstart        # builds just enough to run vstart
../src/vstart.sh --debug --new -x --localhost --bluestore
./bin/ceph -s

Almost all of the usual commands are available in the bin/ directory. For example,

./bin/rados -p rbd bench 30 write
./bin/rbd create foo --size 1000

To shut down the test cluster,

../src/stop.sh

To start or stop individual daemons, the sysvinit script can be used:

./bin/init-ceph restart osd.0
./bin/init-ceph stop

Running unit tests

To build and run all tests (in parallel using all processors), use ctest:

cd build
ninja
ctest -j$(nproc)

(Note: Many targets built from src/test are not run using ctest. Targets starting with "unittest" are run in ninja check and thus can be run with ctest. Targets starting with "ceph_test" can not, and should be run by hand.)

When failures occur, look in build/Testing/Temporary for logs.

To build and run all tests and their dependencies without other unnecessary targets in Ceph:

cd build
ninja check -j$(nproc)

To run an individual test manually, run ctest with -R (regex matching):

ctest -R [regex matching test name(s)]

(Note: ctest does not build the test it's running or the dependencies needed to run it)

To run an individual test manually and see all the tests output, run ctest with the -V (verbose) flag:

ctest -V -R [regex matching test name(s)]

To run tests manually and run the jobs in parallel, run ctest with the -j flag:

ctest -j [number of jobs]

There are many other flags you can give ctest for better control over manual test execution. To view these options run:

man ctest

Building the Documentation

Prerequisites

The list of package dependencies for building the documentation can be found in doc_deps.deb.txt:

sudo apt-get install `cat doc_deps.deb.txt`

Building the Documentation

To build the documentation, ensure that you are in the top-level /ceph directory, and execute the build script. For example:

admin/build-doc

报错记录:

fatal: clone of 'https://github.com/ceph/googletest' into submodule path

[root@fedora ceph]# ./do_cmake.sh
+ '[' -d .git ']'
+ git submodule update --init --recursive
Cloning into '/home/lcx/ceph/src/dmclock'...
fatal: unable to access 'https://github.com/ceph/dmclock.git/': Failed to connect to 127.0.0.1 port 1080 after 1 ms: Connection refused
fatal: clone of 'https://github.com/ceph/dmclock.git' into submodule path '/home/lcx/ceph/src/dmclock' failed
Failed to clone 'src/dmclock'. Retry scheduled
Cloning into '/home/lcx/ceph/src/erasure-code/jerasure/gf-complete'...
fatal: unable to access 'https://github.com/ceph/gf-complete.git/': Failed to connect to 127.0.0.1 port 1080 after 0 ms: Connection refused
fatal: clone of 'https://github.com/ceph/gf-complete.git' into submodule path '/home/lcx/ceph/src/erasure-code/jerasure/gf-complete' failed
Failed to clone 'src/erasure-code/jerasure/gf-complete'. Retry scheduled
Cloning into '/home/lcx/ceph/src/fmt'...
fatal: unable to access 'https://github.com/ceph/fmt.git/': Failed to connect to 127.0.0.1 port 1080 after 0 ms: Connection refused
fatal: clone of 'https://github.com/ceph/fmt.git' into submodule path '/home/lcx/ceph/src/fmt' failed
Failed to clone 'src/fmt'. Retry scheduled
Cloning into '/home/lcx/ceph/src/googletest'...
fatal: unable to access 'https://github.com/ceph/googletest/': Failed to connect to 127.0.0.1 port 1080 after 0 ms: Connection refused
fatal: clone of 'https://github.com/ceph/googletest' into submodule path '/home/lcx/ceph/src/googletest' failed
Failed to clone 'src/googletest'. Retry scheduled
Cloning into '/home/lcx/ceph/src/isa-l'...
fatal: unable to access 'https://github.com/ceph/isa-l/': Failed to connect to 127.0.0.1 port 1080 after 0 ms: Connection refused
fatal: clone of 'https://github.com/ceph/isa-l' into submodule path '/home/lcx/ceph/src/isa-l' failed
Failed to clone 'src/isa-l'. Retry scheduled
Cloning into '/home/lcx/ceph/src/pybind/mgr/rook/rook-client-python'...
fatal: unable to access 'https://github.com/ceph/rook-client-python.git/': Failed to connect to 127.0.0.1 port 1080 after 0 ms: Connection refused
fatal: clone of 'https://github.com/ceph/rook-client-python.git' into submodule path '/home/lcx/ceph/src/pybind/mgr/rook/rook-client-python' failed
Failed to clone 'src/pybind/mgr/rook/rook-client-python'. Retry scheduled
Cloning into '/home/lcx/ceph/src/s3select'...
fatal: unable to access 'https://github.com/ceph/s3select.git/': Failed to connect to 127.0.0.1 port 1080 after 0 ms: Connection refused
fatal: clone of 'https://github.com/ceph/s3select.git' into submodule path '/home/lcx/ceph/src/s3select' failed
Failed to clone 'src/s3select'. Retry scheduled
Cloning into '/home/lcx/ceph/src/spawn'...
fatal: unable to access 'https://github.com/ceph/spawn.git/': Failed to connect to 127.0.0.1 port 1080 after 0 ms: Connection refused
fatal: clone of 'https://github.com/ceph/spawn.git' into submodule path '/home/lcx/ceph/src/spawn' failed
Failed to clone 'src/spawn'. Retry scheduled
Cloning into '/home/lcx/ceph/src/dmclock'...
fatal: unable to access 'https://github.com/ceph/dmclock.git/': Failed to connect to 127.0.0.1 port 1080 after 0 ms: Connection refused
fatal: clone of 'https://github.com/ceph/dmclock.git' into submodule path '/home/lcx/ceph/src/dmclock' failed
Failed to clone 'src/dmclock' a second time, aborting 

修改 vi .gitmodules 将命令行里的https改为git重新执行。

我改了之后发现不生效,所以我是直接找报错里面的地址 自己下载

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

然后将下载的结果spdk按提示“into submodule path '/home/ceph/src/spdk"移动到src下

Cloning into '/home/ceph/src/spdk'...
fatal: unable to access 'https://github.com/ceph/spdk.git/': HTTP/2 stream 1 was not closed cleanly before end of the underlying stream
fatal: clone of 'https://github.com/ceph/spdk.git' into submodule path '/home/ceph/src/spdk' failed
Failed to clone 'src/spdk'. Retry scheduled
Cloning into '/home/ceph/src/spdk'...
fatal: unable to access 'https://github.com/ceph/spdk.git/': HTTP/2 stream 1 was not closed cleanly before end of the underlying stream
fatal: clone of 'https://github.com/ceph/spdk.git' into submodule path '/home/ceph/src/spdk' failed
Failed to clone 'src/spdk' a second time, aborting
[root@fedora ceph]# git clone  git://github.com/ceph/spdk.git
 

  does not contain a CMakeLists.txt file.

CMake Error at src/CMakeLists.txt:735 (add_subdirectory):
  The source directory

    /home/ceph/src/dmclock

  does not contain a CMakeLists.txt file.
 

/home/ceph/src/dmclock是空目录,删掉。在ceph目录下 vi .gitmodules 找到下载地址

 [submodule "src/dmclock"]
        path = src/dmclock
        url = https://github.com/ceph/dmclock.git

git clone git://github.com/ceph/dmclock.git  下载下来后,放到目src

ERROR Performing build step for 'boost'

ERROR Performing build step for 'boost-libs'

创建环境:conda create -n 环境名称 python=版本

conda create -n env_name python=3.6

激活环境:conda activate 环境名称

conda activate env_name

猜你喜欢

转载自blog.csdn.net/bandaoyu/article/details/121414278