Forum: Ruby FFI Gem on Win32

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cf68437477bc7ff6b62db027b65745a8?d=identicon&s=25 Simon Smith (crisps)
on 2008-12-12 18:10
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:

[code]
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
[/code]

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.
5993756d2b69ce0bc16df3318c240d54?d=identicon&s=25 Wayne Meissner (Guest)
on 2008-12-13 00:51
(Received via mailing list)
2008/12/13 Simon Smith <simonjsmithuk@yahoo.co.uk>:
> 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.
Aee77dba395ece0a04c688b05b07cd63?d=identicon&s=25 Daniel Berger (djberg96)
on 2008-12-13 01:04
(Received via mailing list)
Wayne Meissner 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
5993756d2b69ce0bc16df3318c240d54?d=identicon&s=25 Wayne Meissner (Guest)
on 2008-12-13 01:31
(Received via mailing list)
2008/12/13 Daniel Berger <djberg96@gmail.com>:
> Wayne Meissner 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.
Cf68437477bc7ff6b62db027b65745a8?d=identicon&s=25 Simon Smith (crisps)
on 2008-12-26 16:02
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?
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2008-12-27 02:18
> 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 Lavena's installer trivially [2].
It might build straight at that point.
Cheers!
-=r



[1]
http://www.akitaonrails.com/2008/7/26/still-playin...
[2] http://github.com/luislavena/rubyinstaller/tree/master
Cf68437477bc7ff6b62db027b65745a8?d=identicon&s=25 Simon Smith (crisps)
on 2008-12-29 20:57
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.

[code]
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)

[/code]

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.
E7cff3cfd41c495e1012227d7dc24202?d=identicon&s=25 Luis Lavena (luislavena)
on 2008-12-30 01:15
(Received via mailing list)
On Dec 29, 5:56 pm, Simon Smith <simonjsmit...@yahoo.co.uk> 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,
Cf68437477bc7ff6b62db027b65745a8?d=identicon&s=25 Simon Smith (crisps)
on 2008-12-30 16:36
Cheers, please let me know when/where I can download it from when it is
ready.
E7cff3cfd41c495e1012227d7dc24202?d=identicon&s=25 Luis Lavena (luislavena)
on 2008-12-30 17:10
(Received via mailing list)
On 30 dic, 12:36, Simon Smith <simonjsmit...@yahoo.co.uk> 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,
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2008-12-31 15:15
> 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'

Yeah doing rake CHECKOUT=1 helped me overcome that once
-=r
This topic is locked and can not be replied to.