Dyld: library not loaded: lib / libopencv_core.3.0.dylib Cause: image not found

I am getting the following problem:

/Users/luke/Desktop/trainHOG/trainhog ; exit; dyld: Library not loaded: lib/libopencv_core.3.0.dylib Referenced from: /Users/luke/Desktop/trainHOG/trainhog Reason: image not found Trace/BPT trap: 5 logout

I am using a Mac with OSX version 10.9.5 with openCV 3.0 alpha.

The library in question is definitely in the folder. I tried to delete it and paste it back into the folder, I completely uninstalled and reinstalled openCV and macports and I tried export DYLD_LIBRARY_PATH = "path to dynamic libs here.."

it but nothing worked. I even rebooted my computer several times!

Does anyone have any further suggestions? I'm out of ideas

+3


source to share


3 answers


If you are using

export DYLD_LIBRARY_PATH = "path to dynamic libs here.."

      

does it apply to your program environment? You can check the environment variables of a running process with



ps -p <pid> -wwwE

      

Does it help?

+2


source


OpenCV 3.3 OSX 10.13 fist has test, you can use clang ++ -oa -I./include -L./lib -lopencv_core.your.version then you can generate executable a, run it if you have error massage. you will find that the reason for the error cannot find the lib when you are a link.



if you want to resolve the error on the terminal you can use the export DYLD_LIBRARY_PATH = your / lib: $ DYLD_LIBRARY_PATH if you want to resolve the error on Xcode on the build page go to "Path Search Paths" add lib path

+2


source


It seems to be a bug in some versions of OpenCV CMake config files that do not correctly write relative paths in installed dylibs, easy enough to fix.

This answer to answer.opencv.org addresses the issue. In OpenCVModule.cmake

and each copy, CMakeLists.txt

replace INSTALL_NAME_DIR lib

with INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib

.

+1


source







All Articles