DYLD_LIBRARY_PATH problem

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 件のコメント

Kaustubha Govind
Kaustubha Govind 2011 年 10 月 6 日
By parallel configuration - do you mean using Parallel Computing Toolbox? Are you using a local/cluster configuration?
Petros Bogiatzis
Petros Bogiatzis 2011 年 10 月 7 日
Yes I am using a local configuration. The problem is that I can't use Parallel computing toolbox and execute fortran executables from shell (i.e. with system command)
Kaustubha Govind
Kaustubha Govind 2011 年 10 月 10 日
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 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 日

2 投票

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.

サインインしてコメントする。

Kelly Kearney
Kelly Kearney 2014 年 4 月 10 日
編集済み: Kelly Kearney 2014 年 4 月 10 日

1 投票

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 日

0 投票

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 年 3 月 30 日
編集済み: Eric Elharer 2018 年 3 月 30 日
Hi I'm having about the problem,, new to Mac OS, so PLEASE be very clear with what I to do
Invalid MEX-file '/Users/ericelharar/Documents/MATLAB/Eric_Pedro/BM3D/bm3d_thr.mexmaci64': dlopen(/Users/ericelharar/Documents/MATLAB/Eric_Pedro/BM3D/bm3d_thr.mexmaci64, 6): Symbol not found: _mxCreateNumericArray_700 Referenced from: /Users/ericelharar/Documents/MATLAB/Eric_Pedro/BM3D/bm3d_thr.mexmaci64 Expected in: /usr/lib/libSystem.B.dylib in /Users/ericelharar/Documents/MATLAB/Eric_Pedro/BM3D/bm3d_thr.mexmaci64.
Walter Roberson
Walter Roberson 2018 年 3 月 30 日
Nuno Nobre's comment about order of environment variables is not relevant to your situation, Eric Elharer. You are using a Mac OS version which is ignoring your environment variables.
Eric Elharer
Eric Elharer 2018 年 3 月 30 日
o.k. so what should I do?
Walter Roberson
Walter Roberson 2018 年 3 月 30 日
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 2018 年 4 月 1 日
編集済み: Walter Roberson 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)

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeFortran with MATLAB についてさらに検索

質問済み:

2011 年 10 月 4 日

編集済み:

2018 年 4 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by