使用 Docker 完成编译(推荐)

下载Docker镜像

Pegasus将编译环境封装至Docker镜像中,这里包含有多个Linux发行版,你可以直接基于这些环境编译代码。

比如,你可以使用基于Ubuntu 20.04的镜像:

docker pull apache/pegasus:build-env-ubuntu2004-master

编译

请先参考下载文档获取源码到某目录(/your/local/apache-pegasus-source)下。随后运行以下命令:

如果你想要执行测试程序,需要用如下命令来编译Pegasus:

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)"

如果不需要执行测试程序,只是单纯想编译Pegasus,使用如下命令即可:

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)"

编译的结果会被放在项目根目录的build/latest/output/文件夹下,其中包含bininclude以及lib目录。

执行测试程序

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"

编译打包

打包server端程序包,用于服务部署:

docker run -v /your/local/apache-pegasus-source:/root/pegasus \
           apache/pegasus:build-env-ubuntu2004-master \
           /bin/bash -c "./run.sh pack_server"

打包client端库,用于C/C++端客户端开发:

docker run -v /your/local/apache-pegasus-source:/root/pegasus \
           apache/pegasus:build-env-ubuntu2004-master \
           /bin/bash -c "./run.sh pack_client"

打包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"

编译成功后,推荐先体验onebox集群

Copyright © 2023 The Apache Software Foundation. Licensed under the Apache License, Version 2.0.

Apache Pegasus is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.

Apache Pegasus, Pegasus, Apache, the Apache feather logo, and the Apache Pegasus project logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries.