[llvm-commits] [llvm] r74284 - in /llvm/trunk: cmake/config-ix.cmake include/llvm/Config/config.h.cmake - cmake bug?

Xerxes RĂ„nby xerxes at zafena.se
Fri Jun 26 10:50:52 PDT 2009


Hi Doug.

Im having some issues with these two test when implemented using 
check_symbol_exists(), they both fail when they should not.
cd llvm
svn up
cd ..
mkdir llvm-build
cd llvm-build
cmake ../llvm
...
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
...
-- Looking for pthread_mutex_lock
-- Looking for pthread_mutex_lock - found
-- Looking for pthread_rwlock_init
-- Looking for pthread_rwlock_init - not found.
-- Looking for pthread_getspecific
-- Looking for pthread_getspecific - not found.

if i change config-ix.cmake to use  check_library_exists() for the tests 
then they both succeed on the same machine:

-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Looking for pthread_getspecific in pthread
-- Looking for pthread_getspecific in pthread - found
-- Looking for pthread_rwlock_init in pthread
-- Looking for pthread_rwlock_init in pthread - found
...
-- Looking for pthread_mutex_lock
-- Looking for pthread_mutex_lock - found

Im a bit puzzled why check_symbol_exists() dont seem to work for these 
two tests while working to find pthread_mutex_lock.
Could this be a cmake bug?
If i grep my /usr/include/pthread.h all the the symbols are there!:

[xranby at pusspuss llvm-build]$ grep pthread_getspecific 
/usr/include/pthread.h
extern void *pthread_getspecific (pthread_key_t __key) __THROW;

[xranby at pusspuss llvm-build]$ grep pthread_rwlock_init 
/usr/include/pthread.h
extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,

[xranby at pusspuss llvm-build]$ grep pthread_mutex_lock 
/usr/include/pthread.h
extern int pthread_mutex_lock (pthread_mutex_t *__mutex)


The attached patch fixes this issue by using check_library_exists() for 
pthread_getspecific and pthread_rwlock_init test.

Cheers
Xerxes

Den 2009-06-26 16:35, Douglas Gregor skrev:
> Author: dgregor
> Date: Fri Jun 26 09:35:43 2009
> New Revision: 74284
>
> URL: http://llvm.org/viewvc/llvm-project?rev=74284&view=rev
> Log:
> CMake: add configure checks for pthread_rwlock_init and pthread_getspecific
>
> Modified:
>      llvm/trunk/cmake/config-ix.cmake
>      llvm/trunk/include/llvm/Config/config.h.cmake
>
> Modified: llvm/trunk/cmake/config-ix.cmake
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=74284&r1=74283&r2=74284&view=diff
>
> ==============================================================================
> --- llvm/trunk/cmake/config-ix.cmake (original)
> +++ llvm/trunk/cmake/config-ix.cmake Fri Jun 26 09:35:43 2009
> @@ -64,6 +64,8 @@
>   check_symbol_exists(malloc_zone_statistics malloc/malloc.h
>                       HAVE_MALLOC_ZONE_STATISTICS)
>   check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK)
> +check_symbol_exists(pthread_rwlock_init pthread.h HAVE_PTHREAD_RWLOCK_INIT)
> +check_symbol_exists(pthread_getspecific pthread.h HAVE_PTHREAD_GETSPECIFIC)
>   check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL)
>    

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fix_config.xi.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090626/02a95f86/attachment.ksh>


More information about the llvm-commits mailing list