1

I am switching between building different PR branches (ie I built one PR author's branch and now I am building a different PR author's branch).

Jon Atack's doc suggests:

On the other hand, when you change the build configuration, and in some cases when testing different PRs, or when the build isn't working, it's often best to start with a clean slate using make clean or make distclean before configuring.

Should I always run make clean in between builds?

edit: Jon Atack has since updated his doc. Here is the updated guidance.

On the other hand, when you change the build configuration (e.g. for a fuzz build), or you are building a branch containing substantial changes to the autoconf/automake scripts, or when the build isn't working, it's often best to start with a clean slate using make clean or make distclean.

1 Answer 1

1

You could always run make clean between builds but a lot of the time it won't be necessary and it is slower.

Pieter Wuille usually doesn't run make clean and only runs it when the build fails.

If it still fails after that he runs git clean -dfx. Warning: This deletes everything and resets your work directory to a fresh checkout. You'll need to autogen.sh again.

(Glen Willen suggests running git clean -dfX instead of git clean -dfx as X only removes ignored files, x also removes locally added non-ignored files, including e.g. new code you did not yet call git add on)

make clean is only necessary when the configuration changes. This could be because you run ./configure with different flags or it could be because there are substantial changes to the autoconf/automake scripts when changing branches. Of course the act of changing branches isn't relevant as the build system doesn't know or care that you are using Git. The build system just sees some code and/or configure scripts changed and re-runs them as necessary. Without make clean it will just see existing .o files not realizing that the rules used to build them have changed

Jon Atack usually doesn't run make clean but does if there is slight weirdness or if switching to fuzz build or back.

Thanks to Pieter Wuille, Jon Atack, Marco Falke and Glen Willen for answering this question on IRC.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.