-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Improvements to building and CI for mingw/msys #121182
Conversation
src/bootstrap runs git to find the root of the repository, but this can go awry when building in MSYS for the mingw target. This is because MSYS git returns a unix-y path, but bootstrap requires a Windows-y path.
rustbot has assigned @Mark-Simulacrum. Use r? to explicitly pick a reviewer |
This PR modifies If appropriate, please update |
cc @mati865 -- perhaps you can weigh in here? My knowledge of Windows isn't deep enough to say whether this moves us in the right direction or how closely affiliated the msys2 org/github action is with the upstream project (i.e. is trusting it equivalent to trusting msys2 artifacts?). We may still want to replicate the artifacts as I think we were doing before into our own cache regardless... |
I'm currently ill and don't want to make any statements because of my impaired ability to understand the code. |
I did think about Cygpath, but just getting git to give us the path of |
In overall looks good but I'm not sure whether Rust should install MSYS2 each time as it adds another possible point of failure to the CI. However if the caching works good this might not be a problem. |
I'm going to go ahead and approve. I'm not an expert on this area but my sense is that this should be easy to revert if needed, so that's my preferred approach here. @bors r+ |
🌲 The tree is currently closed for pull requests below priority 50. This pull request will be tested once the tree is reopened. |
☀️ Test successful - checks-actions |
Just a note but it seems that the mingw builders are now the slowest by roughly 20 to 30 minutes.
This is a fair increase from the roughly 1hr 40m it took before. I don't know if that was expected. |
That doesn't sound expected to me. I'd be in favor of reverting and adjusting as needed before relanding. |
Finished benchmarking commit (0ecbd06): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 651.083s -> 649.512s (-0.24%) |
Agreed. Initially, I thought it might be a cache issue that would hopefully improve. But on second thought, I think it's just the slowness of Cygwin/MSYS2 Git. |
Sorry, haven't managed to take a look yesterday.
So indeed everything that uses Git became much slower and I don't see any way to regain the performance other than reverting CI changes part of this PR. |
Unfortunately, MSYS's Git is just slow. I thought it would be neater if it were tested in CI so that we can confidently suggest using it in the build instructions. But if it really is unbearably slow, we could perhaps take another approach. Maybe we could tell people to steer clear of MSYS Git and just install Git-for-Windows instead, although that's a bit of a pain to have to install a separate thing. I don't understand the difference in time for the "checkout the source code" step, there shouldn't be a difference. Although taking a closer look, maybe the "disable git crlf conversion" step isn't applying to the checkout action because the config is going in the wrong home directory, and the extra work of expanding the line endings accounts for the extra time taken? (We could run that script twice, once in MSYS Bash and once in Git Bash, to make sure it gets configured everywhere). For I think quite a lot of this would be sped up by just moving back to using Git-for-Windows for mingw builds, but if we do that we should probably list it as a stronger requirement in the build instructions. |
Sorry, I was sleepy and haven't realised MSYS2 is installed after the checkout. Longer checkout must have been a noise.
If you enable timestamps you can see:
Which means CI spent 7 minutes between lines rust/src/ci/scripts/install-msys2.sh Line 29 in ef32456
rust/src/ci/scripts/install-msys2.sh Line 47 in ef32456
Pactoys install is fast because it's tiny so calling rm is the only thing left.
I'll revive #110369 over the weekend and see if build time of newer version is acceptable. It should be even faster than Git for Windows. |
With the latest version the time goes from 10s to 13s on my PC so about 30% increase, definitely an improvement but still not ideal. @majaha are you going to revert CI changes? |
I'd rather not revert all the CI changes as I think parts of it are more sensible than what was there before. But I'm willing to try and fix up the main issues, if you wouldn't mind pointing me to what you think they are. The biggest issue is this: |
It was regarding part the comment that I quoted:
What that PR did was avoiding calling Git binary by using a native library so we avoid Cygwin issues. The downside is longer build time for bootstrap binary and this is shown by those numbers (tested on Linux).
As you already noticed reverting back to GfW would cut down significant amount of time. |
In rust-lang#121182 the mingw build was changed to use MSYS2's version of Git. This commit reverts that, as it was considered too slow.
I've made the pull request to revert the git change: #122125 |
…crum Revert back to Git-for-Windows for MinGW CI builds Following discussion in rust-lang#121182 it was decided to revert using MSYS2 Git for mingw builds.
…crum Revert back to Git-for-Windows for MinGW CI builds Following discussion in rust-lang#121182 it was decided to revert using MSYS2 Git for mingw builds.
…crum Revert back to Git-for-Windows for MinGW CI builds Following discussion in rust-lang#121182 it was decided to revert using MSYS2 Git for mingw builds.
…crum Revert back to Git-for-Windows for MinGW CI builds Following discussion in rust-lang#121182 it was decided to revert using MSYS2 Git for mingw builds.
Rollup merge of rust-lang#122125 - majaha:mingw_ci_new, r=Mark-Simulacrum Revert back to Git-for-Windows for MinGW CI builds Following discussion in rust-lang#121182 it was decided to revert using MSYS2 Git for mingw builds.
Having a quick flick through this log: https://github.com/rust-lang-ci/rust/actions/runs/8220783357/job/22480355462 It seems like cleaning up the tools by rm-ing them is taking four to seven minutes. I'm going to go ahead and write the patch that moves them instead. |
Patch is up over here: #122321 |
Revert back to Git-for-Windows for MinGW CI builds Following discussion in rust-lang/rust#121182 it was decided to revert using MSYS2 Git for mingw builds.
`mv` tools off the path instead of `rm -r`-ing them in `install-msys2.sh` This is a follow up patch to rust-lang#121182 r? `@Mark-Simulacrum`
`mv` tools off the path instead of `rm -r`-ing them in `install-msys2.sh` This is a follow up patch to rust-lang/rust#121182 r? `@Mark-Simulacrum`
`mv` tools off the path instead of `rm -r`-ing them in `install-msys2.sh` This is a follow up patch to rust-lang/rust#121182 r? `@Mark-Simulacrum`
`mv` tools off the path instead of `rm -r`-ing them in `install-msys2.sh` This is a follow up patch to rust-lang/rust#121182 r? `@Mark-Simulacrum`
I was getting error messages when trying to follow the build instructions the mingw build for Rust, and managed to track the issue down to an incomparability of Rust's bootstrap program with MSYS2's version of git. Essentially, the problem is that MSYS2's git works in emulated unix-y paths, but bootstrap expects a Windows path. I found a workaround for this by using relative paths instead of absolute paths.
Along with that fix, this PR also updates the build instructions for MinGW to be compatible with modern versions of MSYS2, and some changes to CI to make sure that MSYS2's version of git is tested. In particular, I'm suggesting using the MSYS2 github action specially made for this purpose, which is much less hacky than the old approach and gives us more control of what packages are installed. I also cleaned up as many alternate versions of key tools as I could find from PATH, to avoid accidental usage, and cleaned up some abuses of the
CUSTOM_MINGW
environment variable.This fixes #105696 and fixes #117567