android libbinder.so,无法在Android Ndk中构建本地共享库

我想为版本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&)'

任何帮助将不胜感激.

"main" prio=5 tid=1 Native | group="main" sCount=1 dsCount=0 flags=1 obj=0x7231c540 self=0xeab01c10 | sysTid=5702 nice=-10 cgrp=default sched=0/0 handle=0xf7194470 | state=S schedstat=( 287352925 30926491 459 ) utm=20 stm=8 core=2 HZ=100 | stack=0xff0ef000-0xff0f1000 stackSize=8192KB | held mutexes= native: #00 pc 00071654 /apex/com.android.runtime/lib/bionic/libc.so (__ioctl+12) native: #01 pc 0003f76f /apex/com.android.runtime/lib/bionic/libc.so (ioctl+26) native: #02 pc 00039eab /system/lib/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+238) native: #03 pc 0003aae5 /system/lib/libbinder.so (android::IPCThreadState::waitForResponse(android::Parcel*, int*)+32) native: #04 pc 0003a8bb /system/lib/libbinder.so (android::IPCThreadState::transact(int, unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+126) native: #05 pc 000355bf /system/lib/libbinder.so (android::BpBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+98) native: #06 pc 000214f3 /system/lib/libcamera_client.so (android::hardware::BpCameraService::connect(android::sp<android::hardware::ICameraClient> const&, int, android::String16 const&, int, int, android::sp<android::hardware::ICamera>*)+366) native: #07 pc 00038455 /system/lib/libcamera_client.so (android::CameraBase<android::Camera, android::CameraTraits<android::Camera> >::connect(int, android::String16 const&, int, int)+176) native: #08 pc 0002ab71 /system/lib/libcamera_client.so (android::Camera::connect(int, android::String16 const&, int, int)+12) native: #09 pc 000de3cb /system/lib/libandroid_runtime.so (android_hardware_Camera_native_setup(_JNIEnv*, _jobject*, _jobject*, int, int, _jstring*)+118) at android.hardware.Camera.native_setup(Native method)
最新发布
07-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值