User forums > Help
Environment Configuration for Custom Makefile
gammell:
Hi,
I'm working to make a template for ROS projects in Code::Blocks. I've got it mostly figured out (and would be quite happy to share it), except for some misunderstandings about configuring the CB shell environment. ROS uses custom Makefiles that call cmake using the shell macro. The Makefile is:
--- Quote from: Makefile ---include $(shell rospack find mk)/cmake.mk
--- End quote ---
This would normally return the path to the cmake template (i.e, something like "/opt/ros/ros/core/mk") with the /cmake.mk appended to the end of the path.
I enabled custom Makefiles in CB, but it doesn't work because the PATH variable does not include the directory for rospack. This is expected, as a traditional installation from source for ROS requires you to modify your ~/.bashrc as follows:
--- Quote from: ~/.bashrc ---source /opt/ros/setup.bash
--- End quote ---
This is where I've run into problems. How do I do a similar configuration in the CB environment on a per-project level? I tried simply putting the "source ..." line into the pre-build steps, but that gives the error
--- Quote ---/bin/sh: source: not found
--- End quote ---
All setup.bash does is some shell configuration (that is probably unnecessary for CB) and then calls setup.sh which is a file full of export commands to various shell variables (including PATH). I'd rather not copy the relevant variables out of the scripts however, as that results in a static solution that isn't very portable. The setup scripts are distributed as part of ROS, so using them would mean the template project would stay up-to-date with any configuration changes.
Can anyone provide any insight?
Thanks.
Jenna:
Did you try to call the shell-script(s) directly in the prebuild steps (without the source) ?
gammell:
--- Quote from: jens on May 15, 2011, 10:34:28 pm ---Did you try to call the shell-script(s) directly in the prebuild steps (without the source) ?
--- End quote ---
The scripts do not have the execute bit set by default so I did not.
I could obviously chmod them, but I was hoping to find a solution that didn't require any modification to the base ROS install (no matter how trivial) so the project files would be portable.
stahta01:
Use the shell name then redirect the script as input; it works at the Linux Prompt, no idea if it will work inside Code::Blocks.
Tim S.
gammell:
--- Quote from: stahta01 on May 16, 2011, 02:12:38 am ---Use the shell name then redirect the script as input; it works at the Linux Prompt, no idea if it will work inside Code::Blocks.
--- End quote ---
Do you mean
--- Code: ---/bin/sh setup.sh
--- End code ---
?
Yes, that runs the script without having an execute bit set; however, you're running a new shell inside the shell. All the shell variables and configuration belong to the child and disappear when the script finishes.
That or similar would work if there is a way to modify the default CB shell call, but I doubt that would be a project-level setting...
Does anyone know why the CB shell can't find source if it's /bin/sh?
Edit:
I don't think it matters, but I'm running Code::Blocks 10.05 on Ubuntu 10.04.2 LTS.
Navigation
[0] Message Index
[#] Next page
Go to full version