dyld: Symbol not found: _ffi_prep_closure_loc (on Mac)

Deadly 提交于 2021-01-01 06:57:45

问题


I did a regular flutter run on my Mac, targeting my iPhone simulator today and got these errors.

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

How do you solve the dyld: Symbol not found: _ffi_prep_closure_loc error?


回答1:


I found a fix buried in a github issue.

Running this on my Mac solved the problem.

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

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.




回答2:


I was able to resolve this by reinstalling the utility with this flag:

gem install ffi -- --disable-system-libffi

Full explanation found from this Medium article.



来源:https://stackoverflow.com/questions/63267667/dyld-symbol-not-found-ffi-prep-closure-loc-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!