0
$\begingroup$

Rosanswers logo

I recently installed ROS indigo and following the tutorial to get to know ROS. However, error occurred after catkin_make. I have also included the log files. Please help me out let me know how to fix this!! Appreciate it!!


The error:

Base path: /home/ciara/catkin_ws
Source space: /home/ciara/catkin_ws/src
Build space: /home/ciara/catkin_ws/build
Devel space: /home/ciara/catkin_ws/devel
Install space: /home/ciara/catkin_ws/install

####
#### Running command: "make cmake_check_build_system" in "/home/ciara/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/ciara/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/indigo
-- This workspace overlays: /opt/ros/indigo
-- 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/ciara/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.6.18
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - beginner_tutorials
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'beginner_tutorials'
-- ==> add_subdirectory(beginner_tutorials)
-- Using these message generators: gencpp;genlisp;genpy
CMake Error at /opt/ros/indigo/share/genmsg/cmake/genmsg-extras.cmake:94 (message):
  add_message_files() directory not found:
  /home/ciara/catkin_ws/src/beginner_tutorials/msg
Call Stack (most recent call first):
  beginner_tutorials/CMakeLists.txt:13 (add_message_files)

-- Configuring incomplete, errors occurred!
See also "/home/ciara/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/ciara/catkin_ws/build/CMakeFiles/CMakeError.log".
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed
Base path: /home/ciara/catkin_ws
Source space: /home/ciara/catkin_ws/src
Build space: /home/ciara/catkin_ws/build
Devel space: /home/ciara/catkin_ws/devel
Install space: /home/ciara/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/ciara/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/ciara/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/indigo
-- This workspace overlays: /opt/ros/indigo
-- 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/ciara/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.6.18
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - beginner_tutorials
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'beginner_tutorials'
-- ==> add_subdirectory(beginner_tutorials)
-- Using these message generators: gencpp;genlisp;genpy
CMake Error at /opt/ros/indigo/share/genmsg/cmake/genmsg-extras.cmake:94 (message):
  add_message_files() directory not found:
  /home/ciara/catkin_ws/src/beginner_tutorials/msg
Call Stack (most recent call first):
  beginner_tutorials/CMakeLists.txt:13 (add_message_files)

-- Configuring incomplete, errors occurred!
See also "/home/ciara/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/ciara/catkin_ws/build/CMakeFiles/CMakeError.log".
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

My CMakelists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(beginner_tutorials)

# Find catkin and any catkin packages
find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  genmsg
)

## Declare ROS messages and services
add_message_files(DIRECTORY msg FILES Num.msg)
add_service_files(DIRECTORY srv FILES AddTwoInts.srv)

## Generate added messages and services with any dependencies listed here
 generate_messages(
   DEPENDENCIES
   std_msgs
 )

catkin_package()

include_directories(include ${catkin_INCLUDE_DIRS})

add_executable(talker src/talker.cpp)
target_link_libraries(talker ${catkin_LIBRARIES})
add_dependencies(talker beginner_tutorials_generate_messages_cpp)

add_executable(listener src/listener.cpp)
target_link_libraries(listener ${catkin_LIBRARIES})
add_dependencies(listener beginner_tutorials_generate_messages_cpp)

CMakeError.log:

Determining if the pthread_create exist failed with the following output:
Change Dir: /home/ciara/catkin_ws/build/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec917054501/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec917054501.dir/build.make CMakeFiles/cmTryCompileExec917054501.dir/build
make[1]: Entering directory `/home/ciara/catkin_ws/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/ciara/catkin_ws/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec917054501.dir/CheckSymbolExists.c.o
/usr/bin/cc    -o CMakeFiles/cmTryCompileExec917054501.dir/CheckSymbolExists.c.o   -c /home/ciara/catkin_ws/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTryCompileExec917054501
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec917054501.dir/link.txt --verbose=1
/usr/bin/cc       CMakeFiles/cmTryCompileExec917054501.dir/CheckSymbolExists.c.o  -o cmTryCompileExec917054501 -rdynamic 
CMakeFiles/cmTryCompileExec917054501.dir/CheckSymbolExists.c.o: In function `main':
CheckSymbolExists.c:(.text+0x16): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
make[1]: *** [cmTryCompileExec917054501] Error 1
make[1]: Leaving directory `/home/ciara/catkin_ws/build/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec917054501/fast] Error 2

File /home/ciara/catkin_ws/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef pthread_create
  return ((int*)(&pthread_create))[argc];
#else
  (void)argc;
  return 0;
#endif
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/ciara/catkin_ws/build/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec2346830332/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec2346830332.dir/build.make CMakeFiles/cmTryCompileExec2346830332.dir/build
make[1]: Entering directory `/home/ciara/catkin_ws/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/ciara/catkin_ws/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec2346830332.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTryCompileExec2346830332.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-2.8/Modules/CheckFunctionExists.c
Linking C executable cmTryCompileExec2346830332
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec2346830332.dir/link.txt --verbose=1
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create    CMakeFiles/cmTryCompileExec2346830332.dir/CheckFunctionExists.c.o  -o cmTryCompileExec2346830332 -rdynamic -lpthreads 
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [cmTryCompileExec2346830332] Error 1
make[1]: Leaving directory `/home/ciara/catkin_ws/build/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec2346830332/fast] Error 2

Environment variable:

ROS_ROOT=/opt/ros/indigo/share/ros
ROS_PACKAGE_PATH=/opt/ros/indigo/share:/opt/ros/indigo/stacks
ROS_MASTER_URI=http://localhost:11311
ROS_HOSTNAME=localhost
ROSLISP_PACKAGE_DIRECTORIES=
ROS_DISTRO=indigo
ROS_ETC_DIR=/opt/ros/indigo/etc/ros

Originally posted by [email protected] on ROS Answers with karma: 81 on 2016-05-07

Post score: 2


Original comments

Comment by lucasw on 2016-05-07:
Can you run find * in your beginner_tutorials and post that too? Does msg/Num.msg exist?

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Did you notice the error "add_message_files() directory not found" ? I think the paramemer "msg" in the function add_message_files() may be error, or there is no file msg/Num.msg. In the other way, maybe your msg file's name is wrong, please check it. By the way, I ever made this stupid error.


Originally posted by Fighting_bird with karma: 72 on 2016-05-08

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Fighting_bird on 2016-05-08:
By the way, please learn to read the output of building in patience, though it is so long.

$\endgroup$
0
$\begingroup$

Rosanswers logo

I fixed the problem by commenting out the following lines then it compiles just fine! Thanks guys!!!

## Declare ROS messages and services
add_message_files(DIRECTORY msg FILES Num.msg)
add_service_files(DIRECTORY srv FILES AddTwoInts.srv)

Originally posted by [email protected] with karma: 81 on 2016-05-08

This answer was NOT ACCEPTED on the original site

Post score: 4


Original comments

Comment by 130s on 2017-03-23:
-1. Although it depends on what you want to do, by commenting out add_{message, service}_files macros you're simply omitting the message/service building features, which I assume is what the tutorial you were working on expects you to do.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.