【发布时间】:2012-11-15 11:28:15
【问题描述】:
Eclipse / Cygwin
NDK 8c
构建共享库
切换到 armeabi-v7a 后,我无法再启动 gdbserver。我在网上搜索了几个小时,但找不到专门处理 armeabi-v7a 调试问题的主题。
由于使用依赖于它的第三方库,我别无选择切换到 armeabi-v7a。没有它,我会收到这些错误:
D:\TEMP\ccnnGAqD.s:10427: Error: selected processor does not support Thumb mode `ldrex r6,[r3]'
D:\TEMP\ccnnGAqD.s:10429: Error: selected processor does not support Thumb mode `strex r4,r5,[r3]'
在使用“armeabi”之前一切正常,使用以下设置:http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-development/
我所做的唯一更改是将其添加到 Application.mk:
APP_ABI := armeabi-v7a
我在共享库 Android.mk 的最底部添加了这个:
$(info TARGET_ARCH = $(TARGET_ARCH))
$(info TARGET_ARCH_ABI = $(TARGET_ARCH_ABI))
$(info TARGET_ABI = $(TARGET_ABI))
输出如下:
TARGET_ARCH = arm
TARGET_ARCH_ABI = armeabi-v7a
TARGET_ABI = android-14-armeabi-v7a
我已经卸载了应用程序
adb uninstall com.example.game
AndroidManifest.xml 确实有 android:debuggable="true" 属性。
在 Eclipse 中完成“全部清除”,并手动删除了 ./libs 和 ./obj 文件夹。然后,ndk-build 输出到正确的文件夹(obj/local/armeabi-v7a 和 libs/armeabi-v7a),而 obj/local/armeabi 和 libs/armeabi 不存在。
但是,当我运行 ndk-gdb 时会发生以下情况:
user@MACHINENAME /cygdrive/e/projects/game
$ ndk-gdb-eclipse --force --verbose
Android NDK installation path: /cygdrive/e/projects/sdks/android-ndk
Using default adb command: /cygdrive/e/projects/sdks/android-sdk/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.31
Using ADB flags:
Using auto-detected project path: .
Found package name: com.example.game
ABIs targetted by application: armeabi
Device API Level: 15
Device CPU ABIs: armeabi-v7a armeabi
Compatible device ABI: armeabi
Using gdb setup init: ./libs/armeabi/gdb.setup
Using toolchain prefix: /cygdrive/e/projects/sdks/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/arm-linux-androideabi-
Using app out directory: ./obj/local/armeabi
Found debuggable flag: true
ERROR: Could not find gdbserver binary under ./libs/armeabi
This usually means you modified your AndroidManifest.xml to set
the android:debuggable flag to 'true' but did not rebuild the
native binaries. Please call 'ndk-build' to do so,
*then* re-install to the device!
请注意“应用程序所针对的 ABI”使用了错误的“armeabi”。下面是 ndk-gdb 的相关部分:
get_build_var ()
{
if [ -z "$GNUMAKE" ] ; then
GNUMAKE=make
fi
$GNUMAKE --no-print-dir -f $ANDROID_NDK_ROOT/build/core/build-local.mk -C $PROJECT DUMP_$1 | tail -1
}
APP_ABIS=`get_build_var APP_ABI`
if [ "$APP_ABIS" != "${APP_ABIS%%all*}" ] ; then
# replace first "all" with all available ABIs
ALL_ABIS=`get_build_var NDK_ALL_ABIS`
APP_ABIS_FRONT="${APP_ABIS%%all*}"
APP_ABIS_BACK="${APP_ABIS#*all}"
APP_ABIS="${APP_ABIS_FRONT}${ALL_ABIS}${APP_ABIS_BACK}"
fi
log "ABIs targetted by application: $APP_ABIS"
我在 Application.mk 中明确将 APP_ABI 设置为 armeabi-v7a,那么这是 NDK 中的错误吗?还是我错过了什么?
【问题讨论】:
-
您是否尝试为您的项目运行
ndk-build DUMP_APP_ABI? -
你能在洁净室场景中重现这个吗?即,使用命令行
ndk-build,然后立即运行ndk-gdb? -
有 2 个问题。首先,我使用 NDK_APPLICATION_MK=config/
/Application.mk 触发 ndk-build(这就是 DUMP_APP_ABI 正常工作的原因)。但是,ndk-gdb 仅在 jni/Application.mk(不存在)中查找,因此使用默认的 $NDK/build/core/default-application.mk 并默认为“armeabi”。其次,似乎没有办法像 ndk-build 那样在 ndk-gdb 中覆盖 NDK_APPLICATION_MK。我能想到的唯一快速解决方案是添加 jni/Application.mk 并指定“APP_ABI := armeabi-v7a” -
所以,好吧,这是缺少的一小部分信息...当我要求您运行
ndk-build DUMP_APP_ABI时,我没想到您会默默地向此命令添加其他参数 ;-) -
您的
config/<buildConfig>/Application.mk是单行吗?Android.mk中是否有一些依赖于<buildConfig>的逻辑?您可能应该将当前的<buildConfig>告知您的ndk-gdb...
标签: android eclipse debugging android-ndk cygwin