Issue #7921 has been updated by luislavena (Luis Lavena).


mame (Yusuke Endoh) wrote:
> Could the version of mingw build rc2?
> 

I no longer have "mingw" installed on this box, only mingw-w64 version of compiler.

This version of compiler cannot build rc2, same error as the report:

 compiling ../dln.c
 In file included from ../include/ruby/defines.h:153:0,
                  from ../include/ruby/ruby.h:70,
                  from ../dln.c:13:
 ../include/ruby/win32.h: In function ???rb_w32_pow???:
 ../include/ruby/win32.h:787:5: error: implicit declaration of function ???_controlfp???
 ../include/ruby/win32.h:788:16: error: ???_PC_64??? undeclared (first use in this function)
 ../include/ruby/win32.h:788:16: note: each undeclared identifier is reported only once for each function it appears in
 ../include/ruby/win32.h:788:24: error: ???_MCW_PC??? undeclared (first use in this function)
 make: *** [dln.o] Error 1

> I'm not sure if the file "_mingw_float.h" does always exist when defined(__MINGW64_VERSION_MAJOR) is true.
> 

This is a known problem of old mingw-w64 headers, which has been solved in newer versions.

RubyInstaller CI uses newer (4.7.2) version, so the problem is not seeing there.

Since mingw-w64 no longer provides darwin builds, I cannot test recent versions for cross-compilation but if _MCW_PC or _PC_64 is undefined, then we can assume include of _mingw_float.h is required.

----------------------------------------
Bug #7921: Cross-compiling ruby_2_0_0 to Windows is failing (rb_w32_pow)
https://bugs.ruby-lang.org/issues/7921#change-36889

Author: luislavena (Luis Lavena)
Status: Assigned
Priority: Urgent
Assignee: nobu (Nobuyoshi Nakada)
Category: build
Target version: 2.0.0
ruby -v: ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.2.1]


=begin
Hello,

Cross-compilation of Ruby targeting Windows (using MinGW) is an important tool for Linux/OSX developers to provide pre-compiled binary gems for Windows users. Having cross-compilation failing for Ruby 2.0 will complicate the installation of gems for the new version, as developers will not be able to provide these binaries for suers.

The error that is being triggered is coming from undefined elements:

 compiling ../dln.c
 In file included from ../include/ruby/defines.h:153:0,
                  from ../include/ruby/ruby.h:70,
                  from ../dln.c:13:
 ../include/ruby/win32.h: In function ???rb_w32_pow???:
 ../include/ruby/win32.h:787:5: error: implicit declaration of function ???_controlfp???
 ../include/ruby/win32.h:788:16: error: ???_PC_64??? undeclared (first use in this function)
 ../include/ruby/win32.h:788:16: note: each undeclared identifier is reported only once for each function it appears in
 ../include/ruby/win32.h:788:24: error: ???_MCW_PC??? undeclared (first use in this function)
 make: *** [dln.o] Error 1

This is easily fixed by including MinGW private header _mingw_float.h:

 diff --git a/include/ruby/win32.h b/include/ruby/win32.h
 index a2eec0c..494b522 100644
 --- a/include/ruby/win32.h
 +++ b/include/ruby/win32.h
 @@ -776,6 +776,7 @@ rb_w32_pow(double x, double y)
      return powl(x, y);
  }
  #elif defined(__MINGW64_VERSION_MAJOR)
 +#include <_mingw_float.h>
  /*
   * Set floating point precision for pow() of mingw-w64 x86.
   * With default precision the result is not proper on WinXP.

I want to test this further with other cross-compiler and native compiler combinations before commit, but wanted to open this up before official 2.0 release.

Thank you.
=end



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