0

I'm asked to look at some Ruby code. The developers run OSX, I'm on Windows. All is working fine on OSX, but I get an error with Scrypt 2.1.1.

I'm asked by Ruby to run: gem install scrypt -v '2.1.1' which results in an error. When I do gem install scrypt -v '2.1.1' --platform=ruby it's quite the opposite and all the gem is installed.

Now when I recreate the GemFile or update it, I still get an error and it's again suggested to run gem install scrypt -v '2.1.1'.

The output I'm getting is:

Installing scrypt 2.1.1 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: <MyProject>/vendor/bundle/ruby/2.3.0/gems/scrypt-2.1.1/ext/scrypt
C:/Ruby23-x64/bin/ruby.exe -rubygems <MyProject>/vendor/bundle/ruby/2.3.0/gems/rake-11.2.2/exe/rake RUBYARCHDIR=<MyProject>/vendor/bundle/ruby/2.3.0/extensions/x64-mingw32/2.3.0/scrypt-2.1.1 RUBYLIBDIR=<MyProject>/vendor/bundle/ruby/2.3.0/extensions/x64-mingw32/2.3.0/scrypt-2.1.1
rake aborted!
LoadError: cannot load such file -- ffi_c
<MyProject>/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.10-x64-mingw32/lib/ffi.rb:6:in `rescue in <top (required)>'
<MyProject>/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.10-x64-mingw32/lib/ffi.rb:3:in `<top (required)>'
<MyProject>/vendor/bundle/ruby/2.3.0/gems/ffi-compiler-0.1.3/lib/ffi-compiler/compile_task.rb:4:in `<top (required)>'
<MyProject>/vendor/bundle/ruby/2.3.0/gems/scrypt-2.1.1/ext/scrypt/Rakefile:1:in `<top (required)>'
<MyProject>/vendor/bundle/ruby/2.3.0/gems/rake-11.2.2/exe/rake:27:in `<main>'
LoadError: cannot load such file -- 2.3/ffi_c
<MyProject>/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.10-x64-mingw32/lib/ffi.rb:4:in `<top (required)>'
<MyProject>/vendor/bundle/ruby/2.3.0/gems/ffi-compiler-0.1.3/lib/ffi-compiler/compile_task.rb:4:in `<top (required)>'
<MyProject>/vendor/bundle/ruby/2.3.0/gems/scrypt-2.1.1/ext/scrypt/Rakefile:1:in `<top (required)>'
<MyProject>/vendor/bundle/ruby/2.3.0/gems/rake-11.2.2/exe/rake:27:in `<main>'
LoadError: cannot load such file -- ffi-compiler/compile_task
<MyProject>/vendor/bundle/ruby/2.3.0/gems/scrypt-2.1.1/ext/scrypt/Rakefile:1:in `<top (required)>'
<MyProject>/vendor/bundle/ruby/2.3.0/gems/rake-11.2.2/exe/rake:27:in `<main>'
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in <MyProject>/vendor/bundle/ruby/2.3.0/gems/scrypt-2.1.1 for inspection.

I've looked and searched on Google and Bing, but nothing resulted in a solution.

Hope somebody in the community here can help me find the resolution.

Thanks, Iwan

Arc-E-Tect
  • 103
  • 1
  • 10
  • You either haven't installed devkit, or your registry is messing up. Have a look at the steps here: http://stackoverflow.com/a/21610123/1482694 – Sam Jun 13 '16 at 14:47
  • devKit is installed and the registry is not messing up, or at least all the checks in the linked article pass successfully. Tried a 32bit installation as I was using a 64bit installation and have the same problems. – Arc-E-Tect Jun 14 '16 at 11:48
  • So you have tried everything listed here : https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#error-failed-to-build-gem-native-extension ? – Sam Jun 14 '16 at 11:51
  • Yes, among others. I posted the question on the Scrypt GIT forum. Comment from the developer of the Gem in reply to my question on his GIT page: _FFI must be pre-compiled. The only way to solve the issue is: 1. Build the FFI gem manually on your platform and install the local copy o Clone the FFI github repo o bundle install o rake gem:package o gem install ffi-1.x.x.gem 2. Jump on the windows 10 insider preview fast ring and use the Linux emulation layer o http://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/_ – Arc-E-Tect Jun 16 '16 at 12:23

1 Answers1

1
gem install ffi --platform=ruby
gem install scrypt -v 2.2.1

Works for me.

ExeiL
  • 15
  • 5