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

sudo catkin_make command not found

asked 2013-12-12 17:40:36 -0600

Nap gravatar image

updated 2013-12-12 17:41:06 -0600

I've been playing around with the TurtleSim demo project (and now have draw_square actually drawing a square, except that the precision of the g_goal->theta calculation is not enough to make the 4th side of the square as straight as I would like it).

I've been using catkin_make install -DCMAKE_INSTALL_PREFIX=/opt/ros/hydro to build the project. It works fine and updates the install space of my package. I tried sourcing the install/setup.bash file hoping it would perform the actual install into /opt/ros/hydro but it doesn't. So I've been manually copy/pasting the executables into the /opt/ros folder structure for testing.

I would like to do this the proper way, so I tried performing the above catkin_make command using sudo, thinking that it might be a permission problem. But when I do this, my terminal returns 'catkin_make: command not found'.

Could someone please explain:

  1. Why I'm getting command not found when using sudo catkin_make?

  2. What is the proper way of installing a package so that it can be run using rosrun?

Cheers,

Nap

I installed ROS Hydro using apt-get install.

(I am rather new to Ubuntu, having had lots of Windows experience though.)

edit retag flag offensive close merge delete

Comments

Don't know if this will solve the problem, but I can tell you that you cannot run the command catkin_make with sudo. Moreover the command catkin_make should be used in your catkin workspace folder, where are you running it?

Tirjen gravatar image Tirjen  ( 2013-12-12 19:39:08 -0600 )edit

yes, I'm running it in my catkin workspace. According to the tutorial (wiki.ros.org/catkin/Tutorials/using_a_workspace), it says that sudo might be required. What I'm really trying to achieve is to be able to install my new version of the TurtleSim project so I can run it using 'rosrun'.

Nap gravatar image Nap  ( 2013-12-12 19:46:04 -0600 )edit
1

If you want to run the command catkin_make in sudo, try first 'sudo -s' to get superuser permissions and then run 'catkin_make'. I don't understand well why you want to install the package, you could simply make it and the run it using rosrun, without installing it, but maybe I didn't understand well the question!

Tirjen gravatar image Tirjen  ( 2013-12-12 19:52:18 -0600 )edit

@Tirjen, so what you're saying is that I can do `source install/setup.bash` and this would set the path to my new version and rosrun turtlesim draw_square` wlll run my version not the one in /opt/ros/...? Edit: tested it: yes, that's how it works

Nap gravatar image Nap  ( 2013-12-13 13:47:03 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
4

answered 2013-12-12 20:08:04 -0600

fergs gravatar image

There are two issues here: permissions and environment. The reason you can't "sudo catkin_make" is that by using sudo, it changes your environment and you no longer have catkin_make on your path. catkin_make ended up on your path when you presumably did "source /opt/ros/hydro/setup.bash".

The second issue here is permissions. You can't install files to /opt because your user doesn't have the rights to. But, there is no reason to install to /opt, you can just do "catkin_make install" and then "source install/setup.bash" from within your workspace and everything that you just built should be on your path. These setup.bash scripts don't install anything or change any locations of files, instead they change your environment variables, specifically the PATH on which to look for executables and libraries. This also helps to explain why you need to source the file every time you create a new shell/terminal instance as your PATH needs to be updated again.

Which brings me to a third point: if your packages are not setup to do installation properly (I'm not sure if that tutorial is), then you might not actually have all your files in the installation. I would actually suggest that you just try your typical "catkin_make" without the install, and then source "devel/setup.bash".

edit flag offensive delete link more

Comments

and then `rosrun` will run the built executable instead of the /opt/ros/... version? Edit: tested: that's how it works.

Nap gravatar image Nap  ( 2013-12-13 13:49:06 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-12-12 17:40:36 -0600

Seen: 10,204 times

Last updated: Dec 12 '13