[英]Android NDK find dynamic link : unable to debug library
我有一個項目,可以很好地編譯,加載和運行在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
。 從項目根目錄啟動它。 如果您想查看ndk-gdb
正在做什么,請考慮使用--verbose
選項。 您還必須將此行添加到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將自動執行此操作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.