How to CMake error log file to determine which one of the packages has the error and where is the error is?

Hello everyone,

I am working my way through the 5 Days ROS course with Python. I am in unit 5 (Services-Client) now. Along the way, I have created dummy packages to do some practice. Now, when I try to build my catkin_ws using catkin_make I get an error. I viewed the file CMakeError.log. However, there was no information as to which one of my packages was responsible for the error. Below is the content of CMakeError.log.

Kind regards, and I look forward to hearing from you soon.

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:

Change Dir: /home/user/catkin_ws/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_8d8c6/fast && /usr/bin/make -f CMakeFiles/cmTC_8d8c6.dir/build.make CMakeFiles/cmTC_8d8c6.dir/build

make[1]: Entering directory '/home/user/catkin_ws/build/CMakeFiles/CMakeTmp'

Building C object CMakeFiles/cmTC_8d8c6.dir/src.c.o

/usr/bin/cc   -DCMAKE_HAVE_LIBC_PTHREAD   -o CMakeFiles/cmTC_8d8c6.dir/src.c.o   -c /home/user/catkin_ws/build/CMakeFiles/CMakeTmp/src.c

Linking C executable cmTC_8d8c6

/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8d8c6.dir/link.txt --verbose=1

/usr/bin/cc  -DCMAKE_HAVE_LIBC_PTHREAD    -rdynamic CMakeFiles/cmTC_8d8c6.dir/src.c.o  -o cmTC_8d8c6 

/usr/bin/ld: CMakeFiles/cmTC_8d8c6.dir/src.c.o: in function `main':

src.c:(.text+0x46): undefined reference to `pthread_create'

/usr/bin/ld: src.c:(.text+0x52): undefined reference to `pthread_detach'

/usr/bin/ld: src.c:(.text+0x63): undefined reference to `pthread_join'

collect2: error: ld returned 1 exit status

make[1]: *** [CMakeFiles/cmTC_8d8c6.dir/build.make:87: cmTC_8d8c6] Error 1

make[1]: Leaving directory '/home/user/catkin_ws/build/CMakeFiles/CMakeTmp'

make: *** [Makefile:121: cmTC_8d8c6/fast] Error 2

Source file was:

#include <pthread.h>

void* test_func(void* data)

{

  return data;

}

int main(void)

{

  pthread_t thread;

  pthread_create(&thread, NULL, test_func, NULL);

  pthread_detach(thread);

  pthread_join(thread, NULL);

  pthread_atfork(NULL, NULL, NULL);

  pthread_exit(NULL);

  return 0;

}

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(s):/usr/bin/make cmTC_69d2f/fast && /usr/bin/make -f CMakeFiles/cmTC_69d2f.dir/build.make CMakeFiles/cmTC_69d2f.dir/build

make[1]: Entering directory '/home/user/catkin_ws/build/CMakeFiles/CMakeTmp'

Building C object CMakeFiles/cmTC_69d2f.dir/CheckFunctionExists.c.o

/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_69d2f.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.16/Modules/CheckFunctionExists.c

Linking C executable cmTC_69d2f

/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_69d2f.dir/link.txt --verbose=1

/usr/bin/cc  -DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic CMakeFiles/cmTC_69d2f.dir/CheckFunctionExists.c.o  -o cmTC_69d2f  -lpthreads 

/usr/bin/ld: cannot find -lpthreads

collect2: error: ld returned 1 exit status

make[1]: *** [CMakeFiles/cmTC_69d2f.dir/build.make:87: cmTC_69d2f] Error 1

make[1]: Leaving directory '/home/user/catkin_ws/build/CMakeFiles/CMakeTmp'

make: *** [Makefile:121: cmTC_69d2f/fast] Error 2

Hi @aabuaish2,

Welcome to the Community!

The direct output of catkin_make itself usually gives some hints, unless the error is very fatal. Could you paste here the output of catkin_make, from the point where you executed it to the point where it exited?

A post was split to a new topic: Catkin build errors