FFI Gem on Win32

Hi,

I need to install the 0.2.0 FFI gem for MRI on a win32 system. I have
thus far been unable to get it to compile. The issue is with nmake:

C:/atb/ruby/bin/ruby.exe extconf.rb install ffi-0.2.0.gem
checking for ffi_closure_alloc() in ffi.lib... no
creating Makefile
creating extconf.h

nmake

Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
Copyright (C) Microsoft Corporation.  All rights reserved.

makefile(181) : fatal error U1052: file '$(srcdir)/ffi.mk' not found
Stop.


Gem files will remain installed in
C:/atb/ruby/lib/ruby/gems/1.8/gems/ffi-0.2.0
for inspection.
Results logged to
C:/atb/ruby/lib/ruby/gems/1.8/gems/ffi-0.2.0/ext/gem_make.out

I have found various posts on the net complaining of the same problem
but no actual solution to it. Could somebody please provide me with
instructions on how to install this on win32 or where I can get a
precompiled win32 gem?

Thanks in advance for your help.

P.S. I will also eventually need to install the same version on Jruby
too.

2008/12/13 Simon S. [email protected]:

Hi,

I need to install the 0.2.0 FFI gem for MRI on a win32 system. I have
thus far been unable to get it to compile. The issue is with nmake:

makefile(181) : fatal error U1052: file ‘$(srcdir)/ffi.mk’ not found
Stop.

Unfortunately, thats just the start of the fun on windows. There are
a few code changes needed to support windows as well.

I have ported the latest FFI code to windows, but building it is a bit
involved - you need msys+mingw, you need to build ruby from source
(matching the one-click version) using mingw, and then build the FFI
gem using that new ruby install.

Hopefully, there will be binary gems available for ruby-ffi 0.3.0

P.S. I will also eventually need to install the same version on Jruby
too.

JRuby already contains FFI - no need to install anything more, and is
possibly the least painful way of using it on windows.

Wayne M. wrote:

Unfortunately, thats just the start of the fun on windows. There are
a few code changes needed to support windows as well.

I have ported the latest FFI code to windows, but building it is a bit
involved - you need msys+mingw, you need to build ruby from source
(matching the one-click version) using mingw, and then build the FFI
gem using that new ruby install.

No hope for people who want to build it via VC++ ?

Regards,

Dan

2008/12/13 Daniel B. [email protected]:

Wayne M. wrote:

I have ported the latest FFI code to windows, but building it is a bit
involved - you need msys+mingw, you need to build ruby from source
(matching the one-click version) using mingw, and then build the FFI
gem using that new ruby install.

No hope for people who want to build it via VC++ ?

Sure there is, if someone else wants to go to the effort of porting
the code. I 'm not going to do it myself though, since the mingw
builds work fine. With binary releases for 0.3.0, the issue of what
compiler is used is a moot point for most people.

Unfortunately rebuilding ruby itself from source wont be an option due
to the amount of testing that will be needed.

I will just try to complete my FFI port under jruby for now. Do you know
when ffi 0.3.0 with the binary gems will be available?

I have ported the latest FFI code to windows, but building it is a bit
involved - you need msys+mingw, you need to build ruby from source
(matching the one-click version) using mingw, and then build the FFI
gem using that new ruby install.

As a note you can download mingw ruby from [1] or install your own from
Luis L.'s installer trivially [2].
It might build straight at that point.
Cheers!
-=r

[1]

[2] http://github.com/luislavena/rubyinstaller/tree/master

On Dec 29, 5:56 pm, Simon S. [email protected] wrote:

