How to get FFI working on Ruby 2.7.2 image?


While upgrading a project to Ruby 2.7.2 (image cimg/ruby:2.7.2-node), I’m getting a new error:

bundle exec rake assets:precompile
rake aborted!
LoadError: cannot open shared object file: No such file or directory - /home/circleci/project/vendor/bundle/ruby/2.7.0/gems/ffi-1.13.1/lib/
Caused by:
LoadError: cannot load such file -- 2.7/ffi_c

I already tried to install libffi-dev (via sudo apt install -y libffi-dev), but it turns out it’s already there.

Did anyone find a fix for this already?


– Thibaut

I noticed this article that spoke about a change from Ubuntu 18.04 to 20.04.

The newer convenience images did switch to using 20.04 for later releases not that long ago

I’m curious if maybe your previous image was using Ubuntu 18.04 and now this image is 20.04

You can try the simlink command in that Launchpad thread

sudo ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/

Before you try that, I would make sure to increment and your CircleCI caches as this might just be a mixed cache issue. Starting with a fresh cache will make sure all the gems are rebuilt.

Hey Mike,

Thanks for the detailed answer, much appreciated!

I wasn’t aware of the OS upgrade - as a consequence:

Bumping the cache version in the key solved my issue. Thanks a ton!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.