ndk-build中的pthread错误

时间:2013-03-06 07:58:10

标签: android android-ndk

您好

我曾尝试使用ndk-build编译以下Android.mk文件。

我收到以下错误。我该如何解决这个问题?

请帮帮我。

make文件是

# ================================================== ========
# NOTE:
# when executing binary, set LD_LIBRARY_PATH in device
# ================================================== ========

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

BASEDIR := ../../..
DISTDIR := ../../../..

LOCAL_MODULE := EvaluateFingerQuality

LOCAL_ARM_MODE := arm


# Includes
LOCAL_C_INCLUDES += \
$(BASEDIR)/Common/C \
$(DISTDIR)/Include

# Source files
LOCAL_SRC_FILES := \
$(BASEDIR)/Common/C/Utils.c \
EvaluateFingerQuality.c


LOCAL_LDLIBS += \
-Wl,-z,muldefs -Wl,-rpath=$(DISTDIR)/Lib/Android_$(TARGET_ARCH_ABI) \
-L $(DISTDIR)/Lib/Android_$(TARGET_ARCH_ABI) \
-lNLicensing -lNBiometricTools -lNBiometrics -lNMedia -lNCore -lc

include $(BUILD_EXECUTABLE)

错误是

$ ndk-build
Compile arm : EvaluateFingerQuality <= Utils.c
Compile arm : EvaluateFingerQuality <= EvaluateFingerQuality.c
Executable : EvaluateFingerQuality
../../../../Lib/Android_armeabi/libNCore.so: undefined reference to `pthread_rwlock_trywrlock'
../../../../Lib/Android_armeabi/libNCore.so: undefined reference to `pthread_rwlock_rdlock'
../../../../Lib/Android_armeabi/libNCore.so: undefined reference to `pthread_rwlock_tryrdlock'
../../../../Lib/Android_armeabi/libNCore.so: undefined reference to `pthread_rwlock_wrlock'
../../../../Lib/Android_armeabi/libNCore.so: undefined reference to `dladdr'
../../../../Lib/Android_armeabi/libNCore.so: undefined reference to `pthread_rwlock_destroy'
../../../../Lib/Android_armeabi/libNCore.so: undefined reference to `pthread_rwlock_init'
../../../../Lib/Android_armeabi/libNCore.so: undefined reference to `pthread_rwlock_unlock'
collect2: ld returned 1 exit status
/cygdrive/d/android-ndk-r8-windows/android-ndk-r8/build/core/build-binary.mk:381: recipe for target `/cygdrive/d/MegaMatcher_Embedded_1_2_SDK_Trial_for_Android/Tutorials/BiometricTools/C/obj/local/armeabi/EvaluateFingerQuality' failed
make: *** [/cygdrive/d/MegaMatcher_Embedded_1_2_SDK_Trial_for_Android/Tutorials/BiometricTools/C/obj/local/armeabi/EvaluateFingerQuality] Error 1

1 个答案:

答案 0 :(得分:4)

Android支持从API 9版本开始的pthreads。由于我使用旧版本的NDK,我得到了上述错误。避免像这样的构建“$ ndk-build APP_PLATFORM = android-9”