Hi,

Here's a workaround fix for the error in the subject. I call it
"workaround" because cmake devs have still not managed to solve
these issues with check_symbol_exists()...

The problem is: the check for pthread_mutex_lock() fails ->
HAVE_PTHREAD_MUTEX_LOCK is not defined -> undefined references
occur, because:

$ grep HAVE_PTHREAD_MUTEX_LOCK lib/Support/Mutex.cpp
#if defined(HAVE_PTHREAD_H) && defined(HAVE_PTHREAD_MUTEX_LOCK)

So, I did for pthread_mutex_lock a workaround similar to the
one that was already committed for pthread_getspecific and
pthread_rwlock_init:

http://llvm.org/bugs/show_bug.cgi?id=4476
https://llvm.org/viewvc/llvm-project?view=rev&revision=74426

OK?

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/llvm/Makefile,v
retrieving revision 1.40
diff -u -p -r1.40 Makefile
--- Makefile    23 Apr 2012 23:11:01 -0000      1.40
+++ Makefile    4 May 2012 13:58:03 -0000
@@ -5,7 +5,7 @@ SHARED_LIBS +=  libclang                
 COMMENT =      modular, fast C/C++/ObjC compiler, static analyzer and tools
 
 LLVM_V =       3.0
-REVISION =     1
+REVISION =     2
 DISTNAME =     llvm-${LLVM_V}
 
 CATEGORIES =   devel
Index: patches/patch-cmake_config-ix_cmake
===================================================================
RCS file: patches/patch-cmake_config-ix_cmake
diff -N patches/patch-cmake_config-ix_cmake
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-cmake_config-ix_cmake 4 May 2012 13:58:03 -0000
@@ -0,0 +1,24 @@
+$OpenBSD$
+
+Fix CMake check for pthread_mutex_lock
+
+--- cmake/config-ix.cmake.orig Fri May  4 14:05:40 2012
++++ cmake/config-ix.cmake      Fri May  4 14:07:10 2012
+@@ -87,6 +87,7 @@ if( NOT PURE_WINDOWS )
+   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()
+ 
+@@ -131,9 +132,6 @@ check_symbol_exists(strchr string.h HAVE_STRCHR)
+ 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 )

Reply via email to