ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Is it possible to change the compiler in ROS?

asked 2012-04-17 08:13:37 -0600

supat gravatar image

updated 2014-01-28 17:11:59 -0600

ngrennan gravatar image

I am the beginner for ROS and trying to run the AspectC++, but now I am stuck with the compilation issue. Since the AspectC++ is using ac++ or ag++, while the ROS is using c++ compiler, I am wondering if we can change the compiler of ROS to some other else? And how? Please help and Thanks in advance

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2012-04-17 22:38:46 -0600

Thomas gravatar image

CMake honors the CC and CXX environment variable so you can use whatever compiler you prefer by setting these variables. For instance, I use ccache for all my ROS compilation without any trouble.

 export CC=/path/to/my/c/compiler
 export CXX=/path/to/my/c++/compiler
 rosmake

You can then double check which compiler has been used by running:

grep COMPILER CMakeCache.txt

...in any ROS build directory. CMAKE_CXX_COMPILER should be your custom C++ compiler.

Unless you recompile ROS from scratch, you will have to make sure that the ABI are compatible (i.e. that you can link a g++ library against an aspectc++ one).

Be aware that porting the code so that it is compatible with a new compiler is a lot of work. Do not do it unless you are already a C++ experienced programmer and ready to spend a couple of months on this.

edit flag offensive delete link more

Comments

I've tried this for building catkin libraries (on OS X), but no luck -- it still just uses clang.

Noldorin gravatar image Noldorin  ( 2013-02-26 16:23:34 -0600 )edit
1

answered 2012-04-17 14:53:31 -0600

Kevin gravatar image

Didn't you already ask this question??? Why can't you just compile ROS with g++ and write your nodes with AspectC++? If AspectC++ doesn't support this, then it would probably take a lot of work to fix ROS.

I have never heard of AspectC++ before, so I could be wrong. Please take a look at the REPs to help understand what ROS is ... specifically REP-3 Target Platforms and REP-9 ABI Compatibility to see if AspectC++ violates those. Some of the other ones might be useful to read too. Good luck!

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2012-04-17 08:13:37 -0600

Seen: 1,620 times

Last updated: Apr 17 '12