ffi / ffi

Ruby FFI
https://github.com/ffi/ffi/wiki
BSD 3-Clause "New" or "Revised" License
2.09k stars 333 forks source link

Debian Bookworm ships with ffi version 8 - causes `LoadError: libffi.so.7: cannot open shared object file: No such file or directory - /usr/local/bundle/gems/ffi-1.15.5/lib/ffi_c.so` #1036

Open wakproductions opened 1 year ago

wakproductions commented 1 year ago

I'm trying to build a Rails app on the latest Ruby 3.2.2 Docker Slim image, but they just switched it to the latest release of Debian (Bookworm). It seems that the ffi gem is dependent on libffi7, but Bookworm ships with version 8. So I get the error:

LoadError: libffi.so.7: cannot open shared object file: No such file or directory - /usr/local/bundle/gems/ffi-1.15.5/lib/ffi_c.so

It can be remedied by downgrading my Docker image to Bullseye by specifying FROM ruby:3.2.2-slim-bullseye but the gem will have to be updated to accommodate Bookworm.

aleksandrlat commented 9 months ago

I have the same issue with ruby:3.2.2-bullseye

 LoadError: libffi.so.6: cannot open shared object file: No such file or directory - /gems/ruby/3.2.0/gems/ffi-1.16.3/lib/ffi_c.so
web_1            | <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require': libffi.so.6: cannot open shared object file: No such file or directory - /gems/ruby/3.2.0/gems/ffi-1.16.3/lib/ffi_c.so (LoadError)

It works with ruby:3.2.2-buster for me

tgxworld commented 5 months ago

I worked around this by setting bundle config build.ffi --disable-system-libffi in my Dockerfile.

The ffi gem comes with a builtin libffi version, which is used, when the system libffi library is not available or too old. Use of the system libffi can be enforced by:

gem install ffi -- --enable-system-libffi        # to install the gem manually
bundle config build.ffi --enable-system-libffi   # for bundle install
or prevented by --disable-system-libffi.

This is mentioned in the docs in https://github.com/ffi/ffi?tab=readme-ov-file#requirements