Ask Your Question
0

catkin_make fails on feature test macro.

asked 2014-04-21 01:36:43 -0600

Nap gravatar image

[Ubuntu 13.10, ROS Hydro-Desktop-Full (built from source)]

I am getting an error I can't find a resolution to when using catkin_make for a project of mine. For some reason, it fails on a line in a header file which turns dispatch_release() on/off based on CLANG's __has_feature(objc_arc) feature test macro.

[100%] Building CXX object gwbrb/CMakeFiles/gwbrb_node.dir/src/gwbrb.cpp.o
In file included from /home/user/projects/gWRb/src/gwbrb/src/gwbrb.h:5:0,
                 from /home/user/projects/gWRb/src/gwbrb/src/gwbrb.cpp:16:
/home/user/projects/gswb/gwbw.h:110:19: error: missing binary operator before token "("
 #if !__has_feature(objc_arc)
                   ^
make[2]: *** [gwbrb/CMakeFiles/gwbrb_node.dir/src/gwbrb.cpp.o] Error 1
make[1]: *** [gwbrb/CMakeFiles/gwbrb_node.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed

Does catkin switch to Obj-c when it needs to, or do I have to tell it manually? Can someone please assist with instructions?

Cheers, Nap

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-04-21 08:02:37 -0600

William gravatar image

updated 2014-04-22 08:07:53 -0600

catkin doesn't do anything specific for Obj-C, this is more likely to be a CMake behavior, but I don't know much about that.

A quick google search didn't turn up anything either. It looks like you are using GCC, and I believe that this is a CLANG specific feature (__has_feature(...)), maybe that is the root cause of the problem?

Update:

Adding these CMake options will ensure that clang is used for compilation, allowing that feature to work:

-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
edit flag offensive delete link more

Comments

@William, thnx. It's definately a CLANG feature, and I was thinking that `catkin_make` ran clang by default. So I've now added `-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++` in my wrapper script, and it's getting past that error. Cool.

Nap gravatar imageNap ( 2014-04-21 08:25:45 -0600 )edit

Ok, yeah catkin_make just does the normal cmake invocation, it doesn't set a compiler explicitly. Glad you got it working.

William gravatar imageWilliam ( 2014-04-21 10:03:08 -0600 )edit

@William, add the CMake switches I posted above to your post and I'll mark it as the answer.

Nap gravatar imageNap ( 2014-04-22 01:28:29 -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-04-21 01:36:43 -0600

Seen: 158 times

Last updated: Apr 22 '14