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

CMake error : Attempt to add a custom rule to output

asked 2014-07-28 05:03:50 -0500

RosFaceNoob gravatar image

updated 2014-07-28 07:12:22 -0500

Hi everybody, I am trying to migrate the face_recognition package to catkin but I have lots of problems. I tried with : http://wiki.ros.org/catkin/migrating_...
but it doesn't work. So I create a new catkin workspace and I tried to add every folder one by one as if it was a new project. When I try to do a catkin_make I have this message :

CMake Error: Attempt to add a custom rule to output "/home/www/ros/devel/include/face_recognition/FaceRecognitionAction.h.rule" which already has a custom rule.
CMake Error: Attempt to add a custom rule to output "/home/www/ros/devel/share/common-lisp/ros/face_recognition/msg/FaceRecognitionAction.lisp.rule" which already has a custom rule.
CMake Error: Attempt to add a custom rule to output "/home/www/ros/devel/lib/python2.7/dist-packages/face_recognition/msg/_FaceRecognitionAction.py.rule" which already has a custom rule.
-- Configuring incomplete, errors occurred!
make: *** [cmake_check_build_system] Erreur 1
Invoking "make cmake_check_build_system" failed

My Cmakelist.txt is like this:

cmake_minimum_required(VERSION 2.8.3)
project(face_recognition)
find_package(catkin REQUIRED COMPONENTS
actionlib
  actionlib_msgs
  cv_bridge
  image_transport
  #opencv2
  roscpp
  roslib
  rospy
  std_msgs
)
 add_message_files(
    FILES
    FaceRecognitionAction.msg
    #FaceRecognitionActionFeedback.msg
    #FaceRecognitionActionGoal.msg
    #FaceRecognitionActionResult.msg
    #FaceRecognitionFeedback.msg
    #FaceRecognitionGoal.msg
    #FaceRecognitionResult.msg
    #FRClientGoal.msg
 )

 find_package( OpenCV REQUIRED )

   add_action_files(
      FILES
      FaceRecognition.action
    )

   ## Generate added messages and services with any dependencies listed here
   generate_messages(
     DEPENDENCIES
     actionlib_msgs
     std_msgs
    )
     include_directories(  ${catkin_INCLUDE_DIRS}  ${OpenCV_INCLUDE_DIRS} )
     add_executable(Fserver src/face_recognition.cpp)
     add_executable(Fclient src/face_rec_client.cpp)

Can somebody help me please? thank you

edit retag flag offensive close merge delete

Comments

Please post your CMakeLists.txt

BennyRe gravatar image BennyRe  ( 2014-07-28 06:02:02 -0500 )edit

I edited my post

RosFaceNoob gravatar image RosFaceNoob  ( 2014-07-28 07:12:32 -0500 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2014-07-28 07:51:41 -0500

BennyRe gravatar image

Don't name your message FaceRecognitionAction.msg.

This name conflicts with your FaceRecognition.action because when the action gets compiled to message files a message called FaceRecognitionAction.msg will be created and this new message conflicts with your FaceRecognitionAction.msg.

So, simple solution: Rename your message.

edit flag offensive delete link more

Comments

I rename my action as FaceReco.action and it worked. but now I have a message : /home/www/ros/src/face_recognition/src/face_rec_client.cpp:12:52: fatal error: face_recognition/FaceRecognitionAction.h : Any file or folder of this type. I try to include a .h that I put in the folder include but I guess that's not where I should put it?

RosFaceNoob gravatar image RosFaceNoob  ( 2014-07-28 09:43:33 -0500 )edit

Sorry, I don't get your new problem from this description. What is the exact error message? What header files do you put in include. If include is the wrong place, where should header files go otherwise?

BennyRe gravatar image BennyRe  ( 2014-07-29 01:08:37 -0500 )edit

The error message says that the file FaceRecognitionAction.h doesn't exist but actually it exists and it's in my include folder. I don't know where I should put it so the program can find it. In the include file, I put all my headers. I don't know where else should I put them.

RosFaceNoob gravatar image RosFaceNoob  ( 2014-07-29 02:23:57 -0500 )edit

Do you mean the FaceRecognitionAction.h that was auto created from your action? This one shouldn't be in YOUR include directory. This one should be in devel/include automatically.

BennyRe gravatar image BennyRe  ( 2014-07-29 02:33:36 -0500 )edit

I think it's the FaceRecognitionaction.h auto created from my action that also generate messages. I clean the message folder so the message can be built automatically and try to buil again but I still have the error about the FaceRecognitionaction.h missing. My folder devel/include is empty.

RosFaceNoob gravatar image RosFaceNoob  ( 2014-07-29 02:46:30 -0500 )edit

I followed the actionlib tutorial. same problem with @RosFaceNoob. So when I first time compiled the Fibonacci.action, I commented out the add_action_files in CMakelist and copied the msg folder from devel/share to the package folder. Compiled successfully.

tianb03 gravatar image tianb03  ( 2015-03-24 20:10:37 -0500 )edit

@tianb03 I would recommend you to search for the true reason for your error. Your solution is not very nice and could possibly cause you some trouble afterwards.

BennyRe gravatar image BennyRe  ( 2015-03-25 01:50:21 -0500 )edit
1

answered 2014-07-28 13:45:49 -0500

ahendrix gravatar image

Are you trying to port this package over to catkin? https://github.com/procrob/procrob_fu...

If looks like you're trying to call message generation on the generated message files from your action files - this is unnecessary, because the action generation already does it for you - hence the error you're seeing about creating a rule that already exists.

edit flag offensive delete link more

Comments

Yes that's what I am trying to do. I just did a catkin_make, the generation is done automatically.

RosFaceNoob gravatar image RosFaceNoob  ( 2014-07-29 02:19:56 -0500 )edit

In that case, you should probably leave the action files named as they are, and don't use add_message_files at all.

ahendrix gravatar image ahendrix  ( 2014-07-29 12:37:28 -0500 )edit

When I try that, I still have the error about my FaceRecognitionAction.h that doesn't exist. I don't understand why it wasn't auto genrated.

RosFaceNoob gravatar image RosFaceNoob  ( 2014-07-30 02:27:09 -0500 )edit

You may need to add an explicit dependency between the program you're trying to compile and the header generation, so that they're run in the correct order. Something like:

add_dependencies(your_program ${${PROJECT_NAME}_EXPORTED_TARGETS})

ahendrix gravatar image ahendrix  ( 2014-07-30 12:14:10 -0500 )edit

I add to my CMakeLists.txt : add_dependencies(Fserver ${face_recognition_EXPORTED_TARGETS}) add_dependencies(Fclient ${face_recognition_EXPORTED_TARGETS}) Now I have this error: face_recognition.cpp:(.text._ZN3ros13serialization16VectorSerializerIfSaIfEvE5writeINS0_7OStreamEEEvRT_RKSt6vectorIfS2_E[void ros::serialization::VectorSerializer<float, std::allocator<float="">, void>::write<ros::serialization::ostream>(ros::serialization::OStream&, std::vector<float, std::allocator<float=""> > const&)]+0xae): undefined reference to `ros::serialization::throwStreamOverrun()' collect2: ld a retourné 1 code d'état d'exécution
make[2]: *** [/home/www/ros/devel/lib/face_recognition/Fserver] Erreur 1 make[1]: *** [face_recognition/CMakeFiles/Fserver.dir/all] Erreur 2 make[1]: *** Attente des tâches non terminées.... make[2]: *** [face_recognition/CMakeFiles/Fclient.dir/src/face_rec_client.cpp.o] Erreur 1 make[1]: *** [face_recognition/CMakeFiles/Fclient.dir/all] Erreur 2 make: *** [all] Erreur 2

RosFaceNoob gravatar image RosFaceNoob  ( 2014-07-31 08:12:56 -0500 )edit

You probably also need to do target_link_libraries(Fserver ${catkin_LIBRARIES}) in order to properly link against the ROS libraries.

ahendrix gravatar image ahendrix  ( 2014-07-31 14:29:57 -0500 )edit

I am back to my first error:
Linking CXX executable /home/www/ros/devel/lib/face_recognition/Fserver
[100%] Built target Fserver
Scanning dependencies of target face_recognition_generate_messages
[100%] Built target face_recognition_generate_messages
/home/www/ros/src/face_recognition/src/face_rec_client.cpp:13:43: erreur fatale:
face_recognition/FRClientGoal.h : Aucun fichier ou dossier de ce type compilation terminée. (the file doesn't exist) make[2]: *** [face_recognition/CMakeFiles/Fclient.dir/src/face_rec_client.cpp.o] Erreur 1
make[1]: *** [face_recognition/CMakeFiles/Fclient.dir/all] Erreur 2
make: *** [all] Erreur 2
Invoking "make" failed
I think I am in an infinite loop

RosFaceNoob gravatar image RosFaceNoob  ( 2014-08-01 02:38:08 -0500 )edit

That's a new error - notice that it's complaining about a new file. If FRClientGoal.msg isn't generated from an action, you may need to explicitly generate headers from it.

ahendrix gravatar image ahendrix  ( 2014-08-01 02:54:00 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-07-28 05:02:12 -0500

Seen: 8,296 times

Last updated: Jul 28 '14