Skip to content

Installation Ubuntu 18.04

Florian Tschopp edited this page Jun 28, 2019 · 1 revision

Installing on Ubuntu 18.04

Install required system packages

sudo apt install -y software-properties-common
sudo add-apt-repository "deb http://packages.ros.org/ros/ubuntu bionic main"
wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add -
sudo apt update

sudo apt install -y ros-melodic-desktop-full doxygen liblapack-dev libblas-dev \
autotools-dev dh-autoreconf libboost-all-dev python-setuptools git g++ cppcheck \
default-jre libgtest-dev libglew-dev clang-format-3.9 python-git \
pylint python-termcolor "ros-melodic-camera-info-manager*" protobuf-compiler protobuf-c-compiler \
python-wstool python-catkin-tools libssh2-1-dev libatlas3-base \
libnlopt-dev ccache ros-melodic-octomap ros-melodic-octomap-ros ros-melodic-gps-common \
"ros-melodic-tf2-*" python-pip python-autopep8 libreadline-dev ifstat ntpdate sysstat libv4l-0

Update ROS environment

sudo rosdep init
rosdep update
echo ". /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc

(OPTIONAL) Install ccache for faster rebuilds.

ccache is a tool that caches intermediate build files to speed up rebuilds of the same code. On Ubuntu it can be set up with the following command. The max. cache size is set to 10GB and can be adapt on the lines below:

sudo apt install -y ccache &&\
echo 'export PATH="/usr/lib/ccache:$PATH"' | tee -a ~/.bashrc &&\
source ~/.bashrc && echo $PATH
ccache --max-size=10G

Your path (at least the beginning) should look like:

/usr/lib/ccache:/usr/local/cuda-5.5/bin/:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

And g++/gcc should now point to:

which g++ gcc
/usr/lib/ccache/g++
/usr/lib/ccache/gcc

Show cache statistics:

ccache -s

Empty the cache and reset the stats:

ccache -C -z

ccache only works for a clean workspace. You will need a make clean otherwise.

Create a catkin workspace

There is a ROS-install file which contains all the necessary repositories for your workspace.

To create a workspace using this file:

export CATKIN_WS=~/maplab_ws
mkdir -p $CATKIN_WS/src
cd $CATKIN_WS
catkin init
catkin config --merge-devel
catkin config --extend /opt/ros/melodic
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release
cd src
git clone git@github.com:ethz-asl/maplab_private --recursive
git clone -b devel/maplab_private git@github.com:ethz-asl/maplab_dependencies --recursive

If you use ccache also execute:

catkin config --cmake-args  -DCMAKE_CXX_COMPILER_LAUNCHER=ccache

Then, install the linter.

Then build the packages:

cd $CATKIN_WS
catkin build maplab_private

Enable colored diagnostics in gcc

cd $CATKIN_WS
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-fdiagnostics-color

Requires gcc>=4.9

Solutions to specific issues

opencv3_catkin build freezes.

A known cause for this is an installed MATLAB using a network licence. The build can stall on getting the licence authenticated; so make sure that the licence server can be accessed, connect to the VPN if required.

Error of libGL.so with Nvidia drivers

make[5]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libGL.so', needed by 'lib/libopencv_viz.so.3.2.0'.  Stop.

consider redefining the symbolic link that somehow got lost in your Ubuntu by:

sudo rm /usr/lib/x86_64-linux-gnu/libGL.so
sudo ln -s /usr/lib/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so

ImportError: No module named 'requests'

Install requests by calling:

sudo pip install requests

Clone this wiki locally