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
Windows: Add support for MINGW-UCRT based ruby #193
Comments
There is a corresponding issue for MINGW package installation here: ruby/setup-ruby-pkgs#15 Nokogiri is a project that fails due to wrong PATH and package prefix here: https://github.com/sparklemotion/nokogiri/runs/2837044316?check_suite_focus=true |
Thanks for the info. Actions, unlike Travis or AppVeyor, isolates the ENV from step to step. Actions has defined an API in their node.js code that allow custom actions repos (like this) to make changes to |
I've got patches for both this repo and
The first is used to test whether it's a ucrt build without starting Ruby. That's used here. The second is used by If checks like that should continue to exist, I'll push two PR's... |
Thanks for working on this!
The assumptions are correct and should be stable. In the unlikely event, that other ruby-core members prefer a different naming, we can change this until ruby-3.1 is released. |
The corresponding ticket for the changes to ruby-core is here: https://bugs.ruby-lang.org/issues/17845 |
This enables a temporary branch on ruby/setup-ruby and MSP-Greg/setup-ruby-pkgs for UCRT-capable action setup. They set correct PATH and MINGW_PACKAGE_PREFIX for UCRT, if a UCRT based ruby is used. See here for more details: ruby/setup-ruby#193 To enable correct UCRT settings this therefore uses rubyinstaller-head as base ruby, since it is already UCRT based.
This enables a temporary branch on ruby/setup-ruby and MSP-Greg/setup-ruby-pkgs for UCRT-capable action setup. They set correct PATH and MINGW_PACKAGE_PREFIX for UCRT, if a UCRT based ruby is used. See here for more details: ruby/setup-ruby#193 To enable correct UCRT settings this therefore uses rubyinstaller-head as base ruby, since it is already UCRT based.
This enables a temporary branch on ruby/setup-ruby and MSP-Greg/setup-ruby-pkgs for UCRT-capable action setup. They set correct PATH and MINGW_PACKAGE_PREFIX for UCRT, if a UCRT based ruby is used. See here for more details: ruby/setup-ruby#193 To enable correct UCRT settings this therefore uses rubyinstaller-head as base ruby, since it is already UCRT based.
This enables a temporary branch on ruby/setup-ruby and MSP-Greg/setup-ruby-pkgs for UCRT-capable action setup. They set correct PATH and MINGW_PACKAGE_PREFIX for UCRT, if a UCRT based ruby is used. See here for more details: ruby/setup-ruby#193 To enable correct UCRT settings this therefore uses rubyinstaller-head as base ruby, since it is already UCRT based.
This enables a temporary branch on ruby/setup-ruby and MSP-Greg/setup-ruby-pkgs for UCRT-capable action setup. They set correct PATH and MINGW_PACKAGE_PREFIX for UCRT, if a UCRT based ruby is used. See here for more details: ruby/setup-ruby#193 To enable correct UCRT settings this therefore uses rubyinstaller-head as base ruby, since it is already UCRT based.
This enables a temporary branch on ruby/setup-ruby and MSP-Greg/setup-ruby-pkgs for UCRT-capable action setup. They set correct PATH and MINGW_PACKAGE_PREFIX for UCRT, if a UCRT based ruby is used. See here for more details: ruby/setup-ruby#193 To enable correct UCRT settings this therefore uses rubyinstaller-head as base ruby, since it is already UCRT based.
This enables a temporary branch on ruby/setup-ruby and MSP-Greg/setup-ruby-pkgs for UCRT-capable action setup. They set correct PATH and MINGW_PACKAGE_PREFIX for UCRT, if a UCRT based ruby is used. See here for more details: ruby/setup-ruby#193 To enable correct UCRT settings this therefore uses rubyinstaller-head as base ruby, since it is already UCRT based.
This enables a temporary branch on ruby/setup-ruby and MSP-Greg/setup-ruby-pkgs for UCRT-capable action setup. They set correct PATH and MINGW_PACKAGE_PREFIX for UCRT, if a UCRT based ruby is used. See here for more details: ruby/setup-ruby#193 To enable correct UCRT settings this therefore uses rubyinstaller-head as base ruby, since it is already UCRT based.
This enables a temporary branch on ruby/setup-ruby and MSP-Greg/setup-ruby-pkgs for UCRT-capable action setup. They set correct PATH and MINGW_PACKAGE_PREFIX for UCRT, if a UCRT based ruby is used. See here for more details: ruby/setup-ruby#193 To enable correct UCRT settings this therefore uses rubyinstaller-head as base ruby, since it is already UCRT based.
This enables a temporary branch on ruby/setup-ruby and MSP-Greg/setup-ruby-pkgs for UCRT-capable action setup. They set correct PATH and MINGW_PACKAGE_PREFIX for UCRT, if a UCRT based ruby is used. See here for more details: ruby/setup-ruby#193 To enable correct UCRT settings this therefore uses rubyinstaller-head as base ruby, since it is already UCRT based.
This enables a temporary branch on ruby/setup-ruby and MSP-Greg/setup-ruby-pkgs for UCRT-capable action setup. They set correct PATH and MINGW_PACKAGE_PREFIX for UCRT, if a UCRT based ruby is used. See here for more details: ruby/setup-ruby#193 To enable correct UCRT settings this therefore uses rubyinstaller-head as base ruby, since it is already UCRT based.
This enables a temporary branch on ruby/setup-ruby and MSP-Greg/setup-ruby-pkgs for UCRT-capable action setup. They set correct PATH and MINGW_PACKAGE_PREFIX for UCRT, if a UCRT based ruby is used. See here for more details: ruby/setup-ruby#193 To enable correct UCRT settings this therefore uses rubyinstaller-head as base ruby, since it is already UCRT based.
This enables a temporary branch on ruby/setup-ruby and MSP-Greg/setup-ruby-pkgs for UCRT-capable action setup. They set correct PATH and MINGW_PACKAGE_PREFIX for UCRT, if a UCRT based ruby is used. See here for more details: ruby/setup-ruby#193 To enable correct UCRT settings this therefore uses rubyinstaller-head as base ruby, since it is already UCRT based.
This enables a temporary branch on ruby/setup-ruby and MSP-Greg/setup-ruby-pkgs for UCRT-capable action setup. They set correct PATH and MINGW_PACKAGE_PREFIX for UCRT, if a UCRT based ruby is used. See here for more details: ruby/setup-ruby#193 To enable correct UCRT settings this therefore uses rubyinstaller-head as base ruby, since it is already UCRT based.
@MSP-Greg @larskanis What should we do now? #197 seems a superset of #194. There is mention of making it faster in #194 (comment) but I don't see any PR about that. |
The repo that packages the mingw & ucrt build tools is now running as a cron job. Same as ruby-loco, three times a day. It takes all of 4 minutes to package both mingw64 and ucrt. Given that the Window 2022 image has no MSYS2 build tools installed, it requires code to even use the MinGW64 tools that were installed on Window 2019. Hence, maybe make ucrt only available on Windows 2022?
At present, yes. I will probably create a ruby-ucrt (like ruby-mingw) build, same things, fully tested, etc. I'll review the code I wrote, and revise it to install mingw on Windows 2022. Give me a few days. setup-ruby-pkgs will also need updates so it knows whether to install mingw or urct packages... |
Thank you @MSP-Greg for working on this issue again! I agree with you that your approach is the best. As mentioned before, my additional proposal is to set environment variables by
If it's not too much work, I'd like to have it available on 2019 too. |
Sure. I'll set it up with So, we'll download the prebuilt build tools (both mingw & ucrt) for Windows 2022, and download the ucrt tools for 2019. mingw 2019 and earlier we'll leave the same. Thanks for your work here and elsewhere... |
Ok, I really thought about this (Actions refresher). I got this running, with a few issues. I modified the Puma CI, and both mingw and ucrt compiled and passed tests running under Windows-2019 and Windows-2022. The run is at https://github.com/MSP-Greg/puma/actions/runs/1318661970, which shows the output and timing generated. See the 'load ruby, ragel' step.
This is more general and separate from the above. The main functionality in
I originally created it to allow simplifying scripts so one wouldn't need to have conditional platform testing, multiple shell syntaxes, etc. I may have a few more inputs that are used with mswin. Anway, since more and more package handling needs to move to |
I forgot that there is code to process the ENV changes created by Re some way to force a tools selection that is different than the 'selected' Ruby version, maybe an ENV variable is a good selector? That way an additional input variable is not needed for the action? |
@eregon @hsbt @larskanis @nobu Sorry all for the ping. Some of the information here you may already know, but I thought a summary might be in order. Almost all of it is Windows specific. Two changes have recently happened. Actions has released a windows-2022 image, and they've made changes to the installed MSYS2 build tools. Additionally, the MSYS2 group released a new set of build tools (ucrt64). It differs from mingw64 in the Microsoft Visual C (MSVC) runtime it's compiled with, as ucrt64 uses a newer runtime. For Windows mingw and ucrt Ruby, build tools are comprised of two sets of code. The MSYS2 tools are generic build tools (like bison), and also files to provide a shell. The windows-2019 image includes both. The windows-2022 image includes only the shell component. The other set is the gcc tools and packages. The windows-2019 image includes mingw64 gcc and some packages, but does not include any ucrt64 tools/packages. The windows-2022 image does not include any gcc tools/packages. Summarizing installed tools:
Given the above, there's quite a bit needed to use the windows-2022 image. I think the most efficient way to do this is to pre-build three zip (7z) files, one each for MSYS2, MINGW64, and UCRT64, then install those as needed, rather than every Actions job performing several operations and hitting the MSYS2 servers with each one. The pre-built files are generated three times a day in MSP-Greg/setup-msys2-gcc and the 7z files are saved in a release. The code removes most of the doc and man pages, decreasing the time needed to decompress them. Note that for Ruby org repos (Ruby and extension libraries/gems) using windows-2022 in CI, it should no longer be neccessary to use MSP-Greg/setup-ruby-pkgs, as all the needed packages will be installed by setup-ruby, as the files include everything needed. For windows-2019 builds, the ucrt64 file supplies everything, but msys2 and/or mingw64 packages will still need to be installed. The above is implemented in PR #224 here. NOTES:
MISC: Below are just thoughts...
|
All done now AFAIK |
RubyInstaller-3.1 is planned to be released as UCRT based build. RubyInstaller-head is already UCRT based for the x64 architecture. The x86 32-bit architecture will not change. UCRT is the modern C runtime, that MS Visual C compiler is using since years, while RubyInstaller up to 3.0 uses the ancient MSVCRT.
The main difference from a users point of view are that the PATH to the MINGW tools changes and that the MSYS2-MINGW packages have a new prefix. The PATH is
C:/msys64/ucrt64/bin/
instead of
C:/msys64/mingw64/bin/
and the package is
mingw-w64-ucrt-x86_64
instead of
mingw-w64-x86_64
The MINGW PATH is currently hardcoded here:
setup-ruby/common.js
Line 174 in 6f2028e
It needs to be dependent on the ruby version.
Note: The
ridk exec
orridk enable
commands installed by RubyInstaller respect the different MINGW PATH and MINGW package prefix on UCRT already. So ifridk
is used in the target project's CI, everything works already: https://github.com/oneclick/rubyinstaller2/blob/4300b3dbf4c2d9bae1522188ecccf7294b2e7617/lib/ruby_installer/build/msys2_installation.rb#L23-L35The text was updated successfully, but these errors were encountered: