Clear Filters
Clear Filters

How do I configure the LD_LIBRARY_PATH on Linux and DYLD_LIBRARY_PATH on MAC OS X to point to MCR?

158 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 29 Jul 2019
To set the LD_LIBRARY_PATH on Linux follow the steps below:
1. Determine Linux shell being used. Use the following command on the Linux terminal:
echo $SHELL
For a TCSH shell this will return "/bin/tcsh"
For a BASH shell this will return "/bin/bash"
2. Check if you have a .tcshrc or .bashrc file ("the startup file") on your system. These files are run whenever a new terminal is opened.
ls -all
3. If the startup file is not present, you can create one for TCSH/BASH respectively:
touch .tcshrc
touch .bashrc
4. Check if LD_LIBRARY_PATH has been set already:
echo $LD_LIBRARY_PATH
This will either return the value for LD_LIBRARY_PATH or the following message:
LD_LIBRARY_PATH: Undefined variable
5. Open the file for editing in vi for TCSH/BASH respectively:
vi .tcshrc
vi .bashrc
6. Append the paths from the Configuration Notes dialog box ("<mypath>") obtained during MCR installation.
If LD_LIBRARY_PATH was not already set (refer to Step 4), append the variable using the first line. Otherwise, use the second.
For BASH:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<mypath>
or
export LD_LIBRARY_PATH=<mypath>
For TCSH:
setenv LD_LIBRARY_PATH {$LD_LIBRARY_PATH}:<mypath>
or
setenv LD_LIBRARY_PATH <mypath>
7. Save and exit vi using Shift + :wq
8. Confirm the LD_LIBRARY_PATH has been set correctly. Open a new terminal and execute:
echo $LD_LIBRARY_PATH
This should now reflect the paths to the MCR that you just set.
NOTE:
To set DYLD_LIBRARY_PATH on MAC OS X 10.11 and newer, you must use the following syntax when running an application ("run.app"):
DYLD_LIBRARY_PATH="/my/path/to/mcr" ./run.app
This is because dynamic library environment variables are no longer copied to child processes, due to System Integrity Protection.

More Answers (0)

Categories

Find more on C Shared Library Integration in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!