Download the docker image
Pegasus encapsulates the building environments into docker images, you can build directly based on these environments.
For example, you can use the image based on Ubuntu 20.04
:
docker pull apache/pegasus:build-env-ubuntu2004-master
Compilation
Please refer to Downloads to fetch the sources under a directory (/your/local/apache-pegasus-source
). Then run the following command:
If you want to run tests, you should build Pegasus by the following command:
docker run -v /your/local/apache-pegasus-source:/root/pegasus \
apache/pegasus:build-env-ubuntu2004-master \
/bin/bash -c "cd /root/pegasus; ./run.sh build --test -c --clear_thirdparty -j $(nproc)"
If you want to build Pegasus without runing tests, just execute the following command:
docker run -v /your/local/apache-pegasus-source:/root/pegasus \
apache/pegasus:build-env-ubuntu2004-master \
/bin/bash -c "cd /root/pegasus; ./run.sh build -c --clear_thirdparty -j $(nproc)"
The output of compilation will be placed under build/latest/output/
of the source directory. It includes bin
, include
and lib
.
Run tests
docker run -v /your/local/apache-pegasus-source:/root/pegasus \
apache/pegasus:build-env-ubuntu2004-master \
/bin/bash -c "cd /root/pegasus; ./run.sh test"
Packaging
Package server binaries for deployment:
docker run -v /your/local/apache-pegasus-source:/root/pegasus \
apache/pegasus:build-env-ubuntu2004-master \
/bin/bash -c "./run.sh pack_server"
Package client libraries for C/C++ development:
docker run -v /your/local/apache-pegasus-source:/root/pegasus \
apache/pegasus:build-env-ubuntu2004-master \
/bin/bash -c "./run.sh pack_client"
Package toolset which includes various tools (shell, bench):
docker run -v /your/local/apache-pegasus-source:/root/pegasus \
apache/pegasus:build-env-ubuntu2004-master \
/bin/bash -c "./run.sh pack_tools"
If this is your first time compiling Pegasus, it’s recommended to try onebox.