npth finds pthread_mutex_timedlock() which android does not have
Marcus Brinkmann
marcus.brinkmann at ruhr-uni-bochum.de
Tue Mar 13 17:40:41 CET 2012
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?
Thanks,
Marcus
More information about the Gnupg-devel
mailing list