Ask Your Question
0

Problem in building RVIZ tutorial (Markers: Sending Basic Shapes)

asked 2020-05-06 09:52:56 -0500

sole_unizon gravatar image

updated 2020-05-06 11:33:03 -0500

Hello there. I am a beginner in ROS.

I am trying to go through the first tutorial of RVIZ which is sending basic shape. The page is here.

I followed exactly the tutorial with my build package in the path user/catkin_ws/src. I added the file"basic_shapes.cpp" and put it under src folder. I also edited CMAKE file with the two lines from the tutorial page.

add_executable(basic_shapes src/basic_shapes.cpp)
target_link_libraries(basic_shapes ${catkin_LIBRARIES})

When I run "catkin_make", this error shows in the console.

user:~/catkin_ws$ catkin_make
Base path: /home/user/catkin_ws
Source space: /home/user/catkin_ws/src
Build space: /home/user/catkin_ws/build
Devel space: /home/user/catkin_ws/devel
Install space: /home/user/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/user/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/user/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/user/catkin_ws/devel;/home/user/simulation_ws/devel;/home/simulations/public_sim_ws/devel;/opt/ros/kinetic
-- This workspace overlays: /home/user/catkin_ws/devel;/home/user/simulation_ws/devel;/home/simulations/public_sim_ws/devel;/opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/user/catkin_ws/build/test_results
-- Found gmock sources under '/usr/src/gmock': gmock will be built
-- Found gtest sources under '/usr/src/gmock': gtests will bebuilt
-- Using Python nosetests: /usr/local/bin/nosetests-2.7
-- catkin 0.7.18
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - using_markers
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'using_markers'
-- ==> add_subdirectory(using_markers)
-- Configuring done
CMake Error at using_markers/CMakeLists.txt:207 (add_executable):
  Cannot find source file:

    src/basic_shapes.cpp

  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: basic_shapes
CMake Error: Cannot determine link language for target "basic_shapes".
-- Generating done
-- Build files have been written to: /home/user/catkin_ws/build
Makefile:682: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

----------

update: after running the code second time, the error below occurs:

make[2]: *** No rule to make target 'using_markers/CMakeFiles/basic_shapes.dir/build'.  Stop.
CMakeFiles/Makefile2:437: recipe for target 'using_markers/CMakeFiles/basic_shapes.dir/all' failed
make[1]: *** [using_markers/CMakeFiles/basic_shapes.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

the content of CMAKE file is as follow:

cmake_minimum_required(VERSION 2.8.3)
project(using_markers)
find_package(catkin REQUIRED COMPONENTS
  roscpp
  visualization_msgs
)
catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES using_markers
#  CATKIN_DEPENDS roscpp visualization_msgs
#  DEPENDS system_lib
)

include_directories(
# include
  ${catkin_INCLUDE_DIRS}
)

## Declare a C++ library
# add_library(${PROJECT_NAME}
#   src/${PROJECT_NAME}/using_markers.cpp
# )

add_executable(basic_shapes src/basic_shapes.cpp)
target_link_libraries(basic_shapes ${catkin_LIBRARIES})
edit retag flag offensive close merge delete

Comments

What is the output of: ls -al /home/user/catkin_ws/src/using_markers/src/basic_shapes.cpp?

gvdhoorn gravatar image gvdhoorn  ( 2020-05-06 09:56:46 -0500 )edit

this is the console output:

-rw-r--r-- 1 user user 4805 May  6 13:53 /home/user/catkin_ws/src/using_markers/src/basic_shapes.cpp

I also tried running the "catkin_make" command again and now the console shows this error:

make[2]: *** No rule to make target 'using_markers/CMakeFiles/basic_shapes.dir/build'.  Stop.
CMakeFiles/Makefile2:437: recipe for target 'using_markers/CMakeFiles/basic_shapes.dir/all' failed
make[1]: *** [using_markers/CMakeFiles/basic_shapes.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

any idea of what's going on?

sole_unizon gravatar image sole_unizon  ( 2020-05-06 10:21:49 -0500 )edit

Please show your CMakeLists.txt. Be sure to remove all the boilerplate comments in it. We don't need those.

And add your CMakeLists.txt to the question body. Do not post it here in a comment.

gvdhoorn gravatar image gvdhoorn  ( 2020-05-06 11:07:37 -0500 )edit

sorry about that. I updated the question.

sole_unizon gravatar image sole_unizon  ( 2020-05-06 11:32:37 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-05-06 12:17:51 -0500

sole_unizon gravatar image

Actually I have found the answer! (Sorry for all the ruckus I made).

My mistakes are:

  1. I didn't properly create my package in catkin_ws/src. I put them in catkin_ws and then moved them into catkin_ws/src folder.

  2. I didn't put the basic_shapes.cpp in the CORRECT SRC folder. I put them inside catkin_ws/src. The correct one is to put inside catkin_ws/src/using_markers/src.

  3. I simply move the files by dragging (cut/paste). When I encountered the error of not finding the basic_shapes.cpp, I just move it inside any folder then redo the catkin_make command. The correct action is to start from fresh with all the components in correct place.

Thanks for everthing!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2020-05-06 09:43:24 -0500

Seen: 68 times

Last updated: May 06 '20