ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Issues building transform broadcaster code

asked 2020-06-30 04:41:35 -0600

jimc91 gravatar image

updated 2020-06-30 04:42:38 -0600

I am working through the Navgation Stack Tutorials on

I am using Ubuntu 16.04LTS and ROS Kinetic.

The issues occur when building the code (Step 5 from link below):

I feel the issue is happening at Steps 3 and 4, when I am broadcasting and then using a transform.

I am being told to save the text files as src/tf_broadcaster.cpp and src/tf_listener.cpp.

But you cannot save a file using /, so I am saving them in my src folder as tf_broadcaster.cpp and tf_broadcaster.cpp.

I then edit the CMake.txt file in this folder to include the below text:

add_executable(tf_broadcaster src/tf_broadcaster.cpp)

add_executable(tf_listener src/tf_listener.cpp)

target_link_libraries(tf_broadcaster ${catkin_LIBRARIES})

target_link_libraries(tf_listener ${catkin_LIBRARIES})

I already know before I build my code that there will be an error as it is calling to add executable src/....

I build the code using the commands:

cd ~/catkin_ws/


I then get the error below:

CMake Error at robot_setup_tf/CMakeLists.txt:208 (add_executable):
  Cannot find source file:


  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx

CMake Error at robot_setup_tf/CMakeLists.txt:209 (add_executable):
  Cannot find source file:


  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx

CMake Error: CMake can not determine linker language for target: tf_broadcaster

CMake Error: Cannot determine link language for target "tf_broadcaster".

CMake Error: CMake can not determine linker language for target: tf_listener

CMake Error: Cannot determine link language for target "tf_listener".

-- Generating done

-- Build files have been written to: /home/jamescoady/catkin_ws/build

Makefile:2866: recipe for target 'cmake_check_build_system' failed

make: *** [cmake_check_build_system] Error 1

Invoking "make cmake_check_build_system" failed

What am I doing wrong here? Am I saving the files incorrectly in steps 3&4?

edit retag flag offensive close merge delete


Could you update with the folder struct of the folders using the command "tree" (sudo apt install tree). In the package folder (Not in the workspace, the package [catkin_ws/src/robot_setup_tf])

Teo Cardoso gravatar image Teo Cardoso  ( 2020-06-30 11:36:08 -0600 )edit

When I run the command [catkin_ws/src/robot_setup_tf], I get the message [bash: catkin_ws/src/robot_setup_tf: Is a directory], so I am unsure if I am now in the package?

I ran [sudo apt install tree] after the first command above and it installed with no issues. (see next comment please)

jimc91 gravatar image jimc91  ( 2020-07-02 05:25:51 -0600 )edit

However, when I run [catkin_make] again I get some different errors

Base path: /home/jamescoady/catkin_ws
Source space: /home/jamescoady/catkin_ws/src
Build space: /home/jamescoady/catkin_ws/build
Devel space: /home/jamescoady/catkin_ws/devel
Install space: /home/jamescoady/catkin_ws/install
#### Running command: "make cmake_check_build_system" in "/home/jamescoady/catkin_ws/build"
#### Running command: "make -j8 -l8" in "/home/jamescoady/catkin_ws/build"
[0%] Built target std_msgs_generate_messages_cpp
[0%] Built target std_msgs_generate_messages_py
[0%] Built target std_msgs_generate_messages_eus
[0%] Built target std_msgs_generate_messages_lisp
[0%] Built target std_msgs_generate_messages_nodejs
Scanning dependencies of target tf_broadcaster
make[2]: *** No rule to make target 'robot_setup_tf/CMakeFiles/tf_broadcaster.dir/build'.  Stop.

There is more to follow in next message as I ran out of characters

jimc91 gravatar image jimc91  ( 2020-07-02 05:28:15 -0600 )edit

CMakeFiles/Makefile2:3855: recipe for target 'robot_setup_tf/CMakeFiles/tf_broadcaster.dir/all' failed

        make[1]: *** [robot_setup_tf/CMakeFiles/tf_broadcaster.dir/all] Error 2

        make[1]: *** Waiting for unfinished jobs....

        [  1%] Built target raspicam_node_gencfg

        [  1%] Built target _turtlebot3_msgs_generate_messages_check_deps_SensorState

        [  1%] Built target _turtlebot3_msgs_generate_messages_check_deps_Sound

        [  1%] Built target _turtlebot3_msgs_generate_messages_check_deps_VersionInfo

        [  1%] Built target _beginner_tutorials_generate_messages_check_deps_AddTwoInts

        [  1%] Built target _beginner_tutorials_generate_messages_check_deps_Num

        [  1%] Built target _raspicam_node_generate_messages_check_deps_MotionVectors

        Makefile:138: recipe for target 'all' failed

        make: *** [all] Error 2

        Invoking "make -j8 -l8" failed
jimc91 gravatar image jimc91  ( 2020-07-02 05:28:55 -0600 )edit

Teo Cardoso, would you have any advice on this?

jimc91 gravatar image jimc91  ( 2020-07-07 08:50:19 -0600 )edit

When I made the first comment I was aiming to see your folder struct because this error can be caused by missing files or something like this.

The command tree you generate something like this, could you post this struct of your package?

├── CMakeLists.txt

├── package.xml

├── scripts

│   ├──

│   ├── map2.png

│   ├── map3.png

│   └── map4.png

└── src

Teo Cardoso gravatar image Teo Cardoso  ( 2020-07-07 08:57:33 -0600 )edit

Sorry for the delay, here is the structure of the package:

jamescoady@jamescoady-Inspiron-5579:~$ cd catkin_ws/src/robot_setup_tf

jamescoady@jamescoady-Inspiron-5579:~/catkin_ws/src/robot_setup_tf $ tree
├── CMakeLists.txt
├── include
│   └── robot_setup_tf
├── package.xml
└── src
    ├── tf_broadcaster.cpp.odt
    └── tf_listener.cpp.odt

3 directories, 4 files
jimc91 gravatar image jimc91  ( 2020-07-10 05:40:02 -0600 )edit

I edited both files to remove .odt but still get the exact same error when running catkin_make. I have not copied and pasted it as it is the same error in my messages to you on July 2nd.

Just to be sure the issue is with the current package that I am using. I removed robot_setup_tf from my scr space and have run catkin_make again with no errors.

jimc91 gravatar image jimc91  ( 2020-07-14 06:28:58 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2020-07-11 13:12:28 -0600

In the files 'tf_listener.cpp.odt' and 'tf_broadcaster.cpp.odt'.

Remove the '.odt' from the name. The file name should be tf_broadcaster.cpp only. Same to the listener.

I guess this should solve your problems.

edit flag offensive delete link more


I went back and started again. When saving tf_broadcaster.cpp and tf_listener.cpp, I saved both as text files then ran catkin_make again and there was no issue.

jimc91 gravatar image jimc91  ( 2020-07-14 06:37:24 -0600 )edit

@Teo Cardoso I have the same error even the files are saved without .odt and when I run [catkin_make] I get errors

islemhm gravatar image islemhm  ( 2021-06-15 13:36:46 -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


Asked: 2020-06-30 04:41:35 -0600

Seen: 206 times

Last updated: Jun 15 '21