npth finds pthread_mutex_timedlock() which android does not have

Hans-Christoph Steiner hans at guardianproject.info
Fri Mar 9 16:41:31 CET 2012


On Mar 9, 2012, at 10:30 AM, Marcus Brinkmann wrote:

> On 02/20/2012 09:07 PM, Hans-Christoph Steiner wrote:
>> 
>> Apparently, Android's NDK defines pthread_mutex_timedlock() in the
>> headers but then does not implement it.  And it seems they aren't close
>> to implementing it:
>> http://code.google.com/p/android/issues/detail?id=2138
>> 
>> This is of course a really crappy situation since it means that you
>> can't do simple things like AC_CHECK_FUNCS([pthread_mutex_timedlock])
>> because that actually finds the function.
> 
> Actually, are you sure?  I set up cross build environments for android-8, -9 and -14, and it seems to work as expected:
> 
> android-8:
> 
> checking for library containing pthread_create... none required
> checking for pthread_tryjoin_np... no
> checking for pthread_setname_np... no
> checking for pthread_getname_np... no
> checking for pthread_mutex_timedlock... no
> checking for pthread_rwlock_rdlock... no
> checking for pthread_rwlock_wrlock... no
> checking for pthread_rwlock_timedrdlock... no
> checking for pthread_rwlock_timedwrlock... no
> checking for pthread_rwlock_tryrdlock... no
> checking for pthread_rwlock_trywrlock... no
> 
> android-9 and -14 (sorry, not the output, just the config.log):
> 
> ac_cv_func_pthread_getname_np=no
> ac_cv_func_pthread_mutex_timedlock=no
> ac_cv_func_pthread_rwlock_rdlock=yes
> ac_cv_func_pthread_rwlock_timedrdlock=yes
> ac_cv_func_pthread_rwlock_timedwrlock=yes
> ac_cv_func_pthread_rwlock_tryrdlock=yes
> ac_cv_func_pthread_rwlock_trywrlock=yes
> ac_cv_func_pthread_rwlock_wrlock=yes
> ac_cv_func_pthread_setname_np=yes
> ac_cv_func_pthread_tryjoin_np=no
> 
> And this makes sense, because AC_CHECK_FUNCS does not look at the header file, but if linking with the symbol works.
> 
> The compile errors you get are due to the fact that these functions were used unconditionally in npth.
> 
> I am going to work on replacement functions, but I want to make sure I am not missing something that makes AC_CHECK_FUNC fail for you.

I didn't look too deep into it, I just built it and ran it, and it complained about not finding pthread_rwlock_*. It sounds like you found the actual cause.

.hc




More information about the Gnupg-devel mailing list