Libffi.so.6 error on ubuntu-latest

I started to see errors this morning on:

  • ubuntu-latest
  • actions/checkout@v1
  • ruby/setup-ruby@v1
  • ruby-version: 2.7.2
# LoadError:
#   cannot load such file -- 2.7/ffi_c
#   ./vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'

LoadError:
  libffi.so.6: cannot open shared object file: No such file or directory - /home/runner/work/{app-name}/{app-name}/vendor/bundle/ruby/2.7.0/gems/ffi-1.14.2/lib/ffi_c.so

Googling, it looks similar to Ubuntu 20.04 upgrade, Python missing libffi.so.6 - Stack Overflow Maybe the ubuntu-latest images had libffi upgraded but I need to rebuild Ruby or clear a cache somewhere?

2 Likes

Busting the Ruby cache appears to have fixed it:

      - uses: actions/cache@v1
        with:
          path: vendor/bundle
-         key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
+         key: ${{ runner.os }}-new-gems-${{ hashFiles('**/Gemfile.lock') }}
          restore-keys: |
-           ${{ runner.os }}-gems-
+           ${{ runner.os }}-new-gems-

I’m guessing ubuntu-latest was updated with a new version of libffi and a cached Ruby gem depended on the old version.

Related: Ruby libffi.so.7: cannot open shared object file: · Issue #881 · ffi/ffi · GitHub

4 Likes