Main Content

Install Required Libraries on NVIDIA Boards Using the Terminal

You can use the terminal to install the third-party libraries that NVIDIA® Jetson™ or NVIDIA DRIVE® boards require to work with MATLAB®. Alternatively, for Jetson platforms, you can automatically install the required libraries using the Hardware Setup tool. To use NVIDIA DRIVE boards with MATLAB, you must install the required libraries using the terminal.

Before using the terminal, install the JetPack SDK or DriveOS SDK on the board using NVIDIA SDK Manager. For supported JetPack and DriveOS versions, see Prerequisites for Generating Code for NVIDIA Boards.

Install Libraries on NVIDIA Hardware Board

You can install the libraries in these bundles on Jetson or DRIVE boards:

  • Core bundle

  • Audio and video bundle

  • IoT bundle

  • Modbus® bundle

You must install the libraries in the core bundle on the board to use it with MATLAB. The libraries in the other three bundles are optional, and provide functionality for audio and video processing, Internet of Things (IoT) communication, and the Modbus protocol.

Core Bundle

You must install the libraries in the core bundle on the hardware board to use it with the support package. To install the libraries in the core bundle, use these commands.

LibraryInstallation Command

libsdl1.2debian

sudo apt-get install libsdl1.2debian

libsdl1.2-dev

sudo apt-get install libsdl1.2-dev

v4l-utils

sudo apt-get install v4l-utils

git

sudo apt-get install git

make

sudo apt-get install make

Audio and Video Bundle

To use the hardware board for audio and video processing, install these libraries.

LibraryInstallation Command

For NVIDIA Jetson: nvidia-l4t-gstreamer

For NVIDIA DRIVE: libgstreamer-plugins-base1.0-dev

For NVIDIA Jetson:

sudo apt-get install nvidia-l4t-gstreamer

For NVIDIA DRIVE:

sudo apt install libgstreamer-plugins-base1.0-dev

sox

sudo apt-get install sox
libsox-fmt-all
sudo apt-get install libsox-fmt-all
libsox-dev
sudo apt-get install libsox-dev
alsa-utils
sudo apt-get install alsa-utils

You must install these libraries to create these MATLAB objects:

You must also install these libraries to use these Simulink® blocks:

Internet of Things Bundle

To use the hardware board for IoT communication, install these libraries.

LibraryInstallation Command
fakeroot
sudo apt-get install fakeroot
devscripts
sudo apt-get install devscripts
dh-make
sudo apt-get install dh-make
lsb-release
sudo apt-get install lsb-release
libssl-dev
sudo apt-get install libssl-dev
libjson-c-dev
sudo apt-get install libjson-c-dev
paho.mqtt.c
git clone https://github.com/eclipse/paho.mqtt.c.git
cd paho.mqtt.c
make
sudo make install

You must install the libraries in the IoT bundle to use these Simulink blocks:

Modbus Bundle

To use the hardware board for the Modbus protocol, install these libraries.

LibraryInstallation Command
automake
sudo apt-get install automake
autoconf
sudo apt-get install autoconf
libtool
sudo apt-get install libtool
libmodbus
git clone https://github.com/stephane/libmodbus
cd libmodbus
./autogen.sh
./configure && sudo make install

You must install the libraries in the Modbus bundle to create modbus objects and to use these Simulink blocks:

Set Environment Variables

The support package uses environment variables to locate the libraries required for code generation. The required environment variables must be accessible by non-interactive SSH logins. To set the environment variables, use the export command in the non-interactive login section of the .bashrc file. This table shows how to set the variables in a typical installation.

DescriptionSetting
Path to the CUDA® toolkit executable on the Jetson or DRIVE platform
export PATH=$PATH:/usr/local/cuda/bin
Path to the CUDA library folder on the Jetson or DRIVE platform
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64

This example shows a .bashrc file that sets the PATH and LD_LIBRARY_PATH variables.

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) 
         export PATH=$PATH:/usr/local/cuda/bin
         export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
         return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

#end to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
.
.
.

Alternatively, set the system-wide environment variables in the etc/environment file. Setting the environment variables in the etc/environment file requires sudo privileges. This example shows PATH and LD_LIBRARY_PATH variables in the etc/environment file.

PATH="/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
LD_LIBRARY_PATH="/usr/local/cuda/lib64/"