When using mex files, cannot find libraries

I created a mex function which uses another library that relies on gfortran. However, when I execute the function, I see this error message
Library not loaded: /usr/local/lib/libgfortran.1.dylib
I do have this library, but it's just in a different folder called /usr/local/gfortran/lib, so I did this to fix the issue
setenv('DYLD_LIBRARY_PATH', '/usr/local/gfortran/lib');
This doesn't fix it at all. I still see the same issue. Is there a way to force the library to look for gfortran in this specific path that I specified?

댓글 수: 2

Which operating system are you using, and which release? DYLD_LIBRARY_PATH suggests OS-X or MacOS, but there were security changes to how DYLD_LIBRARY_PATH is processed in recent Apple releases.
jh2011
jh2011 2018년 1월 9일
Using MacOS Sierra 10.12.6.

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

 채택된 답변

Walter Roberson
Walter Roberson 2018년 1월 9일

0 개 추천

With MacOS Sierra, you are affected to Apple's changes to disable most uses of DYLD_LIBRARY_PATH . See https://github.com/nteract/nteract/issues/1523

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

질문:

2018년 1월 9일

답변:

2018년 1월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by