DYLD_LIBRARY_PATH problem

조회 수: 39(최근 30일)
Petros Bogiatzis
Petros Bogiatzis 2011년 10월 4일
편집: Walter Roberson 2018년 4월 1일
Hi, I am facing the following problem. When I try to execute a fortran program through "system" command, I get:
_dyld: lazy symbol binding failed: Symbol not found: __gfortran_transfer_integer_write Referenced from: < path of my executable program> Expected in: /Applications/MATLAB_R2011a.app/sys/os/maci64/libgfortran.3.dylib
dyld: Symbol not found: __gfortran_transfer_integer_write
Referenced from:
<path of my executable program>
Expected in:
/Applications/MATLAB_R2011a.app/sys/os/maci64/libgfortran.3.dylib_
I solved this by running setenv('DYLD_LIBRARY_PATH', '/usr/local/bin') , or setenv('DYLD_LIBRARY_PATH', '/opt/local/lib').
Unfortunately I need at the same time to run code in parallel configuration but now matlab cannot find the /Applications/MATLAB_R2011a.app/bin/maci64 or the /Applications/MATLAB_R2011a.app/sys/os/maci64:
I have already tried to run setenv('DYLD_LIBRARY_PATH', [getenv('DYLD_LIBRARY_PATH') '/usr/local/bin:/opt/local/lib:']) but this reproduces the initial problem (_dyld: lazy symbol binding failed: Symbol not found: [...])
MATLAB Version 7.12.0.635 (R2011a)
Operating System: Mac OS X Version: 10.6.8 Build: 10K549
Thank you in advance for any answers
  댓글 수: 4
nuvolet
nuvolet 2014년 9월 16일
I had the same problem and at least running my Fortran code declaring the DYLD_LIBRARY_PATH as setenv('DYLD_LIBRARY_PATH', '/opt/local/lib'), in my case as export DYLD_LIBRARY_PATH=/opt/local/lib because I work with bash shell. This solved my problem.

댓글을 달려면 로그인하십시오.

답변(4개)

Sylvain Barbot
Sylvain Barbot 2014년 4월 10일
편집: Sylvain Barbot 2014년 4월 10일
It is probable that you are dynamically loading the wrong version of the gfortran library. On Mac, by default the gfortran dynamic library is loaded in
/Applications/MATLAB_R2013a.app/sys/os/maci64
You can edit matlabroot/bin/.matlab7rc.sh and add the correct path to your dynamic library. I have gfortran with fink, so I have the following line in my .matlab7rc.sh
LDPATH_PREFIX='/sw/lib/gcc4.8/lib'
Upon loading Matlab, I then get
>> getenv('DYLD_LIBRARY_PATH')
ans =
/sw/lib/gcc4.8/lib:/Applications/MATLAB_R2013a.app/sys/os/maci64:/Applications/MATLAB_R2013a.app/bin/maci64/../../Contents/MacOS:/Applications/MATLAB_R2013a.app/bin/maci64:/Applications/MATLAB_R2013a.app/extern/lib/maci64:/Applications/MATLAB_R2013a.app/runtime/maci64
This way, you can load you own Mex/Fortran routines and still use the other Matlab dynamic libraries.
  댓글 수: 1
Jonas Zimmermann
Jonas Zimmermann 2015년 4월 20일
In a multi-user setup, or to preserve changes across MATLAB versions, you may want to copy matlabroot/bin/.matlab7rc.sh to your home directory.

댓글을 달려면 로그인하십시오.


Malcolm Lidierth
Malcolm Lidierth 2011년 10월 10일

Kelly Kearney
Kelly Kearney 2014년 4월 10일
편집: Kelly Kearney 2014년 4월 10일
This is probably not the Mathworks-recommended way of doing things, but my solution to system path issues was to add
source ~/.bash_profile
to the first line of the Matlab shell script (i.e. [matlabroot]/bin/matlab), and then within my startup.m file add
setenv('DYLD_LIBRARY_PATH', '');
setenv('DYLD_FRAMEWORK_PATH', '');
I find that this seems to keep all my system paths and other environmental variables in the Matlab and terminal environments in sync with a minimal amount of fiddling on my part. So far, I haven't noticed any issues calling system commands in parallel.

