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!
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:
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:
Open them in your text editor and search for the 'boost::posix_time::milliseconds' function call. Float argument is passed in these files:
and replace calls like this:
to:
and these:
to:
Now we can finally build ROS, hopefully without any error: