Skip to content

Fixing rippled build errors

Elliot Lee edited this page Sep 25, 2023 · 8 revisions

Build errors using clang 15 (macOS)

Try this Conan profile:

[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
[options]
[build_requires]
[env]
CXXFLAGS=-DBOOST_ASIO_DISABLE_CONCEPTS
[conf]
tools.build:cxxflags+=["-DBOOST_ASIO_DISABLE_CONCEPTS"]
  1. Copy the profile
  2. Remove your build directory
  3. Start over from mkdir .build step

Don't need to remove Conan cache.

This successfully builds 77e0912a0e4ecf69ce62ce4b102e4bc2f234df50, version string 2.0.0-b1.

There may be a warning during linking:

ld: warning: ignoring duplicate libraries: '-lc++'

The ld warning may be an Apple bug: https://github.com/getsentry/sentry-cocoa/issues/3122

Troubleshooting Guide: Build Errors with Conan, Boost and rippled

Error: Boost 1.77.0 Build Failed

Step 1: Confirm Conan Version

Check the version of Conan you are using. Conan v2.x has known issues, so make sure you're using a version like 1.56. Use the following command to check your Conan version:

conan --version

Step 2: Confirm Your Conan Profile

Check the configuration of your default profile. This is an example command to show your default profile:

conan profile show default

Make sure the compiler, compiler.version, compiler.libcxx, build_type, and compiler.cppstd fields match your environment's requirements.

Step 3: Verify Your Error Message

Make sure you are posting the full error message for better troubleshooting. If the error message is too long, consider using a service like Gist to share it.

Step 4: Check Your Architecture Settings

If you are building on a machine with a different architecture (e.g., Mac M1), verify that your Conan profile has the correct architecture settings.

Step 5: Review Previous Issues

Look for similar issues in the project's issue tracker. You might find helpful solutions or workarounds there.

Step 6: Adjust Conan Profile

Try updating your Conan profile with these commands:

conan profile update 'options.boost:extra_b2_flags="define=BOOST_ASIO_HAS_STD_INVOKE_RESULT"' default
conan profile update 'env.CFLAGS="-DBOOST_ASIO_HAS_STD_INVOKE_RESULT"' default
conan profile update 'env.CXXFLAGS="-DBOOST_ASIO_HAS_STD_INVOKE_RESULT"' default
conan profile update 'conf.tools.build:cflags+=["-DBOOST_ASIO_HAS_STD_INVOKE_RESULT"]' default
conan profile update 'conf.tools.build:cxxflags+=["-DBOOST_ASIO_HAS_STD_INVOKE_RESULT"]' default

Then, try to install Boost again:

conan install boost/1.77.0@ --build

Error: Could Not Find Conan Toolchain File

Step 7: Confirm Directory

Ensure you're running the command from the correct directory. If you're following the Rippled build instructions, you should be in the .build directory.

Step 8: Check Directory Contents

Review the contents of your directory. You should see files like conan.lock, conanbuildinfo.txt, conaninfo.txt, and graph_info.json.

Step 9: Inspect Toolchain File

Check if the toolchain file exists and if its path is correct. Use commands like ls -ld build, ls -ld build/generators, and ls -l build/generators/conan_toolchain.cmake to verify.

Step 10: Pass Absolute Path to CMake

If the relative path isn't working, try passing an absolute path to the CMake command like so:

cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$(pwd)/build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug ..

Error: Failed to Read rippled Configuration

Step 11: Validate rippled Execution

If you encounter errors when running the rippled executable, double-check the error message. A common issue is the absence of configuration files or directories.

Step 12: Create Necessary Directories and Files

Ensure that the directories and files mentioned in the error message exist. For example, you might need to create /etc/opt/ripple/ and add the rippled.cfg file to it:

sudo mkdir -p /etc/opt/ripple/
sudo cp /path/to/your/rippled.cfg /etc/opt/ripple/

Now, try running your rippled executable again.


When running:

conan install .. --output-folder . --build missing --settings build_type=Release

You may get this error:

CMake Error at CMakeLists.txt:49 (project):
  The CMAKE_CXX_COMPILER:

    <path>

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

You need to give the path to the compiler. In the instructions, <path> is just a placeholder. To set the compiler path, run the command that set it. It's in your profile. To see it, run conan profile show default.

In the following command, <path> must be replaced with the path to the compiler, before you execute the command.

conan profile update 'conf.tools.build:compiler_executables={"c": "<path>", "cpp": "<path>"}' default

On a typical Ubuntu 20 machine, gcc was at /usr/bin/gcc and g++ was at /usr/bin/g++

So the complete command line could be:

conan profile update 'conf.tools.build:compiler_executables={"c": "/usr/bin/gcc", "cpp": "/usr/bin/g++"}' default

If you run into conan errors:

grpc-proto/cci.20220627: WARN: Build folder /home/user/.conan/data/grpc-proto/cci.20220627/_/_/build/0623b89cdfdcdc89b2ee9f15778d9510adc21398
ERROR: grpc-proto/cci.20220627: Error in build() method, line 97
        cmake = self._configure_cmake()
while calling '_configure_cmake', line 63
        cmake.definitions["GOOGLEAPIS_PROTO_DIRS"] = self.dependencies["googleapis"].cpp_info.resdirs[0].replace("\\", "/")
        IndexError: list index out of range
CMake Error at /usr/share/cmake/Modules/CMakeDetermineSystem.cmake:130 (message):
  Could not find toolchain file:
  conan-dependencies/build/generators/conan_toolchain.cmake
Call Stack (most recent call first):
  CMakeLists.txt:14 (project)

Then you may need to run:

conan remove grpc/1.50.1

conan remove grpc/1.44.0

conan remove grpc-proto

conan remove googleapis

(The subdependencies grpc-proto, googleapis need to be removed)

In this case, this was caused by the need to update grpc. Conan has issues when versions update, so you may need to manually clear out the old versions of the grpc-related packages. i.e.:

for x in  grpc googleapis grpc-proto; do conan remove $x ; done

The problem is that Conan does not include the recipe revision in the package ID, so an updated recipe does not trigger a rebuild. That might change with Conan 2.0, so hopefully this issue goes away once we upgrade to that - although we will surely get new issues.

Alternatively, if it's not too much trouble, the nuclear option is to rm -rf ~/.conan/data

Then, you can rerun the conan install command(s).

Clone this wiki locally