ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
3

How to build a package from source on Ubuntu MATE 16.04 LTS and ROS Kinetic?

asked 2017-01-20 05:29:26 -0500

sharan100 gravatar image

There are two packages that I could build from source for their respective reasons. The first one is ardrone-autonomy. This package, as indicated by this question, is not being installed on my computer with the command sudo apt-get install ros-kinetic-ardrone-autonomy. The other package is lsd-slam. This package, as indicated by this question, must be built from source. lsd-slam is yet to be released for ros-kinetic.

Now The standard instructions for building from source are:

$ cd ~/ros_catkin_ws
$ rosinstall_generator ros_desktop <package_name> --rosdistro kinetic --deps --wet-only --tar > kinetic-custom_ros.rosinstall
$ wstool merge -t src kinetic-custom_ros.rosinstall
$ wstool update -t src
$ rosdep install --from-paths src --ignore-src --rosdistro kinetic -y -r --os=debian:jessie
$ sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic

But when you install kinetic using the command, sudo apt-get install ros-kinetic-desktop-full, the folder ~/ros_catkin_ws is not created in your root directory. So how exactly am I supposed to proceed with the installation of ardrone-autonomy? I know these are the instructions for installing lsd-slam, but this also need me to use catkin_make and that would need ~/ros_catkin_ws. What exactly am I supposed to do here?

edit retag flag offensive close merge delete

Comments

Those are definitely not the "standard instructions for building from source", if only for the fact that you are forcing rosdep to consider dependency mapping for Debian Jessie. Also: this will build all of ROS, which is completely unnecessary (as I mentioned in #q252390).

gvdhoorn gravatar image gvdhoorn  ( 2017-01-20 06:21:40 -0500 )edit

So how would I go about building from source?

sharan100 gravatar image sharan100  ( 2017-01-20 07:21:33 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
19

answered 2017-01-20 08:08:13 -0500

gvdhoorn gravatar image

updated 2017-01-20 08:09:45 -0500

See the answer to #q208963, but to make it slightly more generic (so this is an example set of commands for a 'regular' ROS package, not one with special requirements and / or system dependencies that have to be built from sources):

# make sure you have sourced the correct setup.bash file for your ROS distribution already

# go to workspace src space
cd /path/to/your/catkin_ws/src

# acquire a copy of the sources of the package that you want to build.
# For a package hosted on github, you'd do something like (where
# $organisation and $package obviously depend on what it is that you
# want to build):
git clone https://github.com/$organisation/$package.git

# change to the workspace base directory (this has to be the working directory
# in a minute anyway when building, and we can shorten the 'rosdep' command a bit)
cd /path/to/your/catkin_ws

# we need to make sure you have all dependencies installed.

# once in a while, update our local database
rosdep update

# then check (and install) for any missing dependencies
# NOTE: we ask rosdep to check for ROS Indigo here, if you are using another ROS
# distribution, substitute that there (ie: for Kinetic, use 'kinetic', without the quotes)
rosdep install --from-paths src/ --ignore-src --rosdistro indigo

# now build
catkin_make

If compilation was successful, you should now have a build and devel directory next to the src directory, and after sourcing /path/to/your/catkin_ws/devel/setup.bash you should now be able to use the package you just built from sources.

Note: just cloning a package from somewhere is not enough. Packages most likely depend on other packages and / or system libraries to be present, and we use rosdep to install those for us. We do depend on the author(s) of the package that you are building to have properly declared their dependencies. If they haven't done so, catkin_make will tell you about that (in the form of "Can't find .." etc errors).

edit flag offensive delete link more

Comments

I have posted a new question here related to this topic.

sharan100 gravatar image sharan100  ( 2017-01-23 13:29:16 -0500 )edit
0

answered 2017-03-11 06:08:33 -0500

Sanjeeth gravatar image

$ source /opt/ros/distro/setup.bash replace distro with your distribution eg. kinetic or indigo or whatever. $ mkdir -p home/catkin_ws/src $ cd home/catkin_ws/src $ catkin_init_workspace now the workspace insempty $ cd home/catkin_ws $ catkin_make now you will have build and devel directories inside the catkin_ws directory. $ source devel/setup.bash $ cd home/catkin_ws/src $ git clone https://url_of_source_code or alternatively download the zip file from github and extract into the src directory $ cd /home/catkin_ws $ catkin_make $ source devel/setup.bash thats all

edit flag offensive delete link more

Comments

Thanks for the answer, but you're missing a crucial step: installing the dependencies of the package that you git cloned. Without that, you'll run into the same issues as @sharan100 ran into.

gvdhoorn gravatar image gvdhoorn  ( 2017-03-11 07:22:34 -0500 )edit

You can check for manifest.xml file where the dependencies will be enlisted and manually install those dependencies.

Sanjeeth gravatar image Sanjeeth  ( 2017-03-12 05:49:05 -0500 )edit
1

And why would you do that if we have rosdep to do that for us?

gvdhoorn gravatar image gvdhoorn  ( 2017-03-12 06:20:54 -0500 )edit

Yes you can use rosdep, but he mentioned he want to build from source, so I assumed may be the dependencies are not officially released yet.

Sanjeeth gravatar image Sanjeeth  ( 2017-03-12 10:08:55 -0500 )edit
1

Thanks but @gvdhoorn had a perfect answer up there.

sharan100 gravatar image sharan100  ( 2017-03-13 01:25:27 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-01-20 05:29:26 -0500

Seen: 18,114 times

Last updated: Mar 11 '17