Project

General

Profile

Actions

Bug #7921

closed

Cross-compiling ruby_2_0_0 to Windows is failing (rb_w32_pow)

Added by luislavena (Luis Lavena) about 11 years ago. Updated over 10 years ago.

Status:
Third Party's Issue
Target version:
ruby -v:
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.2.1]
Backport:
[ruby-core:52742]

Description

=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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0