Skip to content

Commit fc02918

Browse files
authored
doc: add mold to speeding up section
PR-URL: #52179 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
1 parent c43a944 commit fc02918

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

BUILDING.md

+20-8
Original file line numberDiff line numberDiff line change
@@ -531,23 +531,30 @@ make test-only
531531

532532
#### Speeding up frequent rebuilds when developing
533533

534-
If you plan to frequently rebuild Node.js, especially if using several branches,
535-
installing `ccache` can help to greatly reduce build times. Set up with:
534+
Tips: The `ccache` utility is widely used and should generally work fine.
535+
If you encounter any difficulties, consider disabling `mold` as a
536+
troubleshooting step.
537+
538+
If you plan to frequently rebuild Node.js, especially if using several
539+
branches, installing `ccache` and `mold` can help to greatly reduce build
540+
times. Set up with:
536541

537542
On GNU/Linux:
538543

539544
```bash
540-
sudo apt install ccache # for Debian/Ubuntu, included in most Linux distros
541-
export CC="ccache gcc" # add to your .profile
542-
export CXX="ccache g++" # add to your .profile
545+
sudo apt install ccache mold # for Debian/Ubuntu, included in most Linux distros
546+
export CC="ccache gcc" # add to your .profile
547+
export CXX="ccache g++" # add to your .profile
548+
export LDFLAGS="-fuse-ld=mold" # add to your .profile
543549
```
544550

545551
On macOS:
546552

547553
```bash
548-
brew install ccache # see https://brew.sh
549-
export CC="ccache cc" # add to ~/.zshrc or other shell config file
550-
export CXX="ccache c++" # add to ~/.zshrc or other shell config file
554+
brew install ccache mold # see https://brew.sh
555+
export CC="ccache cc" # add to ~/.zshrc or other shell config file
556+
export CXX="ccache c++" # add to ~/.zshrc or other shell config file
557+
export LDFLAGS="-fuse-ld=mold" # add to ~/.zshrc or other shell config file
551558
```
552559

553560
This will allow for near-instantaneous rebuilds when switching branches back
@@ -565,6 +572,11 @@ the specified directory. The JS debugger of Visual Studio Code supports this
565572
configuration since the November 2020 version and allows for setting
566573
breakpoints.
567574

575+
Refs:
576+
577+
1. <https://ccache.dev/performance.html>
578+
2. <https://github.com/rui314/mold>
579+
568580
#### Troubleshooting Unix and macOS builds
569581

570582
Stale builds can sometimes result in `file not found` errors while building.

0 commit comments

Comments
 (0)