Windows: cannot load such file -- ffi_c (LoadError) #176

aslakhellesoy opened this Issue Nov 9, 2011 · 13 comments


None yet

6 participants


1.0.10 is broken on Windows MRI (1.9.2 and 1.9.3) as of this commit: 8e86ddb

1.0.9 works fine.

@luislavena luislavena was assigned Nov 9, 2011


diff --git a/lib/ffi/platform.rb b/lib/ffi/platform.rb
index b24017c..79e9f5c 100644
--- a/lib/ffi/platform.rb
+++ b/lib/ffi/platform.rb
@@ -20,7 +20,6 @@

 require 'rbconfig'
-require 'ffi_c'

 module FFI
   class PlatformError < LoadError; end

Don't see the reason why that was added, it worked without it properly on a 2.0.0dev build.

@wmeissner, do you know the reason? git blame do not explain more than "make ruby head work"

Thank you

@ghost ghost was assigned Nov 9, 2011

+1 - this is hitting a lot of childprocess' Windows users .




I reverted the commit Luis pointed out - can people test master now to make sure it builds & runs clean on windows? (it did not affect macos either way).


For the record:

C:\Users\Luis\Projects\oss\ffi\ffi>gem list ffi

*** LOCAL GEMS ***

C:\Users\Luis\Projects\oss\ffi\ffi>gem install --local pkg\ffi-1.0.10-x86-mingw32.gem
Successfully installed ffi-1.0.10-x86-mingw32
1 gem installed

>> require "rubygems"
=> false
>> require "ffi"
=> true
>> FFI::Platform::LIBC
=> "msvcrt.dll"

Using the latest devkit and Ruby 1.9.2, I was able to install FFI:
gem install ffi --platform=ruby

Fetching: ffi-1.0.11.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed ffi-1.0.11
1 gem installed
Building YARD (yri) index for ffi-1.0.11...

And require "ffi" returns true.

Things seems to be working. Thanks a lot!

@luislavena luislavena closed this Nov 15, 2011

So does this mean the 1.0.11 binary gem isn't supposed to work on 1.9.2? Still seeing the ffi_c issue there.

no such file to load -- ffi_c (LoadError)
C:/Ruby192/lib/ruby/gems/1.9.1/gems/ffi-1.0.11-x86-mingw32/lib/ffi.rb:11:in require'
rescue in '
C:/Ruby192/lib/ruby/gems/1.9.1/gems/ffi-1.0.11-x86-mingw32/lib/ffi.rb:2:in <top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/childprocess-0.2.2/lib/childprocess/windows.rb:1:in <top (required)>'


@Tridon seems that the issue is caused by a loading error of 1.9/ bundled in the gem.

While I investigate this issue, can you force the compilation of 1.0.11 using --platform=ruby during gem install?

gem install ffi --remote --platform=ruby

It requires DevKit installed.

I've created #182 to track this down.


I believe if I am using bundler there is no way (in mingw env) to enforce usage of ruby version. bundle install will force install mingw version.


It works nicely when I'm using --platform=ruby, but as khustochka just pointed out, this presents a problem when using Bundler.


thanks, it works, I just had to manually remove mingw version locked in my Gemfile.lock

@aslakhellesoy aslakhellesoy referenced this issue in cucumber/aruba Apr 19, 2012

ffi runtime dependency #114

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment