I have a program that links to a library "libao_optimization.dylib". When it runs, most of the time it's fine. But sporadically, I get the following error:
dyld: Library not loaded: libao_optimization.dylib
Referenced from: /User/gw/local/bin/tst_simulated_ngs_image_and_otfs
Reason: image not found
The appropriate paths are in the DYLD_LIBRARY_PATH. I even tried putting the full path in the executable with
install_name_tool -change ...
But, this error only occurs sometimes. Other times the library loads fine and the program runs. Has anyone experienced this on a Mac?
otool is the way to debug dyld paths. I normally check with
otool -L exeFileName
and then adjust the paths with
install_name_tool -change
For new machines, I configure the env var
DYLD_LIBRARY_PATH
When I still get errors, I test to see if the static version runs fine without errors. For example, for some boost dyld libs, this will work:
set(Boost_USE_STATIC_LIBS ON)
If the errors persist, then I know its not the path problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.