Update README to recommend building using the official docker container (#12286)

* Update README to recommend building using the official docker container,
not building from source.  The "build from source" section is out of date
and incomplete, and users are likely to be confused/frustrated by this.

* Clarify build instructions re: clang and gcc

* Add a step

* Mention .bashrc aliases while at it

* fix typo
This commit is contained in:
gxglass
2025-07-31 19:46:42 -07:00
committed by GitHub
parent 9d48416832
commit fa3b17d404

View File

@@ -48,6 +48,38 @@ Developers interested in using FoundationDB can get started by downloading and i
Developers on an OS for which there is no binary package, or who would like to start hacking on the code, can get started by compiling from source.
NOTE: FoundationDB has a lot of dependencies. The Docker container
listed below tracks them and is what we use internally and is the
recommended method of building FDB.
#### Build Using the Official Docker Image
The official Docker image for building is [`foundationdb/build`](https://hub.docker.com/r/foundationdb/build), which includes all necessary dependencies. The Docker image definitions used by FoundationDB team members can be found in the [dedicated repository](https://github.com/FoundationDB/fdb-build-support).
To build FoundationDB with the clang toolchain,
``` bash
mkdir /some/build_output_dir
cd /some/build_output_dir
CC=clang CXX=clang++ LD=lld cmake -D USE_LD=LLD -D USE_LIBCXX=1 -G Ninja /some/fdb/source_dir
ninja
```
To use GCC, a non-default version is necessary. The following modifies environment
variables ($PATH, $LD_LIBRARY_PATH, etc) to pick up the right GCC version:
``` bash
source /opt/rh/gcc-toolset-13/enable
gcc --version # should say 13
mkdir /some/build_output_dir
cd /some/build_output_dir
cmake -G Ninja /some/fdb/source_dir
ninja
```
Slightly more elaborate compile commands can be found in the shell aliases
defined in `/root/.bashrc` in the container image.
#### Build Locally
To build outside of the official Docker image, you'll need at least these dependencies:
@@ -56,6 +88,11 @@ To build outside of the official Docker image, you'll need at least these depend
1. [Mono](https://www.mono-project.com/download/stable/)
1. [ninja](https://ninja-build.org/)
This list is likely to be incomplete. Refer to the rockylinux9
Dockerfile in the `fdb-build-support` repo linked above for reference
material on specific packages and versions that are likely to be
required.
If compiling for local development, please set `-DUSE_WERROR=ON` in CMake. Our CI compiles with `-Werror` on, so this way you'll find out about compiler warnings that break the build earlier.
Once you have your dependencies, you can run `cmake` and then build:
@@ -68,24 +105,6 @@ Once you have your dependencies, you can run `cmake` and then build:
Building FoundationDB requires at least 8GB of memory. More memory is needed when building in parallel. If the computer freezes or crashes, consider disabling parallelized build using `ninja -j1`.
#### Build Using the Official Docker Image
The official Docker image for building is [`foundationdb/build`](https://hub.docker.com/r/foundationdb/build), which includes all necessary dependencies. The Docker image definitions used by FoundationDB team members can be found in the [dedicated repository](https://github.com/FoundationDB/fdb-build-support). When building inside the container, it is required to use the compilers in the `toolset` subdirectory. To enable the `toolset`, import the environment variables by
``` bash
source /opt/rh/gcc-toolset-13/enable
```
before executing CMake and ninja.
To build FoundationDB with the clang toolchain,
``` bash
CC=clang CXX=clang++ LD=lld cmake -D USE_LD=LLD -D USE_LIBCXX=1 -G Ninja
ninja
```
should be used instead.
#### FreeBSD