Cannot find -lpthreads

Hi!

I tried to install preCICE on Ubuntu 18.04, but faied with both cmake and Scons. My installation procedure followed the online instruction step by step without any changes. The information saved in CMakeError.log are shown below. Is there someone succeeding in the installation on Ubuntu 18.04? Could you please give me some tips? Thanks!

======================================
Determining if the pthread_create exist failed with the following output:
Change Dir: /scratch/hd/sw/precice-1.6.1/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_c11c8/fast"
/usr/bin/make -f CMakeFiles/cmTC_c11c8.dir/build.make CMakeFiles/cmTC_c11c8.dir/build
make[1]: Entering directory '/scratch/hd/sw/precice-1.6.1/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_c11c8.dir/CheckSymbolExists.cxx.o
/usr/bin/c++     -o CMakeFiles/cmTC_c11c8.dir/CheckSymbolExists.cxx.o -c /scratch/hd/sw/precice-1.6.1/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx
Linking CXX executable cmTC_c11c8
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c11c8.dir/link.txt --verbose=1
/usr/bin/c++       CMakeFiles/cmTC_c11c8.dir/CheckSymbolExists.cxx.o  -o cmTC_c11c8 
/usr/bin/ld: CMakeFiles/cmTC_c11c8.dir/CheckSymbolExists.cxx.o: in function `main':
CheckSymbolExists.cxx:(.text+0x1b): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_c11c8.dir/build.make:87: cmTC_c11c8] Error 1
make[1]: Leaving directory '/scratch/hd/sw/precice-1.6.1/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_c11c8/fast] Error 2

File /scratch/hd/sw/precice-1.6.1/build/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx:
/* */
#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: /scratch/hd/sw/precice-1.6.1/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_b7f0c/fast"
/usr/bin/make -f CMakeFiles/cmTC_b7f0c.dir/build.make CMakeFiles/cmTC_b7f0c.dir/build
make[1]: Entering directory '/scratch/hd/sw/precice-1.6.1/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_b7f0c.dir/CheckFunctionExists.cxx.o
/usr/bin/c++    -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_b7f0c.dir/CheckFunctionExists.cxx.o -c /scratch/hd/sw/precice-1.6.1/build/CMakeFiles/CheckLibraryExists/CheckFunctionExists.cxx
Linking CXX executable cmTC_b7f0c
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b7f0c.dir/link.txt --verbose=1
/usr/bin/c++   -DCHECK_FUNCTION_EXISTS=pthread_create    CMakeFiles/cmTC_b7f0c.dir/CheckFunctionExists.cxx.o  -o cmTC_b7f0c -lpthreads 
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_b7f0c.dir/build.make:87: cmTC_b7f0c] Error 1
make[1]: Leaving directory '/scratch/hd/sw/precice-1.6.1/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_b7f0c/fast] Error 2

Hey there!

It seems that you are missing a pthreads library, which should be included with the installation of boost. Could you verify that you have a boost library installed? Alternatively just try to install it by

sudo apt-get install libboost-all-dev

Hope this helps!

A post was split to a new topic: CMake does not find PETSc