docs(BUILD): make it easier to find environment.md (#4507)

Make the instructions a bit easier to follow. Users on different
platforms can look for their platform name to find relevant information.
This commit is contained in:
Elliot Lee
2023-09-15 21:54:25 -07:00
committed by GitHub
parent 046d0c2f0a
commit 3397922989

View File

@@ -1,7 +1,7 @@
> These instructions assume you have a C++ development environment ready | :warning: **WARNING** :warning:
> with Git, Python, Conan, CMake, and a C++ compiler. For help setting one up |---|
> on Linux, macOS, or Windows, see [our guide](./docs/build/environment.md). | These instructions assume you have a C++ development environment ready with Git, Python, Conan, CMake, and a C++ compiler. For help setting one up on Linux, macOS, or Windows, [see this guide](./docs/build/environment.md). |
>
> These instructions also assume a basic familiarity with Conan and CMake. > These instructions also assume a basic familiarity with Conan and CMake.
> If you are unfamiliar with Conan, > If you are unfamiliar with Conan,
> you can read our [crash course](./docs/build/conan.md) > you can read our [crash course](./docs/build/conan.md)
@@ -29,9 +29,12 @@ branch.
git checkout develop git checkout develop
``` ```
## Minimum Requirements ## Minimum Requirements
See [System Requirements](https://xrpl.org/system-requirements.html).
Building rippled generally requires git, Python, Conan, CMake, and a C++ compiler. Some guidance on setting up such a [C++ development environment can be found here](./docs/build/environment.md).
- [Python 3.7](https://www.python.org/downloads/) - [Python 3.7](https://www.python.org/downloads/)
- [Conan 1.55](https://conan.io/downloads.html) - [Conan 1.55](https://conan.io/downloads.html)
- [CMake 3.16](https://cmake.org/download/) - [CMake 3.16](https://cmake.org/download/)
@@ -46,81 +49,105 @@ The [minimum compiler versions][2] required are:
| Apple Clang | 13.1.6 | | Apple Clang | 13.1.6 |
| MSVC | 19.23 | | MSVC | 19.23 |
We don't recommend Windows for `rippled` production at this time. As of ### Linux
January 2023, Ubuntu has the highest level of quality assurance, testing,
and support.
Windows developers should use Visual Studio 2019. `rippled` isn't The Ubuntu operating system has received the highest level of
compatible with [Boost](https://www.boost.org/) 1.78 or 1.79, and Conan quality assurance, testing, and support.
can't build earlier Boost versions.
**Note:** 32-bit Windows development isn't supported. Here are [sample instructions for setting up a C++ development environment on Linux](./docs/build/environment.md#linux).
### Mac
Many rippled engineers use macOS for development.
Here are [sample instructions for setting up a C++ development environment on macOS](./docs/build/environment.md#macos).
### Windows
Windows is not recommended for production use at this time.
- Additionally, 32-bit Windows development is not supported.
- Visual Studio 2022 is not yet supported.
- rippled generally requires [Boost][] 1.77, which Conan cannot build with VS 2022.
- Until rippled is updated for compatibility with later versions of Boost, Windows developers may need to use Visual Studio 2019.
[Boost]: https://www.boost.org/
## Steps ## Steps
### Set Up Conan ### Set Up Conan
1. (Optional) If you've never used Conan, use autodetect to set up a default profile. After you have a [C++ development environment](./docs/build/environment.md) ready with Git, Python, Conan, CMake, and a C++ compiler, you may need to set up your Conan profile.
These instructions assume a basic familiarity with Conan and CMake.
If you are unfamiliar with Conan, then please read [this crash course](./docs/build/conan.md) or the official [Getting Started][3] walkthrough.
You'll need at least one Conan profile:
``` ```
conan profile new default --detect conan profile new default --detect
``` ```
2. Update the compiler settings. Update the compiler settings:
``` ```
conan profile update settings.compiler.cppstd=20 default conan profile update settings.compiler.cppstd=20 default
``` ```
Linux developers will commonly have a default Conan [profile][] that compiles **Linux** developers will commonly have a default Conan [profile][] that compiles
with GCC and links with libstdc++. with GCC and links with libstdc++.
If you are linking with libstdc++ (see profile setting `compiler.libcxx`), If you are linking with libstdc++ (see profile setting `compiler.libcxx`),
then you will need to choose the `libstdc++11` ABI. then you will need to choose the `libstdc++11` ABI:
``` ```
conan profile update settings.compiler.libcxx=libstdc++11 default conan profile update settings.compiler.libcxx=libstdc++11 default
``` ```
On Windows, you should use the x64 native build tools. **Windows** developers may need to use the x64 native build tools.
An easy way to do that is to run the shortcut "x64 Native Tools Command An easy way to do that is to run the shortcut "x64 Native Tools Command
Prompt" for the version of Visual Studio that you have installed. Prompt" for the version of Visual Studio that you have installed.
Windows developers must also build `rippled` and its dependencies for the x64 Windows developers must also build `rippled` and its dependencies for the x64
architecture. architecture:
``` ```
conan profile update settings.arch=x86_64 default conan profile update settings.arch=x86_64 default
``` ```
3. (Optional) If you have multiple compilers installed on your platform, ### Multiple compilers
make sure that Conan and CMake select the one you want to use.
This setting will set the correct variables (`CMAKE_<LANG>_COMPILER`)
in the generated CMake toolchain file.
When `/usr/bin/g++` exists on a platform, it is the default cpp compiler. This
default works for some users.
However, if this compiler cannot build rippled or its dependencies, then you can
install another compiler and set Conan and CMake to use it.
Update the `conf.tools.build:compiler_executables` setting in order to set the correct variables (`CMAKE_<LANG>_COMPILER`) in the
generated CMake toolchain file.
For example, on Ubuntu 20, you may have gcc at `/usr/bin/gcc` and g++ at `/usr/bin/g++`; if that is the case, you can select those compilers with:
``` ```
conan profile update 'conf.tools.build:compiler_executables={"c": "<path>", "cpp": "<path>"}' default conan profile update 'conf.tools.build:compiler_executables={"c": "/usr/bin/gcc", "cpp": "/usr/bin/g++"}' default
``` ```
Replace `/usr/bin/gcc` and `/usr/bin/g++` with paths to the desired compilers.
It should choose the compiler for dependencies as well, It should choose the compiler for dependencies as well,
but not all of them have a Conan recipe that respects this setting (yet). but not all of them have a Conan recipe that respects this setting (yet).
For the rest, you can set these environment variables: For the rest, you can set these environment variables.
Replace `<path>` with paths to the desired compilers:
``` - `conan profile update env.CC=<path> default`
conan profile update env.CC=<path> default - `conan profile update env.CXX=<path> default`
conan profile update env.CXX=<path> default
```
4. Export our [Conan recipe for Snappy](./external/snappy). Export our [Conan recipe for Snappy](./external/snappy).
It doesn't explicitly link the C++ standard library, It does not explicitly link the C++ standard library,
which allows you to statically link it with GCC, if you want. which allows you to statically link it with GCC, if you want.
``` ```
conan export external/snappy snappy/1.1.10@ conan export external/snappy snappy/1.1.10@
``` ```
5. Export our [Conan recipe for SOCI](./external/soci). Export our [Conan recipe for SOCI](./external/soci).
It patches their CMake to correctly import its dependencies. It patches their CMake to correctly import its dependencies.
``` ```