Ask Your Question

Changing opencv2 installation options & recompiling

asked 2011-04-04 14:02:49 -0600

Robin gravatar image

updated 2011-04-04 14:12:48 -0600


I'd like to rebuild the opencv2 package with ffmpeg turned on (default is off). I used roscd to switch to opencv2 and sudo-edited the Makefile to turn the ffmpeg flag on. But now I don't know how to recompile the package. I tried renaming ROS_NOBUILD, but then rosmake gives me error about not having permission to rm several files.

Any suggestions on how to recompile?


edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2011-04-05 03:34:05 -0600

Brian Gerkey gravatar image

updated 2011-04-05 08:29:22 -0600

It's not a good idea to modify the system installation of a package. For one thing, it's an artifact of the current deb packaging system that the sources are still available to be rebuilt; in the future, installed packages will contain just the pieces needed to use the package, not the sources. More importantly, if you rebuild opencv2, then you should rebuild all packages that depend on it, to avoid getting into an inconsistent state. While you might be ok in this case if you're only changing the contents of a shared library, it's a slippery slope, and inconsistent builds are a pain to debug.

Instead, you should create an overlay of the stacks that you want to modify and add it to your package path. In this case, you'd check out from source vision_opencv and all the stacks you're using that depend (directly or indirectly) on vision_opencv, then make changes to opencv2 and rebuild everything. rosinstall is a good tool to help you manage the contents of the overlay (but as far as I know there's no way automatically construct an appropriate rosinstall file for a given overlay situation).

edit flag offensive delete link more

answered 2011-04-12 15:33:35 -0600

joq gravatar image

Shell commands to build a rosinstall overlay, as Brian recommends:

$ cp /opt/ros/diamondback/.rosinstall opencv2.rosinstall
$ roslocate info opencv2 >> opencv2.rosinstall
$ rosinstall ~/ros opencv2.rosinstall
$ source ~/ros/setup.bash
edit flag offensive delete link more


In order to run those commands, you need rosinstall. Instructions here:
NStiurca gravatar image NStiurca  ( 2011-06-22 05:12:01 -0600 )edit

answered 2011-04-09 00:22:53 -0600

I want to correct that after colon is not user name but group name:

sudo chown -R user_name:group_name opencv2

Yes some distributions make group name clones from usernames but this is kind of feature you should not always expect. I also want to point out that changing user is not always good idea (as someone already pointed out). In such cases I would suggest relaxing group permissions:

sudo find PATH_NAME -type f -exec chmod g+rw {} \;
sudo find PATH_NAME -type d -exec chmod g+rwx {} \;

Then you can add any user requiring access to those files into /etc/groups and meanwhile don't break anything what already works.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-04-04 14:02:49 -0600

Seen: 580 times

Last updated: Apr 12 '11