Project

General

Profile

Actions

Bug #2588

closed

Forced definition of stati64 and _stati64 under MinGW

Added by luislavena (Luis Lavena) almost 15 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-mingw32]
Backport:
[ruby-core:27516]

Description

=begin
Appears that stati64 and _stati64 definition is being forced for non-MS compilers:


 #if defined(__BORLANDC__)
 #define stati64(path, st) rb_w32_stati64(path, st)
 #elif !defined(_MSC_VER) || RT_VER < 80
 #define stati64 _stati64
 #define _stati64(path, st) rb_w32_stati64(path, st)
 #else
 #define stati64 _stat64
 #define _stat64(path, st) rb_w32_stati64(path, st)
 #define _fstati64 _fstat64
 #endif
 

Generating the following error during compilation:

 In file included from ../include/ruby/defines.h:205:0,
                  from ../include/ruby/ruby.h:73,
                  from ../include/ruby.h:32,
                  from ../main.c:13:
 ../include/ruby/win32.h:182:0: warning: "_stati64" redefined
 c:/msys/system64/lib/gcc/../../x86_64-w64-mingw32/include/sys/stat.h:71:0: note: this is the location of the previous definition
 ../include/ruby/win32.h:181:17: warning: 'struct _stati64' declared inside parameter list
 ../include/ruby/win32.h:181:17: warning: its scope is only this definition or declaration, which is probably not what you want
 gcc -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -I. -I.ext/include/x86_64-mingw32 -I../include -I.. -DRUBY_EXPORT   -o dln.o -c ../dln.c
 In file included from ../include/ruby/defines.h:205:0,
                  from ../include/ruby/ruby.h:73,
                  from ../dln.c:13:
 ../include/ruby/win32.h:182:0: warning: "_stati64" redefined
 c:/msys/system64/lib/gcc/../../x86_64-w64-mingw32/include/sys/stat.h:71:0: note: this is the location of the previous definition
 ../include/ruby/win32.h:181:17: warning: 'struct _stati64' declared inside parameter list
 ../include/ruby/win32.h:181:17: warning: its scope is only this definition or declaration, which is probably not what you want
 In file included from ../include/ruby/defines.h:205:0,
                  from ../include/ruby/ruby.h:73,
                  from ../dln.c:13:
 ../include/ruby/win32.h: In function 'dln_find_1':
 ../dln.c:1551:17: error: storage size of 'st' isn't known
 make: *** [dln.o] Error 1
 

Seems that latest MinGW defines stati64 properly in sys/stat.h, according to this MSDN article:

http://msdn.microsoft.com/en-us/library/14h5k7ff(VS.71).aspx

The following is the output of compiled GCC code for 32 and 64 bits:

Luis@KEORE ~/Desktop
$ gcc -m32 crt_stat.c -o crt_stat32.exe

Luis@KEORE ~/Desktop
$ gcc crt_stat.c -o crt_stat64.exe

Luis@KEORE ~/Desktop
$ crt_stat32.exe
File size : 698
Drive : C:
Time modified : Sun Jan 10 06:19:17 2010

Luis@KEORE ~/Desktop
$ crt_stat64.exe
File size : 698
Drive : C:
Time modified : Sun Jan 10 06:19:17 2010

Which indicates the problem is not the function, but maybe some incompatibility with Ruby itself?

Please, if possible, let me know any other detail to understand this implementation so I can provide a patch for it.

Thank you.
=end

Actions #1

Updated by luislavena (Luis Lavena) over 14 years ago

=begin
Hello,

Any status update on this? _stati64 is still defined and is not allowing x64 MinGW compilers successfully build Ruby.

As the MSDN article example shows, newer version of GCC (> 3.4.5) already define _stati64.

Thank you for your time.
=end

Actions #2

Updated by nobu (Nobuyoshi Nakada) over 14 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r28811.
Luis, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions #3

Updated by luislavena (Luis Lavena) over 14 years ago

=begin
Can this be backported to ruby_1_9_2? Thank you.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0