Project

General

Profile

Actions

Bug #20904

open

3.4.0-preview2: Building miniruby.exe fails for mswin32

Added by jun66j5 (Jun Omae) 12 days ago. Updated 1 day ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:119988]

Description

I tried to build 3.4.0-preview2 with MSVC x86, however linking miniruby.exe failed with the following eror:

linking miniruby.exe
   Creating library miniruby.lib and object miniruby.exp
win32.obj : error LNK2019: unresolved external symbol _GetSystemTimePreciseAsFileTime referenced in function _clock_gettime
miniruby.exe : fatal error LNK1120: 1 unresolved externals

It doesn't fail with MSVC x64.

Investigating it, Windows 8 is required after #20563 but NTVER is still 0x0600 in win32/Makefile.sub. I think it should be 0x0602. Workaround is to invoke win32\configure.bat with --with-ntver=0x0602.

Also, adding temporarily -w24013 to WARNFLAGS in win32/Makefile.sub, the following warning is received.

compiling win32/win32.c
win32.c
win32/win32.c(4789): warning C4013: 'GetSystemTimePreciseAsFileTime' undefined; assuming extern returning int

Updated by nobu (Nobuyoshi Nakada) 11 days ago

  • Status changed from Open to Feedback

jun66j5 (Jun Omae) wrote:

Investigating it, Windows 8 is required after #20563 but NTVER is still 0x0600 in win32/Makefile.sub. I think it should be 0x0602. Workaround is to invoke win32\configure.bat with --with-ntver=0x0602.

Thank you, fixed it by 80cfa57234255667a86d46096093099349a7262a.

Also, adding temporarily -w24013 to WARNFLAGS in win32/Makefile.sub, the following warning is received.

compiling win32/win32.c
win32.c
win32/win32.c(4789): warning C4013: 'GetSystemTimePreciseAsFileTime' undefined; assuming extern returning int

I can't reproduce it with:

  • Visual Studio 2022 Developer Command Prompt v17.12.0
  • Windows 11 SDK Version 10.0.26100.0
  • Windows 11 [Version 10.0.26100.2314]
Actions #2

Updated by nobu (Nobuyoshi Nakada) 11 days ago

  • Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN to 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED

Updated by jun66j5 (Jun Omae) 10 days ago

nobu (Nobuyoshi Nakada) wrote in #note-1:

jun66j5 (Jun Omae) wrote:

Investigating it, Windows 8 is required after #20563 but NTVER is still 0x0600 in win32/Makefile.sub. I think it should be 0x0602. Workaround is to invoke win32\configure.bat with --with-ntver=0x0602.

Thank you, fixed it by 80cfa57234255667a86d46096093099349a7262a.

Thanks for the fix!

Also, adding temporarily -w24013 to WARNFLAGS in win32/Makefile.sub, the following warning is received.

compiling win32/win32.c
win32.c
win32/win32.c(4789): warning C4013: 'GetSystemTimePreciseAsFileTime' undefined; assuming extern returning int

I can't reproduce it with:

  • Visual Studio 2022 Developer Command Prompt v17.12.0
  • Windows 11 SDK Version 10.0.26100.0
  • Windows 11 [Version 10.0.26100.2314]

Weird. I get the warning on the following environments:

I noticed C4013 warnings for _finitef only for x86 by adding -w24013 flag at https://github.com/jun66j5/ruby-build/actions/runs/11993783074/job/33435109634#step:4:580:

D:\a\ruby-build\ruby-build\ruby-3.4.0-preview2\vm_insnhelper.c(6432): warning C4013: '_finitef' undefined; assuming extern returning int
prism/static_literals.c(504): warning C4013: '_finitef' undefined; assuming extern returning int
prism/prism.c(4153): warning C4013: '_finitef' undefined; assuming extern returning int

Checking ucrt/corecrt_math.h, the _finitef seems to be available for x64 but not x86.

Updated by nobu (Nobuyoshi Nakada) 4 days ago

jun66j5 (Jun Omae) wrote in #note-3:

Weird. I get the warning on the following environments:

Weird.
Can you reproduce it locally?
If so, what is shown by nmake process.i && findstr "GetSystemTime" process.i?

I noticed C4013 warnings for _finitef only for x86 by adding -w24013 flag at https://github.com/jun66j5/ruby-build/actions/runs/11993783074/job/33435109634#step:4:580:

D:\a\ruby-build\ruby-build\ruby-3.4.0-preview2\vm_insnhelper.c(6432): warning C4013: '_finitef' undefined; assuming extern returning int
prism/static_literals.c(504): warning C4013: '_finitef' undefined; assuming extern returning int
prism/prism.c(4153): warning C4013: '_finitef' undefined; assuming extern returning int

Checking ucrt/corecrt_math.h, the _finitef seems to be available for x64 but not x86.

It is because https://github.com/ruby/prism/commit/4267161ca7.
The latest MSVC seems to define isinf as a macro using fpclassify, and both seem conform to POSIX and C99.
Older versions of MSVC did not full-support C99, so isinf might not support float argument.
@kddnewton (Kevin Newton), for what version of MSVC is this needed?

Updated by nobu (Nobuyoshi Nakada) 4 days ago ยท Edited

_finitef is stated as x64 and ARM/ARM64 only, in https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/finite-finitef?view=msvc-170#syntax

int _finitef(
   float x
); /* x64 and ARM/ARM64 only */
Actions #6

Updated by nobu (Nobuyoshi Nakada) 4 days ago

  • Status changed from Feedback to Open

Updated by kddnewton (Kevin Newton) 1 day ago

The Prism portion should be fixed by https://github.com/ruby/prism/pull/3270.

Updated by nobu (Nobuyoshi Nakada) 1 day ago

kddnewton (Kevin Newton) wrote in #note-7:

The Prism portion should be fixed by https://github.com/ruby/prism/pull/3270.

Does Prism support older than VS 2015 that is the minimum version for ruby 3.4?
VS 2015 at least supports the generic isinf macro:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/isinf?view=msvc-140

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0