### Problem loading a dynamic library

After linking all the libraries and set pathnames I ran the compiled version of the code and I started getting the following error:

Referenced from: /opt/local/lib/libopencv_highgui.2.4.dylib

Reason: Incompatible library version: libopencv_highgui.2.4.dylib requires version 8.0.0 or later, but libtiff.5.dylib provides version 6.0.0

Trace/BPT trap: 5

The error is that the library that is being referenced libtiff (or the tiff library) is old and needs to be updated. There are some few tricks that helped me solve the problem, first I use the following code:

http://trac.macports.org/ticket/15554

But instead of png I awas looking for the tiff library, thus I used the following code:

For loading the libraries I have set the path of the dynamic libraries using the variable:

DYLD_LIBRARY_PATH

The DYLD_LIBRARY_PATH path in my case was set to be

:/Applications/matlab/MATLAB_Compiler_Runtime/v81/runtime/maci64/:/Applications/matlab/MATLAB_Compiler_Runtime/v81/sys/os/maci64/:/Applications/matlab/MATLAB_Compiler_Runtime/v81/sys/os/maci64/:/Applications/matlab/MATLAB_Compiler_Runtime/v81/bin/maci64/:/Users/giu/Documents/GRobot/Code/video/lib/

where

*/Applications/matlab/MATLAB_Compiler_Runtime *

is the <mcr_installed> path.

But when I set the DYLD_LIBRARY_PATH I get the following error:

Referenced from: /opt/local/lib/libopencv_superres.2.4.dylib

Expected in: /Applications/matlab/MATLAB_Compiler_Runtime/v81/bin/maci64//libopencv_core.2.4.dylib

in /opt/local/lib/libopencv_superres.2.4.dylib

I imagine that there is some function that is called inside the library *libopencv* and it is not found.

It might be that the library that I install or link does not have the function that it’s required or has another name.

**Solution:**

The solution for the problem can be found here:

https://raulzito234.wordpress.com/2013/05/02/dynamic-libraries-and-make-install/

**Take a look at: **

*http://stackoverflow.com/questions/13252852/dyld-symbol-not-found-jpeg-resync-to-restart*

**http://comments.gmane.org/gmane.os.apple.macports.user/22154**

**Edit:**

In the installation process, it’s advised to do the following:

On the target computer, append the following to your DYLD_LIBRARY_PATH environment variable:

/Applications/MATLAB/MATLAB_Compiler_Runtime/v81/runtime/maci64:/Applications/MATLAB/MATLAB_Compiler_Runtime/v81/sys/os/maci64:/Applications/MATLAB/MATLAB_Compiler_Runtime/v81/bin/maci64:/System/Library/Frameworks/JavaVM.framework/JavaVM:/System/Library/Frameworks/JavaVM.framework/Libraries

Next, set the XAPPLRESDIR environment variable to the following value:

/Applications/MATLAB/MATLAB_Compiler_Runtime/v81/X11/app-defaults