Nuno Nobre
Nuno Nobre 2016년 6월 3일
I am probably five years late, but you just set the environment variable in the wrong order. Your desired path should come BEFORE the old one and not after. Of course you were getting the same error: MATLAB was locating the wrong file first and not the one you wanted it to.
  댓글 수: 5
Eric Elharer
Eric Elharer 2018년 4월 1일
Hi,
Last try, could be a version compatibility issue?
h-MacBook-Pro-sl-Eric:~ ericelharar$ otool -L /usr/lib/libSystem.B.dylib
/usr/lib/libSystem.B.dylib:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
/usr/lib/system/libcache.dylib (compatibility version 1.0.0, current version 80.0.0)
/usr/lib/system/libcommonCrypto.dylib (compatibility version 1.0.0, current version 60118.50.1)
/usr/lib/system/libcompiler_rt.dylib (compatibility version 1.0.0, current version 62.0.0)
/usr/lib/system/libcopyfile.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/system/libcorecrypto.dylib (compatibility version 1.0.0, current version 562.50.17)
/usr/lib/system/libdispatch.dylib (compatibility version 1.0.0, current version 913.50.12)
/usr/lib/system/libdyld.dylib (compatibility version 1.0.0, current version 551.3.0)
/usr/lib/system/libkeymgr.dylib (compatibility version 1.0.0, current version 28.0.0)
/usr/lib/system/liblaunch.dylib (compatibility version 1.0.0, current version 1205.50.76)
/usr/lib/system/libmacho.dylib (compatibility version 1.0.0, current version 906.0.0)
/usr/lib/system/libquarantine.dylib (compatibility version 1.0.0, current version 86.0.0)
/usr/lib/system/libremovefile.dylib (compatibility version 1.0.0, current version 45.0.0)
/usr/lib/system/libsystem_asl.dylib (compatibility version 1.0.0, current version 356.50.1)
/usr/lib/system/libsystem_blocks.dylib (compatibility version 1.0.0, current version 67.0.0)
/usr/lib/system/libsystem_c.dylib (compatibility version 1.0.0, current version 1244.50.9)
/usr/lib/system/libsystem_configuration.dylib (compatibility version 1.0.0, current version 963.50.8)
/usr/lib/system/libsystem_coreservices.dylib (compatibility version 1.0.0, current version 51.0.0)
/usr/lib/system/libsystem_darwin.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/system/libsystem_dnssd.dylib (compatibility version 1.0.0, current version 878.50.17)
/usr/lib/system/libsystem_info.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/system/libsystem_m.dylib (compatibility version 1.0.0, current version 3147.50.1)
/usr/lib/system/libsystem_malloc.dylib (compatibility version 1.0.0, current version 140.50.6)
/usr/lib/system/libsystem_network.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/system/libsystem_networkextension.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/system/libsystem_notify.dylib (compatibility version 1.0.0, current version 172.0.0)
/usr/lib/system/libsystem_sandbox.dylib (compatibility version 1.0.0, current version 765.50.51)
/usr/lib/system/libsystem_secinit.dylib (compatibility version 1.0.0, current version 30.0.0)
/usr/lib/system/libsystem_kernel.dylib (compatibility version 1.0.0, current version 4570.51.1)
/usr/lib/system/libsystem_platform.dylib (compatibility version 1.0.0, current version 161.50.1)
/usr/lib/system/libsystem_pthread.dylib (compatibility version 1.0.0, current version 301.50.1)
/usr/lib/system/libsystem_symptoms.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/system/libsystem_trace.dylib (compatibility version 1.0.0, current version 829.50.17)
/usr/lib/system/libunwind.dylib (compatibility version 1.0.0, current version 35.3.0)

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by