Android NDK查找动态链接:无法调试库

前端之家收集整理的这篇文章主要介绍了Android NDK查找动态链接:无法调试库前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个项目,编译,加载和运行在 Android设备很好.当我打电话给gdb服务器也可以正常工作.然后,当我打电话给gdb客户端运行断点是当消息出现时:
Error while mapping shared library sections:
/system/bin/linker: No such file or directory.

libandroid.so: No such file or directory.
liblog.so: No such file or directory.
libEGL.so: No such file or directory.
libOpenSLES.so: No such file or directory.
libGLESv2.so: No such file or directory.
libGLESv2_POWERVR_SGX540_120.so: No such file or directory.
...
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code
warning: shared library handler Failed to enable breakpoint

这是我当前的Android.mk文件,在这种情况下可能会丢失一些额外的安装:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LS_CPP=$(subst $(1)/,$(wildcard $(1)/*.cpp))
APP_MODULES := callbacks
APP_PLATFORM := android-14
APP_OPTIM:= debug

LOCAL_CFLAGS    := -DRAPIDXML_NO_EXCEPTIONS
LOCAL_CFLAGS    += -g
LOCAL_CFLAGS    += -ggdb
LOCAL_CFLAGS    += -O1

LOCAL_MODULE:=app3D
LOCAL_SRC_FILES := $(call LS_CPP,$(LOCAL_PATH))
LOCAL_LDLIBS    := -landroid -llog -lEGL -lOpenSLES -lGLESv2
LOCAL_STATIC_LIBRARIES := android_native_app_glue png
LOCAL_STATIC_LIBRARIES += /jni

include $(BUILD_SHARED_LIBRARY)

$(call import-module,android/native_app_glue)
$(call import-module,libpng)

任何关于这个奇怪错误的原因是什么的建议以及如何摆脱它?

所有评论提示深受赞赏和欢迎.

解决方法

使用ndk-gdb而不是标准gdb.从您的项目根目录启动它.考虑使用–verbose选项,如果你想看看ndk-gdb正在做什么.
您还必须将此行添加到您的AndroidManifest.xml中:
android:debuggable="true"

例如,我的看起来像:

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme"
    android:debuggable="true" >

你的application.mk应该定义

APP_OPTIM := debug

有了这个,你不必在你的编译器标志中添加-g,ndk-build会自动执行.

原文链接:https://www.f2er.com/android/313409.html

猜你在找的Android相关文章