Skip to content

Building rippled codebase with CLion IDE

Chenna Keshava B S edited this page Sep 1, 2023 · 1 revision

Building rippled with CLion IDE

I faced some issues in setting up the CLion IDE to work with the Conan build system. I'm hoping this document will alleviate some of those problems. Try to build rippled code through your terminal to ensure that there are no dependency issues. Relevant instructions can be found here

The following works in CLion v2023.1.1

Reset the cache of CLion

Go to the root of rippled directory and execute the following commands to remove traces of previous compilation runs.

  1. rm -rf .idea
  2. rm -rf cmake-build-*
  3. rm -rf cmake-release-*
  4. rm -rf CMakeUserPresets.json
  5. CLion Toolbar -> File -> Invalidate Caches (click both options)
  6. Remove the project from the CLion Quickstart menu

CLion can be configured to run rippled through updating the CMake settings or by enabling a Compilation Database. But do not include both these alternatives at the same time.

Configuring CMake settings

  1. make sure the "Build type" field matches the one you passed to conan install command here
  2. make sure you pass -DCMAKE_TOOLCHAIN_FILE in the "CMake options" field just like the instructions say in the above webpage.
  3. The Toolchain and Generator fields can be left with the defaults.
    Here is a sample image of my CMake settings image

Using a Compilation Database

You can use the following command to generate a compile_commands.json file: cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..

Then, open the clion project with the compile_commands.json file. Make sure to go into Tools -> Compilation Database -> Change Project Root after import.

If CMake is configured correctly, you should be able to see a toolbar with green icons for build and run.image