[DynInst_API:] commit 45feff81435754b317f980e33a9bad7de4846de5 breaks cmake


Date: Thu, 19 Jul 2018 17:09:59 -0400
From: William Cohen <wcohen@xxxxxxxxxx>
Subject: [DynInst_API:] commit 45feff81435754b317f980e33a9bad7de4846de5 breaks cmake
I was trying to build a git checkout of dyninst on Fedora 28 and the cmake failed.  Below is the cmake that I copied from the the rpmbuild of dyninst-9.3.2 srpm on Fedora 28:

 /usr/bin/cmake -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DLIB_SUFFIX=64 -DBUILD_SHARED_LIBS:BOOL=ON -DENABLE_STATIC_LIBS=1 -DINSTALL_LIB_DIR:PATH=/usr/lib64/dyninst -DINSTALL_INCLUDE_DIR:PATH=/usr/include/dyninst -DINSTALL_CMAKE_DIR:PATH=/usr/lib64/cmake/Dyninst -DCMAKE_BUILD_TYPE=None -DCMAKE_SKIP_RPATH:BOOL=YES


Attached is the CMakeError.log file saying that it was unable to test for pthread_create because -lpthreads could not be found.  Shouldn't that be "-lpthread"?


/usr/lib64/ccache/cc  -DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic CMakeFiles/cmTC_6b097.dir/CheckFunctionExists.c.o  -o cmTC_6b097 -lpthreads 
/usr/bin/ld: cannot find -lpthreads


A git bisect showed the failure  is triggered by the following patch:

commit 45feff81435754b317f980e33a9bad7de4846de5
Author: Xiaozhu Meng <xmeng@xxxxxxxxxxx>
Date:   Fri Dec 29 10:26:49 2017 -0600

    Add unstrip and codeCoverage to the example dir. Will build and install
    them with Dyninst

Anyone else noticed this type of problem before?  Maybe a bug with cmake on Fedora 28?

-Will
Determining if the pthread_create exist failed with the following output:
Change Dir: /home/wcohen/research/profiling/dyninst/dyninst/CMakeFiles/CMakeTmp

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

File /home/wcohen/research/profiling/dyninst/dyninst/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/wcohen/research/profiling/dyninst/dyninst/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/gmake" "cmTC_6b097/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_6b097.dir/build.make CMakeFiles/cmTC_6b097.dir/build
gmake[1]: Entering directory '/home/wcohen/research/profiling/dyninst/dyninst/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_6b097.dir/CheckFunctionExists.c.o
/usr/lib64/ccache/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_6b097.dir/CheckFunctionExists.c.o   -c /usr/share/cmake/Modules/CheckFunctionExists.c
Linking C executable cmTC_6b097
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_6b097.dir/link.txt --verbose=1
/usr/lib64/ccache/cc  -DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic CMakeFiles/cmTC_6b097.dir/CheckFunctionExists.c.o  -o cmTC_6b097 -lpthreads 
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
gmake[1]: *** [CMakeFiles/cmTC_6b097.dir/build.make:87: cmTC_6b097] Error 1
gmake[1]: Leaving directory '/home/wcohen/research/profiling/dyninst/dyninst/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:126: cmTC_6b097/fast] Error 2


[← Prev in Thread] Current Thread [Next in Thread→]