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
Merge #15603: docs: Add more tips to productivity.md
5801dd6 docs: Add more tips to productivity.md (gwillen)
Pull request description:
Add advice to productivity.md on:
- Using ccache to optimal effect
- The with-incompatible-bdb configure option
- Building less than the entire set of targets
ACKs for commit 5801dd:
promag:
utACK 5801dd6.
MarcoFalke:
utACK 5801dd6
Tree-SHA512: 2138acd4bf5a27ecaa9a02fb2141903d01ee199ba85ccf6a5ad6a0a4dabf4447d043108cdd86998801b0282e899f70892f9337b0b6dc59c6d1f0fccf61adb4e4
Copy file name to clipboardExpand all lines: doc/productivity.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ Table of Contents
8
8
*[Cache compilations with `ccache`](#cache-compilations-with-ccache)
9
9
*[Disable features with `./configure`](#disable-features-with-configure)
10
10
*[Make use of your threads with `make -j`](#make-use-of-your-threads-with-make--j)
11
+
*[Only build what you need](#only-build-what-you-need)
11
12
*[Multiple working directories with `git worktrees`](#multiple-working-directories-with-git-worktrees)
12
13
*[Writing code](#writing-code)
13
14
*[Format C/C++/Protobuf diffs with `clang-format-diff.py`](#format-ccprotobuf-diffs-with-clang-format-diffpy)
@@ -32,6 +33,17 @@ Install `ccache` through your distribution's package manager, and run `./configu
32
33
33
34
To use ccache for all your C/C++ projects, follow the symlinks method [here](https://ccache.samba.org/manual/latest.html#_run_modes) to set it up.
34
35
36
+
To get the most out of ccache, put something like this in `~/.ccache/ccache.conf`:
37
+
38
+
```
39
+
max_size = 50.0G # or whatever cache size you prefer; default is 5G; 0 means unlimited
40
+
base_dir = /home/yourname # or wherever you keep your source files
41
+
```
42
+
43
+
Note: base_dir is required for ccache to share cached compiles of the same file across different repositories / paths; it will only do this for paths under base_dir. So this option is required for effective use of ccache with git worktrees (described below).
44
+
45
+
You _must not_ set base_dir to "/", or anywhere that contains system headers (according to the ccache docs).
46
+
35
47
### Disable features with `./configure`
36
48
37
49
After running `./autogen.sh`, which generates the `./configure` file, use `./configure --help` to identify features that you can disable to save on compilation time. A few common flags:
@@ -43,6 +55,8 @@ After running `./autogen.sh`, which generates the `./configure` file, use `./con
43
55
--without-gui
44
56
```
45
57
58
+
If you do need the wallet enabled, it is common for devs to add `--with-incompatible-bdb`. This uses your system bdb version for the wallet, so you don't have to find a copy of bdb 4.8. Wallets from such a build will be incompatible with any release binary (and vice versa), so use with caution on mainnet.
59
+
46
60
### Make use of your threads with `make -j`
47
61
48
62
If you have multiple threads on your machine, you can tell `make` to utilize all of them with:
@@ -51,6 +65,20 @@ If you have multiple threads on your machine, you can tell `make` to utilize all
51
65
make -j"$(($(nproc)+1))"
52
66
```
53
67
68
+
### Only build what you need
69
+
70
+
When rebuilding during development, note that running `make`, without giving a target, will do a lot of work you probably don't need. It will build the GUI (unless you've disabled it) and all the tests (which take much longer to build than the app does).
71
+
72
+
Obviously, it is important to build and run the tests at appropriate times -- but when you just want a quick compile to check your work, consider picking one or a set of build targets relevant to what you're working on, e.g.:
73
+
74
+
```sh
75
+
make src/bitcoind src/bitcoin-cli
76
+
make src/qt/bitcoin-qt
77
+
make -C src bitcoin_bench
78
+
```
79
+
80
+
(You can and should combine this with `-j`, as above, for a parallel build.)
81
+
54
82
### Multiple working directories with `git worktrees`
55
83
56
84
If you work with multiple branches or multiple copies of the repository, you should try `git worktrees`.
0 commit comments