Installing ROS Melodic on Ubuntu 18.10

Brian Wright picture Brian Wright · Nov 12, 2018 · Viewed 8.3k times · Source

I can't be the only person interested in this combination of Cosmic (with Wayland) and Melodic.

I'll be up-front: I seem to have successfully managed this on my XPS 13 (9370), or at least the install script [eventually] completed successfully. However, there's a really hacky workaround. I'll gladly vote up replies of others who attempt an installation, regardless of outcome.

Basically, I ran the instructions on http://wiki.ros.org/Installation/Source for a "desktop" install, and here's how I dealt with the various snags along the way:

  • Override the distro, using bionic instead of cosmic:
    rosdep install --from-paths src --ignore-src --os=ubuntu:bionic --rosdistro melodic -y

  • Boost library errors...
    (See Michal Fapso's solution below. It's quicker, easier, less buggy...)
    After installing aptitude, switch back-and-forth between Boost 1.65 and Boost 1.67, retrying the installation after each switch. Seriously. The two commands to do this are:
    sudo aptitude install libboost1.65-all-dev
    and:
    sudo apt install libboost1.67-all-dev
    Alternate about a dozen times, making sure you get to a higher package number each time. [I think the next generation of ROS will need the Boost date_time function called differently.]

  • Random libraries---OGRE, libyaml:
    OGRE can be installed nice and easily with apt (libogre-1.9-dev)
    libyaml... can also be installed, except I tried three or four versions before this one stuck (libyaml-cpp0.3-dev)


roscore runs, showing melodic version 1.14.3. Turtlesim runs with turtle_tf2_demo (teleoperation), rviz works, as well as rosgraph and the Python (rospy) modules.

Report your errors, please!

Answer

Michal Fapso picture Michal Fapso · Nov 19, 2018

Thanks for your hints, Q. Wright. Here is a more detailed guide for ROS beginners like myself :)

This part is from http://wiki.ros.org/melodic/Installation/Source and includes Q. Wright's trick with specifying older ubuntu distro:

sudo apt-get install python-rosdep python-rosinstall-generator python-wstool python-rosinstall build-essential
sudo rosdep init
rosdep update
mkdir ~/projects/ros_catkin_ws
cd ~/projects/ros_catkin_ws
rosinstall_generator desktop_full --rosdistro melodic --deps --tar > melodic-desktop-full.rosinstall
wstool init -j8 src melodic-desktop-full.rosinstall
rosdep install --from-paths src --ignore-src --os=ubuntu:bionic --rosdistro melodic -y

Now, before we run the build process, there are boost library errors which Q. Wright mentioned. They are caused by the 'boost::posix_time::milliseconds' function which in newer boost versions accepts only an integer argument, but the actionlib package in ROS, gives it a float on several places. You can list all files using that function:

find -type f -print0 | xargs -0 grep 'boost::posix_time::milliseconds' | cut -d: -f1 | sort -u

Open them in your text editor and search for the 'boost::posix_time::milliseconds' function call. Float argument is passed in these files:

./src/actionlib/include/actionlib/client/simple_action_client.h
./src/actionlib/include/actionlib/destruction_guard.h
./src/actionlib/include/actionlib/server/simple_action_server_imp.h
./src/actionlib/src/connection_monitor.cpp
./src/actionlib/test/destruction_guard_test.cpp

and replace calls like this:

boost::posix_time::milliseconds(loop_duration.toSec() * 1000.0f));

to:

boost::posix_time::milliseconds(int(loop_duration.toSec() * 1000.0f)));

and these:

boost::posix_time::milliseconds(1000.0f)

to:

boost::posix_time::milliseconds(1000)

Now we can finally build ROS, hopefully without any error:

./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release