Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add mold to speeding up section #52179

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -531,23 +531,27 @@ make test-only

#### Speeding up frequent rebuilds when developing

Tips: The `ccache` utility is widely used and should generally work fine. If you encounter any difficulties, consider disabling `mold` as a troubleshooting step.

If you plan to frequently rebuild Node.js, especially if using several branches,
installing `ccache` can help to greatly reduce build times. Set up with:
installing `ccache` and `mold` can help to greatly reduce build times. Set up with:

On GNU/Linux:

```bash
sudo apt install ccache # for Debian/Ubuntu, included in most Linux distros
export CC="ccache gcc" # add to your .profile
export CXX="ccache g++" # add to your .profile
sudo apt install ccache mold # for Debian/Ubuntu, included in most Linux distros
export CC="ccache gcc" # add to your .profile
export CXX="ccache g++" # add to your .profile
export LDFLAGS="-fuse-ld=mold" # add to your .profile
```

On macOS:

```bash
brew install ccache # see https://brew.sh
export CC="ccache cc" # add to ~/.zshrc or other shell config file
export CXX="ccache c++" # add to ~/.zshrc or other shell config file
brew install ccache mold # see https://brew.sh
export CC="ccache cc" # add to ~/.zshrc or other shell config file
export CXX="ccache c++" # add to ~/.zshrc or other shell config file
export LDFLAGS="-fuse-ld=mold" # add to ~/.zshrc or other shell config file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support for Mach-O targets has been removed.
See https://github.com/bluewhalesystems/sold for macOS/iOS support.

I think we should use sold in macOS

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@congzhangzh Are you willing to open a PR to replace mold to sold on mac?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget that sold is not available on homebrew

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, please allow me do more test on mac os

@rui314 Hi Rui, is that ok we use sold in nodejs, as this mark on https://bluewhale.systems/ websit

What is the difference between sold and mold?
Other than the branding and their licenses, sold and mold behave the same. Both sold and mold are developed >> by us and our contributors.

btw, and whether mold merge all sold functions?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sold is not actively maintained anymore because with Xcode 15, Apple has made their linker much faster than it was. So you want to recommend it instead of sold. IIRC, the Apple's new linker is available as ld-prime after installing Xcode 15.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sold is not actively maintained anymore because with Xcode 15, Apple has made their linker much faster than it was. So you want to recommend it instead of sold. IIRC, the Apple's new linker is available as ld-prime after installing Xcode 15.

@rui314 @H4ad @anonrig Hi folks, can you help to ensure that the new linker ld-prime works, which point by Rui

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Apple's linker is not my product, and I no longer working on macOS, I don't know whether that LDFLAGS works or not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have macos :/

Also, as mentioned by @anonrig, I think we should remove mold from macos section and don't use sold since is not maintained anymore.

Copy link
Contributor Author

@congzhangzh congzhangzh Mar 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, got it, I will do a pull request later:)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have macos :/

Also, as mentioned by @anonrig, I think we should remove mold from macos section and don't use sold since is not maintained anymore.

@H4ad I create a merge request to fix it, #52252

```

This will allow for near-instantaneous rebuilds when switching branches back
Expand All @@ -565,6 +569,10 @@ the specified directory. The JS debugger of Visual Studio Code supports this
configuration since the November 2020 version and allows for setting
breakpoints.

Refs:
1. https://ccache.dev/performance.html
2. https://github.com/rui314/mold

#### Troubleshooting Unix and macOS builds

Stale builds can sometimes result in `file not found` errors while building.
Expand Down
Loading