Why are changes to the DYLD_LIBRARY_PATH environment variable on a Mac not recognized by MATLAB 7.5 (R2007b)?
2 次查看(过去 30 天)
显示 更早的评论
My MATLAB file uses a custom library file which is placed in a specific directory. I add this directory to the DYLD_LIBRARY_PATH environment variable using the SETENV command in MATLAB. The output of GETENV shows the added directory. However, when I execute a MEX file which requires this library, the following error is received:
??? Invalid MEX-file '/dirPath/myMex.mexmaci':
dlopen (/dirPath/myMex.mexmaci, 1): Library not loaded: customLib.dylib
Referenced from: /dirPath/myMex.mexmaci
Reason: image not found.
I also changed the environment variable in environment.plist as mentioned in Technical Solution 1-Q4J2R, but this did not help.
采纳的回答
MathWorks Support Team
2009-10-11
When you need to get and set environment variables in MATLAB that are shared with the shell, start MATLAB directly from xterm or Terminal.
Alternatively, you can modify your shell configuration and initialization so that environment variables can be shared.
On UNIX platforms, the MATLAB function system, as well as dos, unix, and bang (!), are executed in a shell. The shell is chosen in this order:
* Environment variable MATLAB_SHELL
* Environment variable SHELL
* /bin/sh
If the chosen shell is tcsh then the system's .cshrc file is sourced for every MATLAB system (or related) function. In this case, all environment variables set in the .cshrc override MATLAB environment settings.
To prevent overriding MATLAB environment settings during system and related functions, you can do one of the following:
* Use setenv MATLAB_SHELL "${SHELL} -f" (the shell ignores the ~/.cshrc).
* Use setenv MATLAB_SHELL "/bin/sh" (choose the Bourne shell).
* Modify ~/.cshrc to skip setting environment variables if the shell is not interactive. Specifically, insert these statements in ~/.cshrc before changing the environment: if ($?USER == 0 || $?prompt == 0) exit
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 System Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!