Dylibs and OS X

2019-04-08 20:52发布

问题:

I am trying to run a program called vowpal-wabbit (version 6.0) in mac os x.

I've used homebrew to install some things, such as lib tools and, importantly, boost.

However -- I'm finding that, even though

/usr/local/Cellar/boost/1.49.0/lib

Clearly has all the boost libs, (including lib boost_program_options.dylib)...

The error message i get when trying to run a binary is :

dyld: Library not loaded: libboost_program_options.dylib

I get the same (basically) error when running "make" to build this binary from scratch :

ld: library not found for -lboost_program_options

So ... I guess my question is : How can I get my compiled binary to "see" the libboost_program_options.dylib ? Or alternatively... how can I get vw (version 6.0) running on os x lion.

回答1:

I'll guess that /usr/local/Cellar/boost/1.49.0/lib is not on either DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH. You could export either of those in your environment, or you could symlink the Boost libraries from /usr/local/lib.

Be careful not to wipe out the contents of DYLD_FALLBACK_LIBRARY_PATH, though! From the dyld man page, the default value for this is $(HOME)/lib:/usr/local/lib:/lib:/usr/lib.