5.0 KiB
How to build Clio
Clio is built with CMake and uses Conan for managing dependencies. It is written in C++20 and therefore requires a modern compiler.
Minimum Requirements
- Python 3.7
- Conan 1.55
- CMake 3.20
- [Optional] GCovr: needed for code coverage generation
- [Optional] CCache: speeds up compilation if you are going to compile Clio often
| Compiler | Version |
|---|---|
| GCC | 12.3 |
| Clang | 16 |
| Apple Clang | 15 |
Conan Configuration
Clio does not require anything other than compiler.cppstd=20 in your (~/.conan/profiles/default) Conan profile.
Note
Although Clio is built using C++23, it's required to set
compiler.cppstd=20for the time being as some of Clio's dependencies are not yet capable of building under C++23.
Mac example:
[settings]
os=Macos
os_build=Macos
arch=armv8
arch_build=armv8
compiler=apple-clang
compiler.version=15
compiler.libcxx=libc++
build_type=Release
compiler.cppstd=20
[conf]
tools.build:cxxflags+=["-DBOOST_ASIO_DISABLE_CONCEPTS"]
Linux example:
[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=12
compiler.libcxx=libstdc++11
build_type=Release
compiler.cppstd=20
Artifactory
Make sure artifactory is setup with Conan.
conan remote add --insert 0 conan-non-prod http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
Now you should be able to download the prebuilt xrpl package on some platforms.
Note
You may need to edit the
~/.conan/remotes.jsonfile to ensure that this newly added artifactory is listed last. Otherwise, you could see compilation errors when building the project with gcc version 13 (or newer).
Remove old packages you may have cached.
conan remove -f xrpl
Building Clio
Navigate to Clio's root directory and run:
mkdir build && cd build
conan install .. --output-folder . --build missing --settings build_type=Release -o tests=True -o lint=False
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --parallel 8 # or without the number if you feel extra adventurous
Tip
You can omit the
-o tests=Trueif you don't want to buildclio_tests.
If successful, conan install will find the required packages and cmake will do the rest. You should see clio_server and clio_tests in the build directory (the current directory).
Tip
To generate a Code Coverage report, include
-o coverage=Truein theconan installcommand above, along with-o tests=Trueto enable tests. After running thecmakecommands, executemake clio_tests-ccov. The coverage report will be found atclio_tests-llvm-cov/index.html.
Note
If you've built Clio before and the build is now failing, it's likely due to updated dependencies. Try deleting the build folder and then rerunning the Conan and CMake commands mentioned above.
Generating API docs for Clio
The API documentation for Clio is generated by Doxygen. If you want to generate the API documentation when building Clio, make sure to install Doxygen on your system.
To generate the API docs:
-
First, include
-o docs=Truein the conan install command. For example:mkdir build && cd build conan install .. --output-folder . --build missing --settings build_type=Release -o tests=True -o lint=False -o docs=True -
Once that has completed successfully, run the
cmakecommand and add the--target docsoption:cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release .. cmake --build . --parallel 8 --target docs -
Go to
build/docs/htmlto view the generated files.Open the
index.htmlfile in your browser to see the documentation pages.
Building Clio with Docker
It is also possible to build Clio using Docker if you don't want to install all the dependencies on your machine.
docker run -it rippleci/clio_ci:latest
git clone https://github.com/XRPLF/clio
mkdir build && cd build
conan install .. --output-folder . --build missing --settings build_type=Release -o tests=True -o lint=False
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --parallel 8 # or without the number if you feel extra adventurous
Developing against rippled in standalone mode
If you wish to develop against a rippled instance running in standalone mode there are a few quirks of both Clio and rippled that you need to keep in mind. You must:
- Advance the
rippledledger to at least ledger 256. - Wait 10 minutes before first starting Clio against this standalone node.
