Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing ffi 1.9.21 with native extensions on Ruby 2.4.2, Ubuntu 17.10 failing

ffi gem 1.9.21 installed successfully. I also tried to run these commands but no success.

sudo apt install libffi-dev
gem inst ffi

This error occurs when I deploy to AWS. The error looks like this.

Installing dotenv 2.2.1
Installing request_store 1.3.2
Installing draper 3.0.1

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

/opt/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20180207-2245-1bjhja4.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... no
checking for shlwapi.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
creating extconf.h
creating Makefile

  make "DESTDIR=" clean

make "DESTDIR="
Running autoreconf for libffi
/var/app/ondeck/vendor/bundle/gems/ffi-1.9.21/ext/ffi_c/libffi/autogen.sh: line 2: exec: autoreconf: not found
make: *** ["/var/app/ondeck/vendor/bundle/gems/ffi-1.9.21/ext/ffi_c/libffi-x86_64-linux"/.libs/libffi_convenience.a] Error 127

make failed, exit code 2

Gem files will remain installed in /var/app/ondeck/vendor/bundle/gems/ffi-1.9.21 for inspection.
Results logged to /var/app/ondeck/vendor/bundle/extensions/x86_64-linux/2.2.0-static/ffi-1.9.21/gem_make.out
An error occurred while installing ffi (1.9.21), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.21'` succeeds before bundling. (Executor::NonZeroExitStatus)

Any help will be much appriciated. thanks in advance.

like image 789
Affi Avatar asked Feb 09 '18 05:02

Affi


3 Answers

Seems like this issue is due to the ffi latest version, I specified the ffi oldest version in Gemfile gem 'ffi', '1.9.18' run bundle install in the console, it fixed my issue.

like image 67
Affi Avatar answered Nov 14 '22 15:11

Affi


As stated in a comment on a relevant issue, the workaround is:

sudo apt install libffi-dev
like image 6
mdesantis Avatar answered Nov 14 '22 16:11

mdesantis


Do this in your server

sudo apt-get install ruby-dev

Ref: Registered issue

Please let me know If this not worked.

like image 1
Ajay Barot Avatar answered Nov 14 '22 16:11

Ajay Barot