Library not loaded: /opt/local/lib/libffi.5.dylib but I'm using homebrew

喜欢而已 提交于 2020-01-02 04:51:26

问题


I'm trying to run guard on Mac OS X Lion(XCode 4.3+OSX GCC Installer+Homebrew)

Error message:

Library not loaded: /opt/local/lib/libffi.5.dylib

I have no /opt/local directory since I'm not using MacPorts but Homebrew

I tried brew install libffi, which was successful, but the gem still doesn't work.

I also have tried uninstalling and reinstalling the gem without success.

Problem is also occurring on OSX 10.9 (Mavericks) with apple-gcc42 installed.

I have also tried telling gem about the presence of libffi as follows:

gem install ffi:1.0.7 -- --with-ldflags='-L/usr/local/opt/libffi/lib'


回答1:


I have ended up in this situation after uninstalling MacPorts (I thought homebrew will be enough, but doesn't seem so). It stopped my cocoapods from updating/installing.

To make it work like a charm, I did:

$ sudo port install libffi



回答2:


With otool and install_name_tool, you may fix the dependency problem. See Creating working dylibs for detail.




回答3:


I'm using rvm, and I resolved it by reinstalling the ffi gem

gem uninstall ffi

gem install ffi ##or inside rails project folder run bundle install




回答4:


I think this is best explained as a compatibility issue between Mac OS X and older versions of the ffi gem. That is why in some cases simply uninstalling and reinstalling the gem can work.

In my case ffi version 1.0.7 was specified in a project's Gemfile. My tests failed with Library not loaded: /opt/local/lib/libffi.5.dylib on that version, but if I tried latest version 1.9.3, it installed and worked without any fuss.

I was lucky and the need for that restriction on the project was placed years ago and no longer appears to be a requirement. So in the end I moved forward with later version of ffi gem.

I suspect there may be a way to get version 1.0.7 happily installed and working on OS X 10.9.2, but I do not know what that might be.



来源:https://stackoverflow.com/questions/9475287/library-not-loaded-opt-local-lib-libffi-5-dylib-but-im-using-homebrew

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