[llvm-commits] [PATCH] Fix CMake check for pthread_mutex_lock

Brad Smith brad at comstyle.com
Sat Aug 18 00:03:37 PDT 2012


The attached diff for the CMake build infrastructure fixes
the check for pthead_mutex_lock. CMake is attempting to build
a binary to check for the existence of the symbol but not
linking in libpthread.

/usr/bin/cc   -O2 -pipe        CMakeFiles/cmTryCompileExec2801244708.dir/CheckSymbolExists.c.o  -o cmTryCompileExec2801244708  -lm -Wl,-rpath-link,/usr/X11R6/lib:/us
r/local/lib
CMakeFiles/cmTryCompileExec2801244708.dir/CheckSymbolExists.c.o(.text+0x6): In function `main':
: undefined reference to `pthread_mutex_lock'
collect2: ld returned 1 exit status

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-------------- next part --------------
Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake	(revision 161828)
+++ cmake/config-ix.cmake	(working copy)
@@ -87,6 +87,7 @@
   check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD)
   check_library_exists(pthread pthread_getspecific "" HAVE_PTHREAD_GETSPECIFIC)
   check_library_exists(pthread pthread_rwlock_init "" HAVE_PTHREAD_RWLOCK_INIT)
+  check_library_exists(pthread pthread_mutex_lock "" HAVE_PTHREAD_MUTEX_LOCK)
   check_library_exists(dl dlopen "" HAVE_LIBDL)
 endif()
 
@@ -134,9 +135,6 @@
 check_symbol_exists(strcmp string.h HAVE_STRCMP)
 check_symbol_exists(strdup string.h HAVE_STRDUP)
 check_symbol_exists(strrchr string.h HAVE_STRRCHR)
-if( NOT PURE_WINDOWS )
-  check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK)
-endif()
 check_symbol_exists(sbrk unistd.h HAVE_SBRK)
 check_symbol_exists(srand48 stdlib.h HAVE_RAND48_SRAND48)
 if( HAVE_RAND48_SRAND48 )


More information about the llvm-commits mailing list