Thanks to visit codestin.com
Credit goes to github.com

Skip to content

macOS M1: running rake db:setup fails pointing to ffi gemΒ #948

@belgoros

Description

@belgoros

I have the following ffi versions installed:

*** LOCAL GEMS ***

ffi (1.15.5, 1.9.25)
ffi-compiler (1.0.1)
llhttp-ffi (0.3.1)
public_suffix (3.0.3)

I had to install 1.9.25 version as follows:

gem install ffi -v '1.9.25' -- --disable-system-libffi --with-cflags=-Wno-implicit-function-declaration

When running bundle on a project using Ruby 2.7.5 version, everything goes well.
Then, when running rake db:setup it fails as follows:

rake db:setup
/Users/serguei/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
/Users/serguei/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
/Users/serguei/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
/Users/serguei/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/json-1.8.6/lib/json/common.rb:155: warning: Using the last argument as keyword parameters is deprecated
rake aborted!
LoadError: Please add `ffi` to your Gemfile for darwin (macos) machines
dlopen(/Users/serguei/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/ffi-1.9.25/lib/ffi_c.bundle, 0x0009): symbol not found in flat namespace '_ffi_prep_closure' - /Users/serguei/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/ffi-1.9.25/lib/ffi_c.bundle
/Users/serguei/github/rails-app/config/application.rb:20:in `<top (required)>'
/Users/serguei/github/rails-app/Rakefile:5:in `<top (required)>'

Caused by:
LoadError: cannot load such file -- 2.7/ffi_c
/Users/serguei/github/rails-app/config/application.rb:20:in `<top (required)>'
/Users/serguei/github/rails-app/Rakefile:5:in `<top (required)>'

I'm on macOS 12.3.1, Apple M1 chip.

What am I missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions