Project

General

Profile

Actions

Backport #1884

closed

ftruncate conflict with mingw32 3.4.5

Added by mhulse (Matt Hulse) over 14 years ago. Updated almost 5 years ago.

Status:
Closed
[ruby-core:24757]

Description

=begin
I have been testing some gems on WinXP SP2, Ruby 1.9.1-p129 mingw32 installer and devkit from rubyinstaller.org. The following output is from an attempt to install FFI:

C:>ruby -v
ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mingw32]

C:>gem install ffi
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.

C:/Ruby/bin/ruby.exe extconf.rb
checking for ffi_closure_alloc() in -lffi... no
creating Makefile
creating extconf.h

make
[...]
gcc -I. -IC:/Ruby/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby/include/ruby-1.9.1/ruby/backward -I/C/Ruby/include/ruby-1.9.1 -I. -I/c/Ruby/lib/ruby/gems/1.9.1/gems/ffi-0.3.5/ext/ffi_c -I/c/Ruby/lib/ruby/gems/1.9.1/gems/ffi-0.3.5/ext/ffi_c/libffi/include -DHAVE_EXTCONF_H -Werror -Wunused -Wformat -I/c/Ruby/lib/ruby/gems/1.9.1/gems/ffi-0.3.5/ext/ffi_c -I/c/Ruby/lib/ruby/gems/1.9.1/gems/ffi-0.3.5/ext/ffi_c/libffi/include -O2 -g -Wall -Wno-parentheses -o Invoker.o -c Invoker.c

In file included from c:/Ruby/include/ruby-1.9.1/ruby/defines.h:192,
from c:/Ruby/include/ruby-1.9.1/ruby/ruby.h:70,
from c:/Ruby/include/ruby-1.9.1/ruby.h:32,
from Invoker.c:11:
c:/Ruby/include/ruby-1.9.1/ruby/win32.h:341: error: conflicting types for 'ftruncate'
C:/Ruby/devkit/gcc/3.4.5/bin/../lib/gcc/mingw32/3.4.5/../../../../include/unistd.h:43: error: previous definition of 'ftruncate' was here
c:/Ruby/include/ruby-1.9.1/ruby/win32.h:341: error: conflicting types for 'ftruncate'
C:/Ruby/devkit/gcc/3.4.5/bin/../lib/gcc/mingw32/3.4.5/../../../../include/unistd.h:43: error: previous definition of 'ftruncate' was here
make: *** [Invoker.o] Error 1

Apparently Ruby 1.9.1 redefines ftruncate in win32.h:341 which conflicts with mingw32. I can get the gem to compile by wrapping line 341 in win32.h with the following:

#if !defined MINGW32
extern int ftruncate(int fd, off_t length);
#endif

Luis from rubyinstaller mentioned that it may be better to check whether ftruncate is defined rather than MINGW32 just in case certain versions of mingw don't define ftruncate, but I'm not sure how to do that.
=end

Actions #1

Updated by usa (Usaku NAKAMURA) over 14 years ago

  • Assignee set to nobu (Nobuyoshi Nakada)

=begin

=end

Actions #2

Updated by mame (Yusuke Endoh) about 14 years ago

=begin
Hi, nobu and usa

Any update here?
I guess this can be fixed easily, but do you have any serious problem?

--
Yusuke Endoh
=end

Actions #3

Updated by nobu (Nobuyoshi Nakada) about 14 years ago

  • Category set to core
  • Status changed from Open to Closed

=begin
Fixed at r27300.
=end

Actions #4

Updated by nobu (Nobuyoshi Nakada) about 14 years ago

  • Status changed from Closed to Assigned
  • Assignee changed from nobu (Nobuyoshi Nakada) to yugui (Yuki Sonoda)

=begin

=end

Actions #5

Updated by jeremyevans0 (Jeremy Evans) almost 5 years ago

  • Description updated (diff)
  • Status changed from Assigned to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0