You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary: Delete the mention of old build scripts in the doc
Reviewed By: rlyerly
Differential Revision: D105227000
fbshipit-source-id: 4eeb816dd65b7d598d6e97f024290d59cba4531d
CacheLib uses `getdeps.py` for building, which is used by many of Meta's OSS tools. This script will download and build all of the necessary dependencies first, and will then invoke cmake to build CacheLib. This ensures that you build with relevant versions of all dependent libraries, taking into account what versions are installed locally on your system.
4
+
3
5
## Dependencies
4
6
5
-
CacheLib depends on multiple libraries and programs.
6
-
Some are available as system packages, and others need
7
-
to be build from source.
7
+
CacheLib depends on multiple libraries and programs. Some are available as system packages, and others need to be built from source.
8
8
9
-
The primary dependecies are:
9
+
The primary dependencies are:
10
10
11
11
* a C++20 compiler (tested with GCC, CLANG)
12
12
*[https://cmake.org/](CMake)
@@ -26,260 +26,174 @@ These dependencies further require multiple libraries:
26
26
* And many more libraries, commonly available as installable packages, e.g:
1. Download and build all necessary dependencies (folly, fbthrift, wangle, fizz, etc.)
65
+
2. Build CacheLib with the appropriate configuration
66
+
3. Install the built artifacts to a scratch directory
98
67
99
-
#### Step 2 - Update Git-Submodules
68
+
The build may take several minutes on the first run as it compiles all dependencies. Subsequent builds will be much faster as only changed components are rebuilt.
100
69
101
-
The CacheLib project includes several library as git-submodules
102
-
(folly,fbthrift,wangle,fizz).
103
-
Due to the way internal facebook projects are
104
-
converted to git and exported to github, the updating process
105
-
is slightly more complicated than a simple `git submodule update`.
70
+
## Build Configurations
106
71
107
-
The script `./contrib/update-submodules.sh` performs the required steps
108
-
to synchronize the required git revisions.
72
+
By default, `getdeps.py` builds in Release mode with debug information. To change the configuration, pass `--build-type` (e.g., `--build-type Debug`) to the `build` command. Run `python3 ./build/fbcode_builder/getdeps.py build --help` for the full list of build options.
109
73
110
-
It is safe to re-run the `update-submodules.sh` script - it will simply
111
-
pull the latest changes (if any).
74
+
## Running Tests
112
75
76
+
By default `getdeps.py` will build the tests for CacheLib. To run them:
113
77
114
-
#### Step 3 - Build libraries from source code
78
+
```sh
79
+
python3 ./build/fbcode_builder/getdeps.py --allow-system-packages test cachelib
80
+
```
115
81
116
-
Downloads the latest source code version of the following libraries,
Since `getdeps.py` uses an incremental build system, rebuilding after small changes is typically very fast as only the modified components and their dependents are recompiled.
199
132
200
-
## Development Cycle
133
+
## Updating to Latest Version
201
134
202
-
When working on CacheLib itself (e.g. tweaking caching algorithms or adding
203
-
features to `cachebench`), the following is recommended:
135
+
Facebook's internal development cycle tightly couples CacheLib with its dependencies (e.g., folly, fbthrift, wangle, fizz), and all are frequently updated. In particular, the folly library does not provide a stable API, and using mismatched versions can cause compilation errors.
204
136
205
-
* Run `./contrib/build.sh -j -d -v` to install dependencies and
206
-
build `cachelib`.
207
-
* The resulting cachelib files will be stored in the `build-cachelib`
208
-
subdirectory.
209
-
* Modify source code files in`./cachelib/`
210
-
* Rebuild the modified files in`build-cachelib` using `make`.
The `getdeps.py` script automatically handles updating and rebuilding all dependencies to compatible versions. This ensures that you always have a consistent set of libraries that work together.
217
152
218
-
$ cd build-cachelib
219
-
$ make
220
-
[... cachelib and cachebench are rebuild ...]
153
+
If you encounter build issues after pulling, try cleaning the build artifacts and rebuilding:
221
154
222
-
$ touch touch ../cachelib/cachebench/main.cpp
223
-
$ make
224
-
[... cachelib and cachebench are rebuild ...]
155
+
```sh
156
+
# getdeps.py will automatically rebuild dependencies as needed
2. Install the packages manually using your system's package manager
250
179
251
-
The default `build.sh` wrapper script requires internet connection
252
-
(for package installation and github updates).
180
+
3. Re-run the build with `--allow-system-packages` to use the manually installed dependencies
253
181
254
-
For special build circumstances where internet connection is not available,
255
-
it is possible to download the source code on one machine, then copy it
256
-
and build it on another.
182
+
### Platform Support
257
183
258
-
Use `build-package.sh -B` option to only download the latest source code
259
-
(using `git clone/git pull`) without building.
184
+
`getdeps.py` has been tested on:
185
+
- Ubuntu 18.04, 20.04, 22.04
186
+
- CentOS 8
187
+
- Debian 10, 11
260
188
261
-
Example:
262
-
```sh
263
-
./contrib/build-package.sh -B googlelog
264
-
./contrib/build-package.sh -B googleflags
265
-
./contrib/build-package.sh -B googletest
266
-
./contrib/build-package.sh -B fmt
267
-
./contrib/build-package.sh -B sparsemap
268
-
./contrib/build-package.sh -B folly
269
-
./contrib/build-package.sh -B fizz
270
-
./contrib/build-package.sh -B wangle
271
-
./contrib/build-package.sh -B fbthrift
272
-
./contrib/build-package.sh -B cachelib
273
-
```
189
+
For other platforms, you may need to install dependencies manually and use `--allow-system-packages`.
274
190
275
-
Will download the latest source code of all libraries under
276
-
the `./cachelib/external` subdirectory.
191
+
## Legacy Build Scripts
277
192
278
-
Then the entire build tree can be copied to another machine
279
-
(one that does not have internet connectivity).
280
-
CacheLib can then be build be adding the `-S` option to `build.sh`
281
-
(meaning: skip the `git clone/git pull` step):
193
+
**Note**: The legacy build scripts (`./contrib/build.sh`, `./contrib/build-package.sh`, and related scripts) are deprecated and no longer maintained. Please use `getdeps.py` as documented above for all builds.
0 commit comments