Ask Your Question

How to colorize shell while using rosmake?

asked 2011-10-11 03:38:56 -0600

Felix Tr gravatar image

Hello All,

I am a ROS user, and I compile and build packages using the "rosmake" command. I would be more than happy to know how to see the warnings and the errors coloured in my shell (if possible, using different colours).

Thank you all in advance, Felix.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2011-10-11 03:57:21 -0600

dornhege gravatar image

updated 2011-10-13 03:41:46 -0600

Are you aiming specifically at rosmake (i.e. not make in a ROS package)?

The normal make with CMake is colored from CMake and to get colored warnings and errors from g++ I use colorgcc.

  1. Install colorgcc by sudo apt-get install colorgcc
  2. Define a directory where you will have executables in your path, e.g. $HOME/bin (create bin in your home directory)
  3. Add this directory to your path, i.e. export PATH=$HOME/bin:$PATH. Prefereably put that line in your .bashrc or similar, so you only have to do this once
  4. In that directory create symlinks to colorgcc, i.e.:
    ~/bin$ ln -s /usr/bin/colorgcc c++
    ~/bin$ ln -s /usr/bin/colorgcc g++
    ~/bin$ ln -s /usr/bin/colorgcc gcc
    ~/bin$ ln -s /usr/bin/colorgcc cc

For CMake only the first line is required.

edit flag offensive delete link more


Hello, first of all I want to thank you for your answer. The second thing is that it is not clear for me :). I can compile my code in 2 different ways: 1. Just enter the shell and then use "rosmake my_package_name". 2. Enter into the package Ĩ want to build and using "make". I prefer the first way because in such way (as far as I know) dependencies are solved. I would be grateful to receive an answer "How to colourise errors and warnings in this case"? Thanks in advance.
Felix Tr gravatar image Felix Tr  ( 2011-10-12 02:06:29 -0600 )edit
My answer works only for 2. which I usually do. It seems quicker and during development dependencies don't change, but yes rosmake package would be better for that.
dornhege gravatar image dornhege  ( 2011-10-12 04:13:25 -0600 )edit
Thank you again, but I still don´t get it. If I use this line in order to compile my code "make" (inside of the needed package). What are the changes I should do in the command line in order to receive coloured output of the "make" command? Thank you again?
Felix Tr gravatar image Felix Tr  ( 2011-10-12 22:00:58 -0600 )edit
None. Just call make, it will be colorized. I've cleared up the description how to make that happen. As a side effect all calls that you do to c++/g++ (also non-ROS) will be colored - which for me is a desired effect.
dornhege gravatar image dornhege  ( 2011-10-13 03:37:35 -0600 )edit
Hello, the last answer was very helpful, thanks a lot!!! I will try it, and I hope there will be no problems :)
Felix Tr gravatar image Felix Tr  ( 2011-10-16 21:40:03 -0600 )edit

I've followed your instructions but there is still no color output. Rosmake should color its output by default because compiling errors are not red (and thus hard to find).

Susannah gravatar image Susannah  ( 2013-03-07 05:12:35 -0600 )edit

This only colors cmake, not rosmake. If you build you packages normally with make everything should be colored. When you use catkin instead of rosmake everything should be colored.

dornhege gravatar image dornhege  ( 2013-03-07 07:13:16 -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


Asked: 2011-10-11 03:38:56 -0600

Seen: 642 times

Last updated: Oct 13 '11