Project

General

Profile

Backport #1884

Updated by jeremyevans0 (Jeremy Evans) almost 5 years ago

=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 
 

Back