我想为版本4.0.3构建库.so,但我无法这样做.
我的感觉是这些问题是由于我的.mk文件不是
与库链接.
Binder.cpp \nBpBinder.cpp \nCursorWindow.cpp \nIInterface.cpp \nIMemory.cpp \nIPCThreadState.cpp \nIPermissionController.cpp \nIServiceManager.cpp \nMemoryDealer.cpp \nMemoryBase.cpp \nMemoryHeapBase.cpp \nMemoryHeapPmem.cpp \nParcel.cpp \nPermissionCache.cpp \nProcessState.cpp \nStatic.cpp
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_LDLIBS += -lpthread
LOCAL_MODULE := libbinder1
LOCAL_SHARED_LIBRARIES := liblog libcutils libutils
LOCAL_SRC_FILES := $(sources)
include $(BUILD_SHARED_LIBRARY)
#include $(CLEAR_VARS)
#LOCAL_CFLAGS += -DHAVE_PTHREADS
#LOCAL_LDLIBS += -lpthread
#LOCAL_MODULE := libbinder
#LOCAL_SRC_FILES := $(sources)
#include $(BUILD_STATIC_LIBRARY)
此文件为我构建了静态文件,即.a文件,但在构建共享库时显示以下错误.
[armeabi] Compile++ thumb: binder1 <= IPCThreadState.cpp
jni/IPCThreadState.cpp:292:8: error: 'pthread_mutex_t' does not name a type
jni/IPCThreadState.cpp:294:8: error: 'pthread_key_t' does not name a type
jni/IPCThreadState.cpp: In static member function 'static android::IPCThreadState* android::IPCThreadState::self()':
我使用修复了上述错误
????????LOCAL_CFLAGS = -DHAVE_PTHREADS
但是现在,在生成库时,我收到了大量错误.
D:/android-ndk-r9c-windows-x86/android-ndk-r9c/toolchains/arm-linux-androideabi- 4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux- androideabi/bin/ld.exe: error: cannot find -lpthread
D:/android-ndk-r9c-windows-x86/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/binder1/Binder.o: in function android::Vector<:string16>::do_copy(void*, void const*, unsigned int) const:jni/utils/TypeHelpers.h:142: error: undefined reference to 'android::String16::String16(android::String16 const&)'
任何帮助将不胜感激.