DEV Community

Touré Holder
Touré Holder

Posted on • Updated on

dyld: Symbol not found: _ffi_prep_closure_loc

Did a regular flutter run targeting my iPhone simulator today and this craziness showed up on my screen.

Error output from CocoaPods:
↳
    dyld: lazy symbol binding failed: Symbol not found: _ffi_prep_closure_loc
      Referenced from: /Users/toure/.rbenv/versions/2.6.0/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/toure/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle
      Expected in: /usr/lib/libffi.dylib
Enter fullscreen mode Exit fullscreen mode

After much longer than I liked, I found a fix buried in a github issue.

gem uninstall ffi
brew reinstall libffi
export LDFLAGS="-L/usr/local/opt/libffi/lib"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
gem install ffi
Enter fullscreen mode Exit fullscreen mode

I decided to share this since the error in the title of the issue is different from the one that I got. Hope this can save someone some time.

Top comments (2)

Collapse
 
areai51 profile image
Vinci Rufus

Ahh you are a lifesaver.. I was struggling with this for a while now, while I did try uninstalling and reinstalling, I think the sequence of the above steps did the trick for me thanks for putting it out there

Collapse
 
andreimoment profile image
Andrei Andreev

Thank you, this helped me!