Note: Due to the USB 3.0 translation layer between native hardware and virtual machine, the librealsense team does not recommend or support installation in a VM.
The project requires two external dependencies, glfw and libusb-1.0. The Cmake build environment additionally requires pkg-config.
- Note glfw3 is only required if you plan to build the example code, not for librealsense core library.
Important Several scripts below invoke wget, git, add-apt-repository
which may be blocked by router settings or a firewall. Infrequently, apt-get mirrors or repositories may also timeout. For librealsense users behind an enterprise firewall, configuring the system-wide Ubuntu proxy generally resolves most timeout issues.
-
Update Ubuntu distribution, including getting the latest stable kernel
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
Check the kernel version - >
uname -r
In case of stack Ubuntu 14 LTS with Kernel prior to 4.4.0-04 (e.g. 3.19..) the basic apt-get upgrade rule is not sufficient to bring the distribution to the latest baseline recommended.
Therefore, perform the following command to promote both Kernel and FrontEndsudo apt-get install --install-recommends linux-generic-lts-xenial xserver-xorg-core-lts-xenial xserver-xorg-lts-xenial xserver-xorg-video-all-lts-xenial xserver-xorg-input-all-lts-xenial libwayland-egl1-mesa-lts-xenial
Note the exact Kernel version being installed (4.4.0-XX) for the next step.
At the end update OS Boot Menu and reboot to enforce the correct kernel selection
sudo update-grub && sudo reboot
Interrupt the boot process at Grub2 Boot Menu -> "Advanced Options for Ubuntu" -> Select the kernel version installed in the previous step.
Complete the boot, login and verify that the required kernel version in placeuname -r
>= 4.4.0-50
-
Install the packages required for librealsense build:
libusb-1.0 and pkg-config:
sudo apt-get install libusb-1.0-0-dev pkg-config
.
glfw3:
For Ubuntu 14.04: use
* ./scripts/install_glfw3.sh
For Ubuntu 16.04 install glfw3 via
* sudo apt-get install libglfw3-dev
- Library Build Process
librealsense employs CMake as a cross-platform build and project management system. Navigate to librealsense root directory and run
mkdir build && cd build
The default build is set to produce the core shared object and unit-tests binariescmake ../
In order to build librealsense along with the demos and tutorials usecmake ../ -DBUILD_EXAMPLES=true
If you don't want to have build dependencies to OpenGL and X11, you can also
build only the non-graphical examples:cmake ../ -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=false
Generate and install binaries:
make && sudo make install
The library will be installed in/usr/local/lib
, header files in/usr/local/include
The demos, tutorials and tests will located in/usr/local/bin
.
Note: Linux build configuration is presently configured to use the V4L2 backend by default
- Install IDE (Optional):
We use QtCreator as an IDE for Linux development on Ubuntu
- Follow the link for QtCreator5 installation
Note: Running RealSense Depth Cameras on Linux requires applying patches to kernel modules.
Ensure no Intel RealSense cameras are presently plugged into the system.
Install udev rules located in librealsense source directory:
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && udevadm trigger
Install openssl package required for kernel module build:
sudo apt-get install libssl-dev
Next, build the patched module for the desired machine configuration.
-
Ubuntu 14/16 LTS The script will download, patch and build uvc kernel module from sources.
Then it will attempt to insert the patched module instead of the active one. If failed the original uvc module will be preserved../scripts/patch-realsense-ubuntu-xenial.sh
-
Arch-based distributions
- You need to install the base-devel package group.
- You need to install the according linux-headers as well (i.e.: linux-lts-headers for the linux-lts kernel).
Navigate to the scripts folder: cd ./scripts/
Then run the following script to patch the uvc module:./patch-arch.sh
Check installation by examining the latest entries in kernel log:
sudo dmesg | tail -n 50
The log should indicate that a new uvcvideo driver has been registered. If any errors have been noted, first attempt the patching process again, and then file an issue if not successful on the second attempt (and make sure to copy the specific error in dmesg).
Error | Cause | Correction Steps |
---|---|---|
git.launchpad... access timeout |
Behind Firewall | Configure Proxy Server |
dmesg:... uvcvideo: module verification failed: signature and/or required key missing - tainting kernel |
A standard warning issued since Kernel 4.4-30+ | Notification only - does not affect module's functionality |
sudo modprobe uvcvideo produces dmesg: uvc kernel module is not loaded |
The patched module kernel version is incompatible with the resident kernel | Verify the actual kernel version with uname -r .Revert and proceed on Make Ubuntu Up-to-date step |
Execution of ./scripts/patch-video-formats-ubuntu-xenial.sh fails with fatal error: openssl/opensslv.h |
Missing Dependency | Install openssl package from Video4Linux backend preparation step |