npth finds pthread_mutex_timedlock() which android does not have
Hans-Christoph Steiner
hans at guardianproject.info
Mon Feb 20 23:16:06 CET 2012
On 02/20/2012 03: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. 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
Turns out there is another issue with npth on Android. npth_yield is a
macro for pthread_yield, which Android does not seem to have. I cannot
find another confirmation of this besides pthread_yield() not being any
headers.
You can see in this build log that the build says both:
ldap-wrapper.c:471: warning: implicit declaration of function
'pthread_yield'
ldap-wrapper.c:(.text.ldap_wrapper_wait_connections+0x28): undefined
reference to `pthread_yield'
https://build.safermobile.org/job/gnupg-for-android/12/console
.hc
More information about the Gnupg-devel
mailing list