npth finds pthread_mutex_timedlock() which android does not have

Hans-Christoph Steiner hans at guardianproject.info
Tue Mar 13 22:19:50 CET 2012



On 03/13/2012 12:40 PM, Marcus Brinkmann wrote:
> On 03/10/2012 04:52 AM, Hans-Christoph Steiner wrote:
>> Unfortunately, the Android linker doesn't give you much info, but you
>> can get more info using ld.  I copied all of the android-2.2 .so files
>> into /tmp and did this:
>>
>> $ arm-linux-androideabi-ld --rpath=/tmp libnpth.so
>> arm-linux-androideabi-ld: warning: cannot find entry symbol _start;
>> defaulting to 00008248
>> libnpth.so: undefined reference to `pthread_rwlock_rdlock'
>> libnpth.so: undefined reference to `pthread_rwlock_timedwrlock'
>> libnpth.so: undefined reference to `pthread_rwlock_timedrdlock'
>> libnpth.so: undefined reference to `pthread_rwlock_wrlock'
>> libnpth.so: undefined reference to `pthread_rwlock_trywrlock'
>> libnpth.so: undefined reference to `pthread_rwlock_tryrdlock'
> 
> Did you build npth against API level < 9?  You can't use the API level
>>= 9 builds of npth on earlier androids, because for those I enable the
> rwlock usage.  If there is a general expectation in the Android
> community that you can install builds against later API levels on
> earlier devices, we may change that.  Is that the case?
> 
> I tried building gnupg-for-android in the following way, and did not see
> any dangling rwlock related references in libnpth.so:
> 
> $ make -C external NDK_BASE=/.../android-ndk-r7b NDK_PLATFORM_LEVEL=8
> gnupg-install
> 
> $ arm-linux-androideabi-objdump --dynamic-syms libnpth.so.0.0.0 |grep
> '*UND*' | grep pthread_
> 00000000      DF *UND*    00000000              pthread_create
> 00000000      DF *UND*    00000000              pthread_exit
> 00000000      DF *UND*    00000000              pthread_sigmask
> 00000000      DF *UND*    00000000              pthread_self
> 00000000      DF *UND*    00000000              pthread_mutex_lock
> 00000000      DF *UND*    00000000              pthread_cond_wait
> 00000000      DF *UND*    00000000              pthread_mutex_trylock
> 00000000      DF *UND*    00000000              pthread_join
> 00000000      DF *UND*    00000000              pthread_cond_timedwait
> 
> If you did build against 8 and it still has undefined references,
> something is not working right.  Here is what is supposed to happen:
> 
> In npth/src/npth.h, I check the API level of Android, if it is < 9, I
> define _NPTH_NO_RWLOCK and define all npth_rwlock functions and types to
> equivalent mutex types or dummies.
> 
> Also, if _NPTH_NO_RWLOCK is defined, in src/npth.c, no functions using
> pthread_rwlock are defined.
> 
> If this isn't working for you, maybe you can find out what's going wrong?

You are correct, I hadn't changed NDK_PLATFORM_VERSION in
externals/Makefile.  Sorry for the noise.  There are now 2 places where
the platform has to be set... ug... project.properties and
externals/Makefile.  And it seems the earlier NDK version is android-5
but Google doesn't provide the SDK version android-5 nor the NDK version
android-7.  So it'd have to be SDK=android-7  NDK=android-5 if we wanted
to support earlier versions.

https://build.safermobile.org/job/gnupg-for-android/49/

.hc



More information about the Gnupg-devel mailing list