-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
rust: Rebuild targets when compiler got updated #12536
base: master
Are you sure you want to change the base?
Conversation
xclaesse
commented
Nov 22, 2023
When the compiler has been updated we need to trigger a reconfigure because any compiler checks result could have changed. In the case the compiler is a wrapper script we cannot detect when the real compiler changed, but this is better than nothing and we should reconfigure when the wrapper itself changed as well anyway.
rustc updates are usually incompatible and requires recompiling of all targets. This adds the compiler exe as dependency of every rust ninja targets. Also try to resolve the real rustc exe being used when the toolchain is wrapped by rustup. Fixes: mesonbuild#10706
ac75f92
to
73257b0
Compare
This is of course not foolproof by any mean. The compiler exe could be wrapper script and we won't detect changes for the real compiler. If the compiler is a symlink it won't detect if the symlink changed. It could cause spurious reconfigure if the toolchain got minor changes that does not require a reconfigure.... But I think it's better than nothing. It's not every day someone update their toolchain, and when they do it's safer to actually rebuild. If that's controversial, I could limit this to only rustc? |
Note that alternatively I could remove |
This means that this won't work for rustup, or not? rustc is just a wrapper in that case, which would execute the correct rustc depending on configured toolchain etc. |
It will indeed not work for rustup. it relies on adding the compiler binary as a |
@@ -631,6 +631,9 @@ def get_exelist(self, ccache: bool = True) -> T.List[str]: | |||
def get_linker_exelist(self) -> T.List[str]: | |||
return self.linker.get_exelist() if self.linker else self.get_exelist() | |||
|
|||
def get_exe_file(self) -> str: | |||
return os.path.realpath(self.exelist_no_ccache[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This returns a bad value when only the executable name is passed (so shouldn't shutil.which()
be used here?)
I tested this patch and the Rust libraries don't get recompiled after only a Rust compiler update (I'm not sure if this is the intended behavior) |