On 07/19/2018 05:30 PM, Xiaozhu Meng wrote:
> The cmake error log is misleading and I was misled by it before. CMake will try multiple linking flags to test the available of pthread library, including -lpthread, -lpthreads, and -pthread. So, there will always be errors messages about pthread.
>
> Unfortunately, the real reason that causes the cmake failure sometimes only is shown on the terminal.
>
>
>
> On Thu, Jul 19, 2018 at 4:10 PM William Cohen <wcohen@xxxxxxxxxx <mailto:wcohen@xxxxxxxxxx>> wrote:
>
> 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 <mailto: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
>
Hi,
Maybe something like the attached untested patch is what is needed to fix the cmake issue.
-Will
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 60134c673..6850faae0 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -9,9 +9,6 @@ add_executable(unstrip unstrip/unstrip.C
unstrip/callback.C)
add_dependencies(unstrip parseAPI symtabAPI instructionAPI common)
target_link_libraries(unstrip parseAPI symtabAPI instructionAPI common)
-file(COPY unstrip/ddb.db DESTINATION ${INSTALL_BIN_DIR})
-file(COPY unstrip/params.db DESTINATION ${INSTALL_BIN_DIR})
-file(COPY unstrip/unistd.db DESTINATION ${INSTALL_BIN_DIR})
add_executable(codeCoverage codeCoverage/codeCoverage.C)
add_dependencies(codeCoverage dyninstAPI patchAPI parseAPI symtabAPI instructionAPI pcontrol common)
@@ -30,5 +27,7 @@ install (TARGETS cfg_to_dot unstrip codeCoverage Inst
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${INSTALL_LIB_DIR}
PUBLIC_HEADER DESTINATION ${INSTALL_INCLUDE_DIR})
-
+
+install (FILES unstrip/ddb.db unstrip/params.db unstrip/unistd.db
+ DESTINATION ${INSTALL_BIN_DIR})
|