Ask Your Question

# Changing opencv2 installation options & recompiling

Hi,

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?

~Robin

edit retag close merge delete

## 3 Answers

Sort by » oldest newest most voted

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).

more

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

more

## Comments

In order to run those commands, you need rosinstall. Instructions here: http://www.ros.org/wiki/rosinstall
( 2011-06-22 05:12:01 -0500 )edit

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.

more

## Your Answer

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

Add Answer

## Stats

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

Seen: 579 times

Last updated: Apr 12 '11