I found this out. Seems that in OSX the variable is called DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH. Now I am able to run my code to some extent.
Loading the correct version of a dynamic library when doing a system() call
1 view (last 30 days)
Show older comments
I have a benchmark toolbox written in matlab which runs C programs over a large dataset then processes their output. This is performed via system calls, and while this used to work without flaw in linux, under mac I'm having lot of trouble. It seems that matlab is loading its own versions of the libraries instead of the correct ones. Here is command:
processing: ../data/tt004.png progress: 4 of 5
cmd: export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:/home/juan/juanc/soft/libs/lib ; export XML_OUTPUT=2 ;/usr/local/bin/gtime -f %U -o ./out/0004.time tor_compute_meaningful_mergings_4 -config=mp.cfg -image=../data/tt004.png -out_image=./out/0004_output.png -out_image_prefix=./out/0004 -out_image_mean=./out/0004_mean.png -out_image_data_label=./out/0004_data_label.png -out_image_data=./out/0004_data.png -out_image_init=./out/0004_init.png -out_image_part=./out/0004_part.png -out_part=./out/0004_part.part -out_image_part_label=./out/0004_part_label.png -out_image_bounds=./out/0004_bounds.png -comp_tree=./out/0004_orig.tc &> ./out/0004.xml ; qnm partition_to_dot_fancy ./out/0004_part.part ../data/tt004.png ./out/0004_part.dot ; qnm tctodot_fancy ./out/0004_orig.tc ../data/tt004.png ./out/0004_tree.dot ; /usr/local/bin/dot -Tpng ./out/0004_tree.dot > ./out/0004_tree.png ; /usr/local/bin/neato -n2 -Tpng ./out/0004_part.dot > ./out/0004_graph.png; qnm partition_match ../data/tt003.png ./out/0003_part.part ../data/tt004.png ./out/0004_part.part 1 ./out/0004_matching.dot &> ./out/0004_matching.xml ; /usr/local/bin/neato -n2 -Tpng ./out/0004_matching.dot > ./out/0004_matching.png
And the error I get:
result: dyld: Library not loaded: /usr/local/lib/libfftw3.3.dylib
Referenced from: /Users/juan/juanc/develop/qnm/trunk/qnm
Reason: Incompatible library version: qnm requires version 7.0.0 or later, but libfftw3.3.dylib provides version 6.0.0
/bin/bash: line 1: 62331 Trace/BPT trap: 5 qnm partition_to_dot_fancy ./out/0004_part.part ../data/tt004.png ./out/0004_part.dot
dyld: Library not loaded: /usr/local/lib/libfftw3.3.dylib
Referenced from: /Users/juan/juanc/develop/qnm/trunk/qnm
Reason: Incompatible library version: qnm requires version 7.0.0 or later, but libfftw3.3.dylib provides version 6.0.0
/bin/bash: line 1: 62332 Trace/BPT trap: 5 qnm tctodot_fancy ./out/0004_orig.tc ../data/tt004.png ./out/0004_tree.dot
As you can see, I've tried to override the LD_LIBRARY_PATH to point matlab to the correct libraries. This used to work in linux, but I'm having no luck in mac.
Just in case, I verified the output of otool from within matlab:
>> system('otool -L /Users/juan/juanc/develop/qnm/trunk/qnm');
/Users/juan/juanc/develop/qnm/trunk/qnm:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
/usr/local/lib/libfftw3.3.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/local/lib/libgsl.0.dylib (compatibility version 17.0.0, current version 17.0.0)
/usr/local/lib/libgslcblas.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/lib/libjpeg.8.dylib (compatibility version 12.0.0, current version 12.0.0)
/usr/X11/lib/libpng15.15.dylib (compatibility version 20.0.0, current version 20.0.0)
/usr/local/lib/libtiff.3.dylib (compatibility version 13.0.0, current version 13.5.0)
This is with matlab 7.10.0.499 (R2010a) on OSX Lion.
Any hints are appreciated.
Thanks in advance.
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Package and Share Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!