Ask Your Question
1

Moving packages to different directory

asked 2011-09-26 23:30:32 -0500

jrcapriles gravatar image

updated 2011-09-27 02:08:49 -0500

Hi all,

I was working on a package in a folder (~/workspace/Mypackage) the package was originally at this place when i came. I work on it and now that is ready I want to move it to (~/svn/stacks/Mypackage) this in order to update the svn repository with my modifications.

I copy the entire folder, delete the CMakeCache.txt ("find -name CMakeCache.txt -delete") in this folder. Update the address of myPackage at .bashrc, then i do rosmake and it didn't complain. I run my package and it works fine. But this happen while mi original package is also in the original place, i mean, while i have the 2 copies of my package (one in svn folder and the other in workspace folder) all work fine, i can run it without problems (if i do "roscd myPackage" it gets me to the package at svn folder and if i do "env | grep ROS" it returns

ROS_ROOT=/opt/ros/diamondback/ros
ROS_PACKAGE_PATH=/home/jose/svn/stacks:/opt/ros/diamondback/stacks
ROS_MASTER_URI=http://localhost:11311

So ROS only know the package at svn folder...

When i delete the original package (the one at workspace) and then re-run my package it fails. If i rebuild it, it say that it dind't find some files (at the build folder in workspace location)

How i should do the transition between my packages? and why it complain for some files (the folders are exactly the same) how i should rebuild in order to generate all the files needed in the new location?

UPDATE: The error that return the package when i move it to a different location is that it doesn't find the files included "No such file or directory" Thanks

edit retag flag offensive close merge delete

Comments

Under {{{myPackage/}}}, where are your header files? Do you have an {{{include_directories()}}} in CMakeLists.txt?
Thomas D gravatar image Thomas D  ( 2011-09-27 02:15:07 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted
2

answered 2011-09-27 01:42:43 -0500

Thomas D gravatar image

Try

$ rm -rf CMakeCache.txt CMakeFiles cmake_install.cmake msg_gen srv_gen src/myPackage
$ cmake .
$ rosmake

That has worked for me a bunch of times when doing exactly what you are trying to do. Basically, try to remove all auto-generated files and then build again.

edit flag offensive delete link more

Comments

I also do that and it usually worked... but this time it don't... I remove the auto-generated files, did a cmake . and then a rosmake and is the same. If i do it with the original package in his place all work fine, if i delete or change the name of the original package it return compilation error
jrcapriles gravatar image jrcapriles  ( 2011-09-27 02:29:39 -0500 )edit
The errors are basically that it didn't file included files... And if i compile my package with the original in his place (when all work fine) and then rename/delete the original and try to run the new one it fails. I really don't know what is happening...
jrcapriles gravatar image jrcapriles  ( 2011-09-27 02:32:27 -0500 )edit
1

answered 2013-11-25 13:04:15 -0500

Troy Wilson gravatar image

I know this is an old post but I just had this issue myself, and this was the first response that came up on Google, so for anyone else who has this issue the easy solution is as follows.

Just delete the build folder in the package in question and run make again (this worked for me in Hydro).

edit flag offensive delete link more
0

answered 2011-09-28 02:57:40 -0500

jrcapriles gravatar image

I solved the problem the hard way.. I copy the package to it's new place, overwrite all the files that had the previous address in some place and then remove the autogenerated files like Thomas said (thanks). I did:

grep -rlZ 'originaladdress' . | xargs -r0 perl -pi -e 's/originaladdress/newaddress/g'

All files that had the previous address in some place was modified to use the same files but in the new location, and then i deleted the autogenerated files:

rm -rf CMakeCache.txt CMakeFiles cmake_install.cmake msg_gen srv_gen src/myPackage
cmake .
rosmake

At the end i deleted the original package and run without a problem from the new location in svn folder, it's seems a lot of work just for moving a package but it was the only way that i make it work.

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

Stats

Asked: 2011-09-26 23:30:32 -0500

Seen: 4,969 times

Last updated: Nov 25 '13