Creating a controller with rails generate is causing a strange error
Asked Answered
H

2

6

I tried to start a simple rails app today to refresh my knowledge and ran into a very strange issue...

  1. Created app (rails new app-name).
  2. Created controller with index action (rails g controller site index).
  3. Set the root route to site#index.
  4. Start rails server.

The server tries to render the index view for site, but aborts abruptly with the following error:

dyld: lazy symbol binding failed: Symbol not found: _ffi_prep_closure_loc
Referenced from: /Users/Marco/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle
  Expected in: /usr/lib/libffi.dylib

dyld: Symbol not found: _ffi_prep_closure_loc
  Referenced from: /Users/Marco/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle
  Expected in: /usr/lib/libffi.dylib

I tried (unsuccessfully):

  • Upgrading my ruby version, then my rails version to latest.
  • Reinstalling all my gems.
  • Deleting the path to ffi_c.bundle and reinstalling ffi.

What is strange is that if I manually create the controller and the view, everything works fine!

I saw a suggestion on a somewhat related issue to try to change the C compiler on my machine to the default, but I don't understand why that would be necessary and I'd like to get a deeper understanding about what's going on.

Hellgrammite answered 9/6, 2020 at 20:11 Comment(3)
are you sure libffi is installed? ls -al /usr/lib/libffi.dylibEminence
Yes, it was installed!Hellgrammite
I was only able to fix this issue by updating inotify bundle update rb-inotifyFinery
M
2

I am having the same issues, and yes the file exists. I rolled my project back to ffi '~> 1.12.2' and it is working fine again.

Misfortune answered 9/6, 2020 at 20:54 Comment(1)
Can you clarify how you accomplished this?Collected
H
2

It seems the issue has something to do with libffi version conflicts.

A workaround: gem inst ffi -- --disable-system-libffi

I raised an issue, see here: https://github.com/ffi/ffi/issues/791

Hellgrammite answered 6/7, 2020 at 9:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.