DYLD_LIBRARY_PATH problem

23 Ansichten (letzte 30 Tage)
Petros Bogiatzis
Petros Bogiatzis am 4 Okt. 2011
Bearbeitet: Walter Roberson am 1 Apr. 2018
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 Kommentare
Kaustubha Govind
Kaustubha Govind am 10 Okt. 2011
After setting the environment variables, try querying it again using GETENV and see if all the parallel sessions return the correct paths with '/usr/local/bin:/opt/local/lib:' appended.
nuvolet
nuvolet am 16 Sep. 2014
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.

Melden Sie sich an, um zu kommentieren.

Antworten (4)

Sylvain Barbot
Sylvain Barbot am 10 Apr. 2014
Bearbeitet: Sylvain Barbot am 10 Apr. 2014
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 Kommentar
Jonas Zimmermann
Jonas Zimmermann am 20 Apr. 2015
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.

Melden Sie sich an, um zu kommentieren.


Malcolm Lidierth
Malcolm Lidierth am 10 Okt. 2011

Kelly Kearney
Kelly Kearney am 10 Apr. 2014
Bearbeitet: Kelly Kearney am 10 Apr. 2014
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 am 3 Jun. 2016
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 Kommentare
Walter Roberson
Walter Roberson am 30 Mär. 2018
You could open a support case with the manufacturer of your third party software. You could hire a consultant. You could wait an indefinite period for a volunteer to have time to download the third party software and experiment, which is something that is not especially likely over this holiday weekend.
Eric Elharer
Eric Elharer am 1 Apr. 2018
Bearbeitet: Walter Roberson am 1 Apr. 2018
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)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Argument Definitions finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by