Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/luoruidi/Desktop/ros_learn/C++_Merge_Ros/merge_ros/src/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-TruT1X

Run Build Command(s):/snap/clion/246/bin/ninja/linux/x64/ninja cmTC_a7d13 && [1/2] Building C object CMakeFiles/cmTC_a7d13.dir/src.c.o
[2/2] Linking C executable cmTC_a7d13
FAILED: cmTC_a7d13 
: && /usr/bin/cc  -rdynamic CMakeFiles/cmTC_a7d13.dir/src.c.o -o cmTC_a7d13   && :
/usr/bin/ld: CMakeFiles/cmTC_a7d13.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+0x5e): undefined reference to `pthread_cancel'
/usr/bin/ld: src.c:(.text+0x6f): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.


Source file was:
#include <pthread.h>

static void* test_func(void* data)
{
  return data;
}

int main(void)
{
  pthread_t thread;
  pthread_create(&thread, NULL, test_func, NULL);
  pthread_detach(thread);
  pthread_cancel(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/luoruidi/Desktop/ros_learn/C++_Merge_Ros/merge_ros/src/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-56yLpX

Run Build Command(s):/snap/clion/246/bin/ninja/linux/x64/ninja cmTC_df34f && [1/2] Building C object CMakeFiles/cmTC_df34f.dir/CheckFunctionExists.c.o
[2/2] Linking C executable cmTC_df34f
FAILED: cmTC_df34f 
: && /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_df34f.dir/CheckFunctionExists.c.o -o cmTC_df34f  -lpthreads && :
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.



