Problem loading a dynamic library

by raulzito234

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

dyld: Library not loaded: /opt/local/lib/libtiff.5.dylib
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:

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

>> sudo port installed | grep tiff


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


The DYLD_LIBRARY_PATH path in my case was set to be




is the <mcr_installed> path.

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

dyld: Symbol not found: __ZTIN2cv16ParallelLoopBodyE
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.


The solution for the problem can be found here:

Take a look at:

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:


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