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
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 个)

类别

Help CenterFile Exchange 中查找有关 System Commands 的更多信息

产品


版本

R2007b

Community Treasure Hunt

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

Start Hunting!

Translated by