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

ccache/ninja does not work when switching branches. #49967

Closed
zhxinyu opened this issue Sep 29, 2023 · 5 comments · Fixed by #50133
Closed

ccache/ninja does not work when switching branches. #49967

zhxinyu opened this issue Sep 29, 2023 · 5 comments · Fixed by #50133

Comments

@zhxinyu
Copy link

zhxinyu commented Sep 29, 2023

Version

v21.0.0-pre

Platform

Darwin Siri-Pro.local 21.6.0 Darwin Kernel Version 21.6.0: Wed Aug 10 14:25:27 PDT 2022; root:xnu-8020.141.5~2/RELEASE_X86_64 x86_64

Subsystem

No response

What steps will reproduce the bug?

No response

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?

No response

What do you see instead?

As suggested in the building.md, we should have near instantaneous build even when switching branches.

However, when I switched the branch in my local, I can see that it restarted the building process for make.

<username>@<hostname> node % git checkout main
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
<username>@<hostname> node % make
+ exec ./configure --ninja
Node.js configure: Found Python 3.10.13...
INFO: configure completed successfully
ninja -C out/Release  
ninja: Entering directory `out/Release'
[3/3914] CC obj/deps/v8/third_party/zlib/v8_zlib.cpu_features.o

Additional information

No response

@aduh95
Copy link
Contributor

aduh95 commented Sep 30, 2023

Why is that the expected behavior?

@zhxinyu
Copy link
Author

zhxinyu commented Sep 30, 2023

The expected behavior should be we should have near instantaneous build even when switching branches.
As suggested in the building.md file.

@joyeecheung
Copy link
Member

joyeecheung commented Oct 9, 2023

Hmm, I don’t think make is supposed to use ninja by default unless you set BUIlD_WITH=ninja in the environment. But I think I have been able to use ccache + ninja just fine most of the time unless deps/v8 gets updated (in particular, the headers, because V8 is just structured in a way that any changes to the headers could lead to almost a rebuild) have you checked if deps/v8 is changed when you switch branches?

@joyeecheung
Copy link
Member

joyeecheung commented Oct 9, 2023

Also I think building.md is a bit misleading here - ccache only helps you when switching between branches that aren’t very different from each other and when the differences themselves would not result in a rebuild. If, for example, a header that most files depend on gets changed, ccache cannot help because you just have to rebuild to see the changes to take effect.

@legendecas
Copy link
Member

legendecas commented Oct 10, 2023

ccache helps in condition like switching between branches back and forth, as the previous compilation results have been cached. I believe the words in the document can be improved.

nodejs-github-bot pushed a commit that referenced this issue Oct 15, 2023
ccache improves the build speed significantly only when the branch was
built before. Building fresh branches with major changes are not
benefited from ccache.

PR-URL: #50133
Fixes: #49967
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
kumarrishav pushed a commit to kumarrishav/node that referenced this issue Oct 16, 2023
ccache improves the build speed significantly only when the branch was
built before. Building fresh branches with major changes are not
benefited from ccache.

PR-URL: nodejs#50133
Fixes: nodejs#49967
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
alexfernandez pushed a commit to alexfernandez/node that referenced this issue Nov 1, 2023
ccache improves the build speed significantly only when the branch was
built before. Building fresh branches with major changes are not
benefited from ccache.

PR-URL: nodejs#50133
Fixes: nodejs#49967
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
targos pushed a commit that referenced this issue Nov 11, 2023
ccache improves the build speed significantly only when the branch was
built before. Building fresh branches with major changes are not
benefited from ccache.

PR-URL: #50133
Fixes: #49967
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants