Ask Your Question
0

How to configure catkin + catkin_pkg from source?

asked 2014-03-10 10:25:09 -0600

aleeper gravatar image

updated 2014-03-10 11:34:52 -0600

This question is related to http://answers.ros.org/question/64702... but it seemed better to ask separately than to hijack that thread.

I'm using catkin as a build tool from source. Basically, I want to have a base workspace that just contains catkin so that I can chain workspaces from there by using the setup.bash file. However, every catkin package (including catkin itself) depends on catkin_pkg. Since we are using catkin_pkg from source as well, I was hoping to be able to manually point to the catkin_pkg python files while configuring the catkin workspace, and have those files available in chained workspaces as well. I tried the following to "build" catkin:

export PYTHONPATH=/path_to_custom_install_dir_for/catkin_pkg/src:$PYTHONPATH
cmake .. (with appropriate build and install dirs set)
make

But, when I source the setup.bash file that is created, the PYTHONPATH only has catkin, not my custom path to catkin_pkg.

Am I misunderstanding what about "the environment in which it was created" is pulled in when sourcing the setup file? Or, is there a smarter way to set up catkin + catkin_pkg from source in user-space? (I don't want to install it via apt-get or pip).

EDIT based on comments below: Say I have workspaces A, B, C.
Now I:

  • add catkin_pkg to my PYTHONPATH
  • source ws_A/devel/setup.bash (PYTHONPATH now has both catkin_pkg and the ws_A stuff)
  • build ws_B.
  • In a new terminal, I source ws_B/devel/setup.bash, and then try to build ws_C.

Should I expect to see catkin_pkg on the PYTHONPATH in the new terminal? I think that's what I'm doing now, but the catkin_pkg that was on the PYTHONPATH when building B doesn't get passed along through the setup.bash. It's fine if the answer is "that doesn't work", I just want to be sure before I pick a different design.

edit retag flag offensive close merge delete

Comments

1

That is the case, the PYTHONPATH will not be preserved by the setup file. The setup file will add any underlaid workspaces in your environment to your PYTHONPATH, but if catkin_pkg is not installed into one of these "underlays" then it will not get set by the generated setup files.

William gravatar image William  ( 2014-03-10 12:04:48 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-03-10 10:43:35 -0600

demmeln gravatar image

I think the "the environment in which it was created" mainly refers to CMAKE_PREFIX_PATH, which is recorded. I'm not 100% sure what other aspects of the environment are saved, but certainly not all environment variables. Have you considered installing catkin_pkg with pip in user space? There is the --user flag for pip install, and alternatively you can use virtualenv to achieve this.

edit flag offensive delete link more

Comments

1

It only persists the build variables not your entire environment. It will update things like the PYTHONPATH, but not wipe out modifications you already had. So if you add a PYTHONPATH before the setup.bash it will persist. So the answer to your question is to add catkin_pkg to your PYTHONPATH before you used the devel/install space.

tfoote gravatar image tfoote  ( 2014-03-10 11:05:30 -0600 )edit

I ran out of characters so I edited the original question :)

aleeper gravatar image aleeper  ( 2014-03-10 11:35:26 -0600 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-03-10 10:25:09 -0600

Seen: 272 times

Last updated: Mar 10 '14