필터 지우기
필터 지우기

shell command on matlab command line shows error

조회 수: 2 (최근 30일)
Ashu Singh
Ashu Singh 2011년 8월 1일
댓글: Todd 2014년 10월 16일
Hi All,
I am using student version of Matlab on Mac OS
I am trying to execute a batch file (modflow.bat) in matlab
------------------------
cat basic.bas > picto12_15.bas
tail -13098 picto09_12.fhd >> picto12_15.bas
~/modflow/src/mf2005 picto12_15.nam > chick
cat basic.bas > picto15_18.bas
tail -13098 picto12_15.fhd >> picto15_18.bas
~/modflow/src/mf2005 picto15_18.nam > chick
cat basic.bas > picto18_21.bas
tail -13098 picto15_18.fhd >> picto18_21.bas
~/modflow/src/mf2005 picto18_21.nam > chick
cat basic.bas > picto21_24.bas
tail -13098 picto18_21.fhd >> picto21_24.bas
~/modflow/src/mf2005 picto21_24.nam > chick
------------------------
this batch file runs fine on the command line of mac. but when I did
!sh modflow.bat
it gives the error
dyld: lazy symbol binding failed: Symbol not found:
__gfortran_transfer_character_write
Referenced from: /Users/ashutoshsingh/modflow/src/mf2005
Expected in: /Applications/MATLAB_R2011a.app/sys/os/maci64/
libgfortran.3.dylib
dyld: Symbol not found: __gfortran_transfer_character_write
Referenced from: /Users/ashutoshsingh/modflow/src/mf2005
Expected in: /Applications/MATLAB_R2011a.app/sys/os/maci64/
libgfortran.3.dylib
modflow.bat: line 3: 8527 Trace/BPT trap ~/modflow/src/
mf2005 picto12_15.nam > chick
dyld: lazy symbol binding failed: Symbol not found:
__gfortran_transfer_character_write
Referenced from: /Users/ashutoshsingh/modflow/src/mf2005
Expected in: /Applications/MATLAB_R2011a.app/sys/os/maci64/
libgfortran.3.dylib
dyld: Symbol not found: __gfortran_transfer_character_write
Referenced from: /Users/ashutoshsingh/modflow/src/mf2005
Expected in: /Applications/MATLAB_R2011a.app/sys/os/maci64/
libgfortran.3.dylib
modflow.bat: line 6: 8532 Trace/BPT trap ~/modflow/src/
mf2005 picto15_18.nam > chick
dyld: lazy symbol binding failed: Symbol not found:
__gfortran_transfer_character_write
Referenced from: /Users/ashutoshsingh/modflow/src/mf2005
Expected in: /Applications/MATLAB_R2011a.app/sys/os/maci64/
libgfortran.3.dylib
dyld: Symbol not found: __gfortran_transfer_character_write
Referenced from: /Users/ashutoshsingh/modflow/src/mf2005
Expected in: /Applications/MATLAB_R2011a.app/sys/os/maci64/
libgfortran.3.dylib
modflow.bat: line 9: 8535 Trace/BPT trap ~/modflow/src/
mf2005 picto18_21.nam > chick
dyld: lazy symbol binding failed: Symbol not found:
__gfortran_transfer_character_write
Referenced from: /Users/ashutoshsingh/modflow/src/mf2005
Expected in: /Applications/MATLAB_R2011a.app/sys/os/maci64/
libgfortran.3.dylib
dyld: Symbol not found: __gfortran_transfer_character_write
Referenced from: /Users/ashutoshsingh/modflow/src/mf2005
Expected in: /Applications/MATLAB_R2011a.app/sys/os/maci64/
libgfortran.3.dylib
modflow.bat: line 12: 8538 Trace/BPT trap ~/modflow/src/
mf2005 picto21_24.nam > chick
sh modflow.bat: Trace/breakpoint trap
--------------------------------------------------
Can anyone tell me where is the problem
Thanking You and Regards
Ashutosh Singh
  댓글 수: 2
Kaustubha Govind
Kaustubha Govind 2011년 8월 1일
Perhaps MATLAB is running in an environment different from the system shell. It looks like your LD_LIBRARY_PATH setting in MATLAB may be different from that in the shell. Try running MATLAB from the system shell and see if it gets the right setting.
Ashu Singh
Ashu Singh 2011년 8월 2일
Hi,
I tried running from the system shell. The same problem again. Any other suggestion. Where can I change the path in MATLAB of LD_LIBRARY_PATH and to what should I change it to.

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

채택된 답변

Ashu Singh
Ashu Singh 2011년 8월 2일
Hi,
The problem was with the env variable DYLD_LIBRARY_PATH I used the following command to setup the env variable in matlab and now it works fine.
setenv('DYLD_LIBRARY_PATH', '/usr/local/bin/');
  댓글 수: 5
Walter Roberson
Walter Roberson 2011년 10월 14일
I don't know if this info about DYLD_LIBRARY_PATH will help, but it might:
http://superuser.com/questions/282450/where-do-i-set-dyld-library-path-on-mac-os-x-and-is-it-a-good-idea
Kent Conover
Kent Conover 2012년 4월 30일
It turns out that R experts do not approve of this solution. Here is an official approach that involves setting a symbolic link from /usr/local/bin to the R library:
sudo ln -s /Library/Frameworks/R.framework/Resources/R /usr/local/bin/R
See: http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#Command-line-version-of-R

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

추가 답변 (2개)

Petar Bakalov
Petar Bakalov 2011년 10월 28일
I had a similar problem and this fixed it! Thanks for posting!

Kent Conover
Kent Conover 2012년 4월 25일
This solution also works to integrate the statistical programming language R (<http://www.r-project.org/>) into Matlab. The system call "R CMD BATCH My_R_Script.R" works when the proper environmental variable is set via: "setenv('DYLD_LIBRARY_PATH', '/usr/local/bin/');" I really appreciate this posting!
  댓글 수: 1
Kent Conover
Kent Conover 2012년 4월 30일
It turns out that R experts do not approve of this approach to the solution. Here is an official approach that involves setting a symbolic link from /usr/local/bin to the R library:
ln -s /Library/Frameworks/R.framework/Resources/R /usr/local/bin/R
See: http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#Command-line-version-of-R

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

카테고리

Help CenterFile Exchange에서 File Name Construction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by