gin -i -c “make install”
installing extension objects
C:/Code/jruby/Installs/luislaven
from
lib/ruby/1.8/fileutils.rb:1527:in `mkdir_p’
process unzips and builds fine it is just falling over in the final
stages when installing the files.

The folder
“C:/Code/jruby/Installs/luislavena-rubyinstaller/sandbox/rubygems_mingw”
already exists, but I think the C: part on the end is an issue.

Is a bug in rubygems and the recipes need to be updated for 1.3.1 to
fix it.

I think I have those fixes locally and need to push to github, need to
verify.

Sorry for the problems,

Cheers, please let me know when/where I can download it from when it is
ready.

Hi,

Thanks for your help so far, much appreciated, this looks like it almost
works now but I am having trouble installing the link though.

C:\Code\jruby\Installs\luislavena-rubyinstaller>rake install
(in C:/Code/jruby/Installs/luislavena-rubyinstaller)
"C:/Code/jruby/Installs/luislavena-rubyinstaller/sandbox/msys/bin/bash.exe" 
--lo
gin -i -c "make install"
./miniruby.exe  ../ruby_1_8/instruby.rb --dest-dir="" --extout=".ext" 
--make="ma
ke" --mflags="- --unix" --make-flags=" --unix" --installed-list 
.installed.list
--mantype="man"
installing binary commands
installing command scripts
installing library scripts
installing headers
installing manpages
installing extension objects
installing extension scripts
ruby setup.rb install --no-ri --no-rdoc 
--destdir=C:/Code/jruby/Installs/luislav
ena-rubyinstaller/sandbox/rubygems_mingw
mkdir -p 
C:/Code/jruby/Installs/luislavena-rubyinstaller/sandbox/rubygems_mingw/
C:/Code/jruby/Installs/luislavena-rubyinstaller/sandbox/ruby_mingw/lib/ruby/site
_ruby/1.8
C:/Code/jruby/Installs/luislavena-rubyinstaller/sandbox/ruby_mingw/lib/ruby/1.8/
fileutils.rb:243:in `mkdir': Invalid argument - 
C:/Code/jruby/Installs/luislaven
a-rubyinstaller/sandbox/rubygems_mingw/C: (Errno::EINVAL)
        from 
C:/Code/jruby/Installs/luislavena-rubyinstaller/sandbox/ruby_mingw/
lib/ruby/1.8/fileutils.rb:243:in `fu_mkdir'
        from 
C:/Code/jruby/Installs/luislavena-rubyinstaller/sandbox/ruby_mingw/
lib/ruby/1.8/fileutils.rb:217:in `mkdir_p'
        from 
C:/Code/jruby/Installs/luislavena-rubyinstaller/sandbox/ruby_mingw/
lib/ruby/1.8/fileutils.rb:215:in `reverse_each'
        from 
C:/Code/jruby/Installs/luislavena-rubyinstaller/sandbox/ruby_mingw/
lib/ruby/1.8/fileutils.rb:215:in `mkdir_p'
        from 
C:/Code/jruby/Installs/luislavena-rubyinstaller/sandbox/ruby_mingw/
lib/ruby/1.8/fileutils.rb:201:in `each'
        from 
C:/Code/jruby/Installs/luislavena-rubyinstaller/sandbox/ruby_mingw/
lib/ruby/1.8/fileutils.rb:201:in `mkdir_p'
        from 
C:/Code/jruby/Installs/luislavena-rubyinstaller/sandbox/ruby_mingw/
lib/ruby/1.8/fileutils.rb:1527:in `mkdir_p'
        from setup.rb:141
rake aborted!
Command failed with status (1): [ruby setup.rb install --no-ri --no-rdoc 
--...]

(See full trace by running task with --trace)

Do you know if I am missing a command somewhere. It seems like the whole
process unzips and builds fine it is just falling over in the final
stages when installing the files.

The folder
“C:/Code/jruby/Installs/luislavena-rubyinstaller/sandbox/rubygems_mingw”
already exists, but I think the C: part on the end is an issue.

On 30 dic, 12:36, Simon S. [email protected] wrote:

Cheers, please let me know when/where I can download it from when it is
ready.

I’ve updated the recipes last night, you can “git pull” to get the
updated source and then execute it again.

In any case, you have sandbox/ruby_mingw built and ready for use. Now
you can take sandbox/mingw and sandbox/msys as build tools for compile
anything for this Ruby.

I believe I’ve described how to use this previously, but don’t have
the links handy.

Regards,

C:/Code/jruby/Installs/luislavena-rubyinstaller/sandbox/ruby_mingw/lib/ruby/1.8/
fileutils.rb:243:in mkdir': Invalid argument - C:/Code/jruby/Installs/luislaven a-rubyinstaller/sandbox/rubygems_mingw/C: (Errno::EINVAL) from C:/Code/jruby/Installs/luislavena-rubyinstaller/sandbox/ruby_mingw/ lib/ruby/1.8/fileutils.rb:243:infu_mkdir’

Yeah doing rake CHECKOUT=1 helped me overcome that once
-=r