ffi: cannot load such file -- ffi_c (LoadError)

Hi,

Today I have updated ruby version to 2.1.3 in windows OS and try to run a simple watir script & I came across this issue.

C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': ca
nnot load such file -- ffi_c (LoadError)
        from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/ffi-1.9.3-x86-mingw32/lib/ffi.rb
:14:in `rescue in <top (required)>'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/ffi-1.9.3-x86-mingw32/lib/ffi.rb
:3:in `<top (required)>'
        from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
        from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/childprocess-0.5.3/lib/childproc
ess/windows.rb:1:in `<top (required)>'
        from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
        from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/childprocess-0.5.3/lib/childproc
ess.rb:176:in `<top (required)>'
        from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
        from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.43.0/lib/se
lenium/webdriver.rb:1:in `<top (required)>'
        from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
        from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.43.0/lib/se
lenium-webdriver.rb:1:in `<top (required)>'
        from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
        from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.10/lib/watir
-webdriver.rb:2:in `<top (required)>'
        from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
        from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
        from tests.rb:2:in `<main>'

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 23 (10 by maintainers)

Most upvoted comments

gem install ffi --platform=ruby fixed for me

@luislavena

Thanks. I have tried and it does not work.

Well, sorry it works. But I also think I have to think about stop developing ruby application on Windows.

gem:2.6.11 ruby:ruby 2.0.0p648 (2015-12-16) [x86_64-linux] CentOS Linux release 7.2.1511 (Core) I still have this problem use --platform=ruby didn’t slove my problem

@chaoli46

Well, sorry it works. But I also think I have to think about stop developing ruby application on Windows.

I’m not sure how or what to answer to that. If you have experience dealing with Linux (bash, compilation and a ton of other knowledge), then by all means go ahead and run Ruby on that environment. Whatever makes you happy.

At some point you will need to gain that experience, if is not dealing with this gem and its dependencies, will be with others and related services, tools, etc.

There is no such thing as perfect OS or programming language.

As most open-source development and support goes, everything is given by good will and in our free time (at least I’m not paid to work on it).

A community is build around positive and constructive feedback and contributions. Not sure how to deal with passive-aggresive comments or how those can improve all the above.

Addng gem "ffi" to my Gemfile fixed it https://stackoverflow.com/q/65000467/12544391

gem install ffi --pre This worked for me under windows

@anilreddy @chaoli46 please read the Rubyinstaler announcement notes:

https://groups.google.com/d/topic/rubyinstaller/AnVOc_cosTw/discussion

Existing pre-compiled gems might not be Ruby 2.1 compatible

Ruby 2.1 introduces ABI breakage which means compiled C extensions with previous 1.9.3 or 2.0.0 will not run against Ruby 2.1.

DO NOT install Ruby 2.1 on top of existing Ruby 1.9.3 or 2.0.0, or try to use compiled extensions with it.

You will be required to force compilation of those gems:

 gem install <name> --platform=ruby

This will require you have the extra dependencies installed for that gem to compile. Look at the gem documentation for the requirements.

Please check each gem documentation and recent releases.

That means you need to do: gem install ffi --platform=ruby to trigger compilation.

It will take time for gems to bundle binaries for Ruby 2.1, so please be patient.

@tduehr I have this issue still . I tried “gem -rdevkit install ffi --platform=ruby ffi” but it throws error saying -rdevkit is an Invalid option .

I have “ruby 2.2.1p85 (2015-02-26 revision 49769) [i386-mingw32]” . I am completely new to ruby , Please tell me if i am in the right way .