Project

General

Profile

Actions

Misc #18362

closed

mswin builds & vs2022

Added by MSP-Greg (Greg L) almost 3 years ago. Updated about 2 years ago.

Status:
Third Party's Issue
Assignee:
-
[ruby-core:106268]

Description

With VS2022, I believe _MSC_VER is 1930, so I added the following patch so a VS2019 build might compile extension gems using VS2022. Psych compiled and passed its tests using something similar. I don't know enough about MSVC to know what versions are compatible, for instance using a VS2016 Ruby with VS2019, or even VS2022.

I posted this due to release being just a few weeks away, VS2022 is released, and Actions also has it available on the windows-2022 image...

diff --git a/win32/setup.mak b/win32/setup.mak
index 5294a49ee9..4f7decfd11 100644
--- a/win32/setup.mak
+++ b/win32/setup.mak
@@ -159,7 +159,7 @@ echo RUBY_DEVEL = yes
 set /a MSC_VER = _MSC_VER
 #if _MSC_VER > 1900
 set /a MSC_VER_LOWER = MSC_VER/10*10+0
-set /a MSC_VER_UPPER = MSC_VER/10*10+9
+set /a MSC_VER_UPPER = MSC_VER/10*10+19
 #endif
 set MSC_VER
 del %0 & exit

As to master, I ran the ruby-loco mswin build with VS2022, and the following failures/errors were generated. There may be more errors, as it only ran the tests that I run parallel. It did not run the spec tests (ruby-loco's mingw & ucrt builds use a different build script, so they run all tests with every CI job).

Not sure if this is helpful. Thanks, Greg

3.1.0dev (2021-11-24T21:15:12Z master 9faa599196) [x64-mswin64_140]

 1) Failure:
  TestFixnum#test_divmod [D:/a/ruby-loco-test/ruby-loco-test/src/test/ruby/test_fixnum.rb:111]:
  FloatDomainError expected but nothing was raised.

 2) Failure:
  TestFixnum#test_div [D:/a/ruby-loco-test/ruby-loco-test/src/test/ruby/test_fixnum.rb:83]:
  [FloatDomainError] exception expected, not #<NoMethodError: undefined method `nan?' for 0:Integer>.

 3) Failure:
  Complex_Test#test_to_s [D:/a/ruby-loco-test/ruby-loco-test/src/test/ruby/test_complex.rb:654]:
  <"NaN+NaN*i"> expected but was
  <"N.aNe+9998+N.aNe+9998i">.

 4) Failure:
  TestSH#test_period2 [D:/a/ruby-loco-test/ruby-loco-test/src/test/date/test_switch_hitter.rb:455]:
  <-3937334558197515411197987355> expected but was
  <-3937415408616583513528860675>.

 5) Failure:
  JSONGeneratorTest#test_allow_nan [D:/a/ruby-loco-test/ruby-loco-test/src/test/json/json_generator_test.rb:197]:
  <"[NaN]"> expected but was
  <"[N.aNe+9998]">.

 6) Failure:
  TestBigDecimal#test_cmp_coerce [D:/a/ruby-loco-test/ruby-loco-test/src/test/bigdecimal/test_bigdecimal.rb:646]:
  [ruby-core:64190].
  Expected 0.0 to be < Infinity.

 7) Failure:
  TestFloat#test_divmod [D:/a/ruby-loco-test/ruby-loco-test/src/test/ruby/test_float.rb:181]:
  FloatDomainError expected but nothing was raised.

 8) Failure:
  TestFloat#test_to_s [D:/a/ruby-loco-test/ruby-loco-test/src/test/ruby/test_float.rb:215]:
  <"NaN"> expected but was
  <"-N.aNe+9998">.

 9) Failure:
  TestFloat#test_div [D:/a/ruby-loco-test/ruby-loco-test/src/test/ruby/test_float.rb:190]:
  [FloatDomainError] exception expected, not #<NoMethodError: undefined method `nan?' for 0:Integer>.

10) Failure:
  Rational_Test#test_to_r [D:/a/ruby-loco-test/ruby-loco-test/src/test/ruby/test_rational.rb:917]:
  FloatDomainError expected but nothing was raised.

11) Failure:
  Rational_Test#test_rationalize [D:/a/ruby-loco-test/ruby-loco-test/src/test/ruby/test_rational.rb:967]:
  FloatDomainError expected but nothing was raised.

12) Failure:
  Rational_Test#test_conv [D:/a/ruby-loco-test/ruby-loco-test/src/test/ruby/test_rational.rb:163]:
  FloatDomainError expected but nothing was raised.

13) Error:
  TestBignum#test_cmp:
  FloatDomainError: Infinity
      D:/a/ruby-loco-test/ruby-loco-test/src/test/ruby/test_bignum.rb:229:in `test_cmp'
      D:/a/ruby-loco-test/ruby-loco-test/src/tool/test/runner.rb:23:in `<top (required)>'
      ../src/test/runner.rb:14:in `require_relative'
      ../src/test/runner.rb:14:in `<main>'

   14) Error:
  TestBigDecimal#test_BigDecimal_with_float:
  ArgumentError: can't omit precision for a Float.
      D:/a/ruby-loco-test/ruby-loco-test/src/test/bigdecimal/test_bigdecimal.rb:167:in `BigDecimal'
      D:/a/ruby-loco-test/ruby-loco-test/src/test/bigdecimal/test_bigdecimal.rb:167:in `block in test_BigDecimal_with_float'
      D:/a/ruby-loco-test/ruby-loco-test/src/test/bigdecimal/test_bigdecimal.rb:165:in `save_exception_mode'
      D:/a/ruby-loco-test/ruby-loco-test/src/test/bigdecimal/test_bigdecimal.rb:165:in `test_BigDecimal_with_float'

15) Error:
  TestFloat#test_cmp:
  FloatDomainError: Infinity
      D:/a/ruby-loco-test/ruby-loco-test/src/test/ruby/test_float.rb:341:in `<=>'
      D:/a/ruby-loco-test/ruby-loco-test/src/test/ruby/test_float.rb:341:in `test_cmp'

Updated by nobu (Nobuyoshi Nakada) almost 3 years ago

  • Status changed from Open to Third Party's Issue

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

Visual Studio 2022 version 17.0.6 released at February 8 seems still unfixed.

I wonder how we deal with this issue (easy -> hard order):

  1. wait the fix (or abandon VS2022)
  2. disable O2 optimization on VS2022
  3. disable __assume() on VS2022
  4. rewrite sources not to use isinf() and isnan() together

It is possible to rewrite ruby itself's source files using fpclassify(),
but the similar modification will be needed for extension libraries,
including bundled and un-bundled.
This is a patch for 3.

Updated by nobu (Nobuyoshi Nakada) about 2 years ago

This bug is fixed by "Microsoft(R) C/C++ Optimizing Compiler Version 19.33.31629 for x64".
And applied to GitHub Actions at runner-image 20220821.1.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0