npth finds pthread_mutex_timedlock() which android does not have

Hans-Christoph Steiner hans at guardianproject.info
Mon Feb 20 21:07:59 CET 2012


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.  I made a quick patch which
works for getting a build, and I'm building the whole gnupg suite again
with npth now.  The patch is attached, its not pretty.  Let me know if
it should be done in another way.

npth build on Android currently dies with:

/bin/bash ../libtool --tag=CC   --mode=link
/usr/local/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc
--sysroot=/usr/local/android-ndk/platforms/android-9/arch-arm  -DANDROID
-I/var/lib/jenkins/jobs/gnupg-for-android/workspace/external/data/data/info.guardianproject.gpg/app_opt/include
-fdata-sections -ffunction-sections -Os
-L/var/lib/jenkins/jobs/gnupg-for-android/workspace/external/data/data/info.guardianproject.gpg/app_opt/lib
-Wl,--rpath,/var/lib/jenkins/jobs/gnupg-for-android/workspace/external/data/data/info.guardianproject.gpg/app_opt/lib
-Wl,--gc-sections -o t-mutex t-mutex.o ../src/libnpth.la
libtool: link:
/usr/local/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc
--sysroot=/usr/local/android-ndk/platforms/android-9/arch-arm -DANDROID
-I/var/lib/jenkins/jobs/gnupg-for-android/workspace/external/data/data/info.guardianproject.gpg/app_opt/include
-fdata-sections -ffunction-sections -Os -Wl,--rpath
-Wl,/var/lib/jenkins/jobs/gnupg-for-android/workspace/external/data/data/info.guardianproject.gpg/app_opt/lib
-Wl,--gc-sections -o .libs/t-mutex t-mutex.o
-L/var/lib/jenkins/jobs/gnupg-for-android/workspace/external/data/data/info.guardianproject.gpg/app_opt/lib
../src/.libs/libnpth.so -Wl,-rpath
-Wl,/data/data/info.guardianproject.gpg/app_opt/lib
../src/.libs/libnpth.so: undefined reference to `pthread_mutex_timedlock'
collect2: ld returned 1 exit status

.hc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: npth-android-fixes.patch
Type: text/x-patch
Size: 840 bytes
Desc: not available
URL: </pipermail/attachments/20120220/c5ac271c/attachment.bin>


More information about the Gnupg-devel mailing list