# TOMLAB  
# REGISTER (TOMLAB)
# LOGIN  
# myTOMLAB
TOMLAB LOGO

« Previous « Start » Next »

5 Setting environment variables

On Windows, TOMLAB requires the directory tomlab/shared to be included in the environment variable PATH.

On Linux, TOMLAB requires the tomlab/shared folder to be present in the LD_LIBRARY_PATH environment variable. If TOMLAB is installed with super-user privileges on Linux, the installer will add a ldconfig entry to /etc/ld.so.conf.d/tomlab.conf, eliminating the need for manual manipulation of LD_LIBRARY_PATH.

It is possible to set this in several ways.

5.1 Shared libraries path

The library search path environment variable name differs between different systems:

  • Linux: LD_LIBRARY_PATH
  • Windows: PATH

TOMLAB for Mac OS X does not currently require the corresponding variable to be set, due to all binaries having hard-coded paths to their respective dependencies. This, on the other hand, demands that binary files in the TOMLAB directory are not moved from their locations.

The way environment variables are set varies depending on operating systems and shells.

5.1.1 Windows

To set the PATH environment variable permanently on Windows, do: Control Panel → System → Advanced → Environment Variables. Assuming TOMLAB was installed in C:\tomlab, append (or prepend) C:\tomlab\shared separated to the other entries with a semi-colon (;) to the PATH environment variable.

The PATH environment variable can also be set temporarily in a running command shell. This is done by doing

  C:\> set PATH=%PATH%;C:\tomlab\shared

This change will only be applied in that command shell, and will therefore be discarded when the command shell is terminated.

5.1.2 Linux systems

Set on command line when invoking MATLAB:

 [user@host:~]$ LD_LIBRARY_PATH=[$LD_LIBRARY_PATH:]/tpath/shared <ml> &

where <ml> is the name of your MATLAB executable and tpath is the TOMLAB installation path. If LD_LIBRARY_PATH is already set to something and you wish to preserve this, include the part in [ ] - but not the actual brackets themselves.

Set in $HOME/.bashrc, $HOME/.profile, $HOME/.cshrc (or $HOME/.matlab7rc.sh if it exists):

 export LD_LIBRARY_PATH=/tpath/shared # bash
 setenv LD_LIBRARY_PATH /tpath/shared # csh and similar

If you have an existing value in LD_LIBRARY_PATH, use a colon : to separate directories when adding the TOMLAB directory:

 export LD_LIBRARY_PATH=/tpath/shared:$LD_LIBRARY_PATH # bash
 setenv LD_LIBRARY_PATH /tpath/shared:$LD_LIBRARY_PATH # csh and similar

If installing for multiple users as super-user, /etc/ld.so.conf.d/tomlab.conf is automatically created, eliminating the need for path manipulation.

Mac OS X installations do not require the corresponding variable DYLD_LIBRARY_PATH to be set, but proper function depends on the location of the tomlab/shared folder and its contents.

5.1.3 MATLAB 7.8+ on 64-bit Linux

A potential problem concerning shared library versions may lead to crashes when running certain TOMLAB MEX files. This is related to MATLAB and/or the runtime linker loading the wrong version of a support library.

The following workaround is suggested:

Start Matlab 7.8+ from a shell prompt with the following option:

 [user@host:~] LD_PRELOAD=$TOMLAB/shared/libgfortran.so.1.0.0 \
 LD_LIBRARY_PATH=$TOMLAB/shared \
 $MATLAB78 &

In the above command, replace $TOMLAB with the path to your TOMLAB installation, and $MATLAB78 with the name of your MATLAB 7.8 binary. This may vary depending on your particular setup, e.g. if having a symbolic link to the MATLAB binary or not. You may need to specify the full path to the MATLAB installation. For example:

 [user@host:~]$ LD_PRELOAD=/home/user/tomlab/shared/libgfortran.so.1.0.0 \
 LD_LIBRARY_PATH=/home/user/tomlab/shared \
 /usr/local/matlab78/bin/matlab &

Additionally, if using the KNITRO solver and you experience errors about libgomp.so not being found, add an LD_PRELOAD statement for this library too. Use locate or find to find its full path. It is not supplied with TOMLAB.

« Previous « Start » Next »