dyld: Library not loaded: /opt/local/lib/libglib-2.0.0.dylib

落花浮王杯 提交于 2019-12-25 13:18:33

问题


I've gotten MDB-Tools compiled for OSX, but when I try to run a sample command line program on another computer I get this error:

dyld: Library not loaded: /opt/local/lib/libglib-2.0.0.dylib Referenced from: /Users/dev/mdb/mdb-test Reason: image not found Trace/BPT trap: 5

I believe that this means that the target system is missing a library and I think its something to do with linkage, but I'm not exactly positive how to go about fixing this. Could anyone point me in the right direction?


回答1:


The /opt/local directory is typically used by MacPorts. Your compiled program has a dependency on glib from MacPorts. You either need to install that on the machines where you want to run your program or you need to bundle together your program and all of the libraries it depends on.

Check Apple's Dynamic Library Programming Topics.




回答2:


Yes, I had hit similar issue while upgrading vim on Mac.

$ vi linkedlist.cc
dyld: Library not loaded: /usr/local/opt/python/Frameworks/Python.framework/Versions/3.6/Python
  Referenced from: /usr/local/bin/vim
  Reason: image not found
Abort trap: 6

To solve the problem, I tried to upgrade packages.

$ brew update
Already up-to-date.

$ brew upgrade

It started working after doing upgrades.



来源:https://stackoverflow.com/questions/10359063/dyld-library-not-loaded-opt-local-lib-libglib-2-0-0-dylib

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