Score:1

LoadError: libffi.so.8: cannot open shared object file: No such file or directory running Rails

cn flag

I am having trouble with creating a new rails project. When I run rails new project_name it comes to the rails webpacker:install it fails with the following error:

LoadError: libffi.so.8: cannot open shared object file: No such file or directory - /home/matija/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/ffi-1.15.4/lib/ffi_c.so
/home/matija/Documents/learning-rails/course-project/config/application.rb:7:in `<main>'
/home/matija/Documents/learning-rails/course-project/Rakefile:4:in `<main>'
/home/matija/Documents/learning-rails/course-project/bin/rails:5:in `<top (required)>'
<internal:/home/matija/.asdf/installs/ruby/3.0.2/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
<internal:/home/matija/.asdf/installs/ruby/3.0.2/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
/home/matija/Documents/learning-rails/course-project/bin/spring:10:in `block in <top (required)>'
<internal:kernel>:90:in `tap'
/home/matija/Documents/learning-rails/course-project/bin/spring:7:in `<top (required)>'
bin/rails:2:in `load'
bin/rails:2:in `<main>'

Caused by:
LoadError: cannot load such file -- 3.0/ffi_c
/home/matija/Documents/learning-rails/course-project/config/application.rb:7:in `<main>'
/home/matija/Documents/learning-rails/course-project/Rakefile:4:in `<main>'
/home/matija/Documents/learning-rails/course-project/bin/rails:5:in `<top (required)>'
<internal:/home/matija/.asdf/installs/ruby/3.0.2/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
<internal:/home/matija/.asdf/installs/ruby/3.0.2/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
/home/matija/Documents/learning-rails/course-project/bin/spring:10:in `block in <top (required)>'
<internal:kernel>:90:in `tap'
/home/matija/Documents/learning-rails/course-project/bin/spring:7:in `<top (required)>'
bin/rails:2:in `load'
bin/rails:2:in `<main>'
(See full trace by running task with --trace)

I am using ASDF for ruby version management.

I tried many solutions like uninstalling and installing the gem, running gem pristine and some other methods that are provided on SO and here.

Knud Larsen avatar
by flag
`libffi.so.8` is provided by the package `libffi8ubuntu1` ... which is available for Ubuntu 21.04 . ..... and for Ubuntu 21.10, the package name is `libffi8` https://packages.ubuntu.com/search?suite=impish&arch=amd64&mode=exactfilename&searchon=contents&keywords=libffi.so.8 . ............. Please specify Ubuntu version : In your question.
Knud Larsen avatar
by flag
Testing with Ubuntu 20.04 : Installing the Ubuntu 21.10 `libffi8` ......... `sudo gdebi libffi8_3.4.2-1ubuntu5_amd64.deb` https://packages.ubuntu.com/impish/amd64/libffi8/download .......... No issues, no dependencies.
cn flag
I am using Ubuntu 20.04
Score:1
lu flag

When I was working on a Rails project I realized there was a difference in versions between the system's and the project's one, thus my solution was matching the two by running these commands:

gem uninstall ffi 
gem install ffi -v 1.15.0 -- --disable-system-libffi
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.