Cmake_check_build_system failed

It shows an error but when I run the code it work as i get the msg as shown

Hello @bolokangkk,

The reason for the error is probably shown above in the log. Could you please copy the full error message?

Best,

@albertoezquerro I got the same error while trying to make a package out of the quiz in part 4 of the ROS in 7 Days course.

Any help is much appreciated! I can also include the Output log if necessary but it was very long and harder to understand.

Here are the contents of CMakeError.log :

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

Run Build Command:"/usr/bin/make" “cmTC_90726/fast”
/usr/bin/make -f CMakeFiles/cmTC_90726.dir/build.make CMakeFiles/cmTC_90726.dir/build
make[1]: Entering directory ‘/home/user/catkin_ws/build/CMakeFiles/CMakeTmp’
Building C object CMakeFiles/cmTC_90726.dir/CheckSymbolExists.c.o
/usr/bin/cc -o CMakeFiles/cmTC_90726.dir/CheckSymbolExists.c.o -c /home/user/catkin_ws/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_90726
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_90726.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTC_90726.dir/CheckSymbolExists.c.o -o cmTC_90726 -rdynamic
CMakeFiles/cmTC_90726.dir/CheckSymbolExists.c.o: In function main': CheckSymbolExists.c:(.text+0x16): undefined reference to pthread_create’
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_90726.dir/build.make:97: recipe for target ‘cmTC_90726’ failed
make[1]: *** [cmTC_90726] Error 1
make[1]: Leaving directory ‘/home/user/catkin_ws/build/CMakeFiles/CMakeTmp’
Makefile:126: recipe for target ‘cmTC_90726/fast’ failed
make: *** [cmTC_90726/fast] Error 2

File /home/user/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/user/catkin_ws/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" “cmTC_0b7f9/fast”
/usr/bin/make -f CMakeFiles/cmTC_0b7f9.dir/build.make CMakeFiles/cmTC_0b7f9.dir/build
make[1]: Entering directory ‘/home/user/catkin_ws/build/CMakeFiles/CMakeTmp’
Building C object CMakeFiles/cmTC_0b7f9.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_0b7f9.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.5/Modules/CheckFunctionExists.c
Linking C executable cmTC_0b7f9
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0b7f9.dir/link.txt --verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_0b7f9.dir/CheckFunctionExists.c.o -o cmTC_0b7f9 -rdynamic -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_0b7f9.dir/build.make:97: recipe for target ‘cmTC_0b7f9’ failed
make[1]: *** [cmTC_0b7f9] Error 1
make[1]: Leaving directory ‘/home/user/catkin_ws/build/CMakeFiles/CMakeTmp’
Makefile:126: recipe for target ‘cmTC_0b7f9/fast’ failed
make: *** [cmTC_0b7f9/fast] Error 2

Hi @audrey.timmerman2,

Did you say you were trying to make one of the quiz packages? Your quiz itself should be one package - create everything you need inside this package. Don’t create or link multiple packages for the quiz - it might cause the grader to fail.

That said, try running the following from the catkin_ws directory (remove the build and devel directories and run catkin_make again):

rm -rf build/ devel/
catkin_make
source devel/setup.bash

I tried what you recommended and continue to get the same cmake fail error. :frowning:

The instructions for the quiz are:

The name of the package where you’ll place all the code related to the Quiz will be topics_quiz

Which I took to mean that the quiz will be a package. I have only made one package for the quiz. It is named topics_quiz.

Capture3

Okay, could you please paste the new errors here, right from the point where you ran catkin_make to where it exited?

Hello! Thanks for helping me. Here is the error message that happens after the cmake

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: “cmake /home/user/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/user/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/user/catkin_ws/install -G Unix Makefiles” in “/home/user/catkin_ws/build”

– The C compiler identification is GNU 5.4.0
– The CXX compiler identification is GNU 5.4.0
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– Using CATKIN_DEVEL_PREFIX: /home/user/catkin_ws/devel
– Using CMAKE_PREFIX_PATH: /home/user/catkin_ws/devel;/home/simulations/public_sim_ws/devel;/opt/ros/kinetic
– This workspace overlays: /home/user/catkin_ws/devel;/home/simulations/public_sim_ws/devel;/opt/ros/kinetic
– Found PythonInterp: /usr/bin/python2 (found suitable version “2.7.12”, minimum required is “2”)
– Using PYTHON_EXECUTABLE: /usr/bin/python2
– 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 gtest sources under ‘/usr/src/gmock’: gtests will be built
– Found gmock sources under ‘/usr/src/gmock’: gmock will be built
– Found PythonInterp: /usr/bin/python2 (found version “2.7.12”)
– Looking for pthread.h
– Looking for pthread.h - found
– Looking for pthread_create
– Looking for pthread_create - not found
– Looking for pthread_create in pthreads
– Looking for pthread_create in pthreads - not found
– Looking for pthread_create in pthread
– Looking for pthread_create in pthread - found
– Found Threads: TRUE
– Using Python nosetests: /usr/local/bin/nosetests-2.7
– catkin 0.7.20
– BUILD_SHARED_LIBS is on
– BUILD_SHARED_LIBS is on
– ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
– ~~ traversing 2 packages in topological order:
– ~~ - my_examples_pkg
– ~~ - topics_quiz
– ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
– +++ processing catkin package: ‘my_examples_pkg’
– ==> add_subdirectory(my_examples_pkg)
– +++ processing catkin package: ‘topics_quiz’
– ==> add_subdirectory(topics_quiz)
CMake Warning at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:76 (find_package):
Could not find a package configuration file provided by “std_msg” with any
of the following names:

std_msgConfig.cmake
std_msg-config.cmake

Add the installation prefix of “std_msg” to CMAKE_PREFIX_PATH or set
“std_msg_DIR” to a directory containing one of the above files. If
“std_msg” provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
topics_quiz/CMakeLists.txt:10 (find_package)

– Could not find the required component ‘std_msg’. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by “std_msg” with any
of the following names:

std_msgConfig.cmake
std_msg-config.cmake

Add the installation prefix of “std_msg” to CMAKE_PREFIX_PATH or set
“std_msg_DIR” to a directory containing one of the above files. If
“std_msg” provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
topics_quiz/CMakeLists.txt:10 (find_package)

– Configuring incomplete, errors occurred!
See also “/home/user/catkin_ws/build/CMakeFiles/CMakeOutput.log”.
See also “/home/user/catkin_ws/build/CMakeFiles/CMakeError.log”.
Invoking “cmake” failed

The snippet above, taken from the logs, contains the hint:
-> on line 10 of CMakeLists.txt you have written std_msg instead of std_msgs! Correct that and let’s see.