Sunday, April 29, 2012

MATLAB: "Trace/breakpoint trap" after system call

The MATLAB's system call permits to run a program in a shell. But some programs have dynamic dependencies that conflict with MATLAB's environment. For instance:

[status, result] = system(['/usr/local/bin/convert']); 

will throw something like:


dyld: Library not loaded: /opt/local/lib/libtiff.3.dylib
  Referenced from: /opt/local/bin/convert
  Reason: Incompatible library version: convert requires version 13.0.0 or later, but libtiff.3.dylib provides version 11.0.0

/usr/local/bin/convert: Trace/breakpoint trap 

A solution consists in resetting the variable DYLD_LIBRARY_PATH (for OSX or LD_LIBRARY_PATH in Linux)  before running the program. This call should do the trick:

[status, result] = system(['export DYLD_LIBRARY_PATH=""; ' '/opt/local/bin/convert']); 

Source: http://www.alecjacobson.com/weblog/?p=1453

No comments:

Post a Comment