Issue #17845 has been updated by larskanis (Lars Kanis).


Thinking a bit more about the ABI incompatibilities convinced me more about the need to differentiate the ruby platforms on Windows. So I added another patch to https://github.com/ruby/ruby/pull/4599 which sets `CONFIG['arch']` and `RUBY_PLATFORM` to "x64-mingw-ucrt".

This allows easy differentiation between ABI incompatible platforms like MSWIN64 and MSVCRT-based MINGW32 and it also implicates a distinct rubygem platform which is also "x64-mingw-ucrt". See also the [table in the pull request](https://github.com/ruby/ruby/pull/4599).

Although the term "mingw32" is the OS-part even for 64 bit systems, the "32" is misleading and confusing for many users. Therefore the new platform string drops the "32" from the OS part to just "mingw". This conforms to the common practice of windows platform testing per RUBY_PLATFORM=~/mswin|mingw/ .

Binaries are available here: https://github.com/oneclick/rubyinstaller2/releases/tag/rubyinstaller-head

I did some testing with several rails apps on rubyinstaller-head (x64-mingw-ucrt) and it did not show any regressions. There is only one issue with bundler: x64-mingw-ucrt is treated as platform "ruby" and "mri" in the Gemfile. This is probably conform to the understanding of most users, but it is against the specification of [bundlers platform argument](https://github.com/rubygems/rubygems/blob/96e5cff3df491c4d943186804c6d03b57fcb459b/bundler/lib/bundler/man/gemfile.5.ronn#platforms) which classifies "mri" as NOT Windows.

----------------------------------------
Feature #17845: Windows Ruby - ucrt build?
https://bugs.ruby-lang.org/issues/17845#change-92646

* Author: MSP-Greg (Greg L)
* Status: Open
* Priority: Normal
* Target version: 3.1
----------------------------------------
Currently, Windows Ruby is normally compiled two ways.

The first, mswin, is compiled using Microsoft's current Visual C compiler, and links to the universal runtime (ucrt).

The second, mingw, is compiled using MinGW gcc.  This links to msvcrt, an older version of Microsoft's Visual C runtime.

Previously, all the MSYS2 MinGW packages linked to msvcrt.  The MSYS2 project is now releasing build tools and packages linking to ucrt.

MSYS2 has provided ruby packages, and GitHub user @Biswa96 contributed https://github.com/msys2/MINGW-packages/pull/8518, allowing Ruby to compile with ucrt.

I tried the patch with ruby-loco, and it builds.  There are some test issues, haven't had a chance to look at them yet.

Normally, using exe/dll/so files together that use different versions of the runtime is not a good idea.  Building extension gems with ucrt may provide gems that can be used with mswin, but can't be compiled due to issues with Visual C (vs gcc).  Also, packages from the vcpkg project may be compatible with Ruby ucrt.

The reason for this post is that Windows Ruby built with ucrt is essentially another platform, but the build 'looks like' a mingw build.

This is really a third platform choice.  What should it be called? Things like `CONFIG['RUBY_SO_NAME']`, `RUBY_PLATFORM`, etc?

---Files--------------------------------
ruby-mingw32-ucrt.patch (622 Bytes)
ruby-configure-mingw32-ucrt.patch (687 Bytes)
ruby-configure-coroutine-mingw32.patch (351 Bytes)
ruby-i386-mingw32-ucrt-undef.patch (398 Bytes)
ruby-date-mingw32-ucrt-timezone.patch (333 Bytes)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>