ndk-gdb can't use?

Hi, all.

My platform is Ubuntu 12.04 64bit + ndk-r8 (I can’t find a website to download ndk-r7 anyway)

I download the latest cocos2dx project and make up all settings necessary to build the project.

Now, I can build the test project and also make a new project and run it on my machine successfully :slight_smile:

It performs great, but I can’t use ndk-gdb to debug my program.

When I run ndk-gdb in my project directory, I get a message :
—————————————————————————
ERROR: The device does not support the application’s targetted CPU ABIs!
Device supports: armeabi-v7a armeabi
Package supports: Android NDK: jni/Android.mk: Cannot find module with tag ‘CocosDenshion/android’ in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
—————————————————————————

I don’t know how NDK_MODULE_PATH work, so I just export it to project root directory like what build_native.sh do.
But I still get the same error…

By the way, following some tutorials from google, I can run ndk-gdb successfully in my another simple ndk project….
so I just can’t figure out what happens to my cocos2dx project…

Could anyone help me?

Thanks ^^

You can download NDK r7c from here.

But I think that your problem is not because NDK r8. Unfortunately I don’t know the solution.

Regards.


Please,

Have you tried creating a system environment variable with that name pointing to your NDK?

set VARIABLE_NAME=

Hey, thanks all replies~

I still get the same error message :frowning:

By the way, I have set the ndk to my $PATH variable, and I can run it in my another jni project.

If I can find someway to make it work, I will let you all know it ^^

it happened to me.I do not know why and how.

Still no clue?

run ndk-gdb with this NDK_MODULE_PATH=${COCOS2DX_HOME}:${COCOS2DX_HOME}/cocos2dx/platform/third_party/android/prebuilt where COCOS2DX_HOME - your path to cocos directory.

Hi there. Got a similar error, when attempting to execute ndk-gdb, but with a different output.

xxx:proj.android xxx$ ndk-gdb --verbose Android NDK installation path: /Users/xxx/Developer/android-ndk-r8c/ Using default adb command: /Users/xxx/Developer/android-sdks/platform-tools//adb ADB version found: Android Debug Bridge version 1.0.31 Using ADB flags: Using auto-detected project path: . Found package name: xxxx jni/Android.mk:19: *** Android NDK: Aborting. . Stop. ABIs targetted by application: Android NDK: Device API Level: 16 Device CPU ABIs: armeabi-v7a armeabi ERROR: The device does not support the application's targetted CPU ABIs! Device supports: armeabi-v7a armeabi Package supports: Android NDK:

No complaints about NDK_MODULE_PATH, but it’s clearly related to import-module calls (line 19 at Android.mk), ndk-gdb works without complaints when I comment these lines. If it were an import issue, I expected to see at least an output telling so.

I’m following this tutorial (http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-debugging/), with success with a sample Android project using JNI, but with a Cocos2Dx I get stuck at step 3, the one related to ndk-gdb.

I’m using Cocos2D-x 2.1.0, Mac OS X 10.7.5, and NDK r8c as you can see.

Thanks :slight_smile: .

Víctor González wrote:


In android template (cocosroot/template/android) there is a file “ndkgdb.sh”.

With the right variables defined, this file will launch ndk-gdb successfully. The problem is ndk-gdb needs the module path in order to import cocos.

Here is the one I am using, only modified to add paths:

APPNAME="Test"
APP_ANDROID_NAME="com.domain.game"
SDK_ROOT=/c/dev/android-sdk-windows
if [ -z "${SDK_ROOT+aaa}" ]; then
# ... if SDK_ROOT is not set, use "$HOME/bin/android-sdk"
    SDK_ROOT="$HOME/bin/android-sdk"
fi

# paths
NDK_ROOT=/c/dev/android-ndk-r8d
if [ -z "${NDK_ROOT+aaa}" ]; then
# ... if NDK_ROOT is not set, use "$HOME/bin/android-ndk"
    NDK_ROOT="$HOME/bin/android-ndk"
fi

if [ -z "${COCOS2DX_ROOT+aaa}" ]; then
# ... if COCOS2DX_ROOT is not set
# ... find current working directory
    DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
COCOS2DX_ROOT=/c/dev/cocos
    APP_ROOT="$DIR/.."
    APP_ANDROID_ROOT="$DIR"
else
    APP_ROOT="$COCOS2DX_ROOT/samples/$APPNAME"
    APP_ANDROID_ROOT="$COCOS2DX_ROOT/samples/$APPNAME/proj.android"
fi

echo "NDK_ROOT = $NDK_ROOT"
echo "SDK_ROOT = $SDK_ROOT"
echo "COCOS2DX_ROOT = $COCOS2DX_ROOT"
echo "APP_ROOT = $APP_ROOT"
echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
echo "APP_ANDROID_NAME = $APP_ANDROID_NAME"

echo
echo "Killing and restarting ${APP_ANDROID_NAME}"
echo

set -x

"${SDK_ROOT}"/platform-tools/adb shell am force-stop "${APP_ANDROID_NAME}"

NDK_MODULE_PATH="${COCOS2DX_ROOT}":"${COCOS2DX_ROOT}"/cocos2dx/platform/third_party/android/prebuilt \
    "${NDK_ROOT}"/ndk-gdb \
    --adb="${SDK_ROOT}"/platform-tools/adb \
    --verbose \
    --start \
    --force

I found $DIR is not good work in mac, so is replace it with (.)

exp:

APP_ROOT=“./…”
APP_ANDROID_ROOT=“.”

and ok for run

if Cannot find module with tag ‘CocosDenshion/android’ : is the path error, you need check the paths when you run ndkgdb.sh the path printed in terminate .

Adipose Dan wrote:

Víctor González wrote:
>

>
In android template (cocosroot/template/android) there is a file “ndkgdb.sh”.
>
With the right variables defined, this file will launch ndk-gdb successfully. The problem is ndk-gdb needs the module path in order to import cocos.
>
Here is the one I am using, only modified to add paths:
>
[…]

I got a similar problem error, and the “ndkgdb.sh” is not work neither.
I have change the “ndkgdb.sh” to fit my demo like this:

APPNAME="KillBulls"
APP_ANDROID_NAME="com.bailin.killbulls"

if [ -z "${SDK_ROOT+aaa}" ]; then
# ... if SDK_ROOT is not set, use "$HOME/bin/android-sdk"
    SDK_ROOT="$HOME/bin/android-sdk"
fi

if [ -z "${NDK_ROOT+aaa}" ]; then
# ... if NDK_ROOT is not set, use "$HOME/bin/android-ndk"
    NDK_ROOT="$HOME/bin/android-ndk"
fi

if [ -z "${COCOS2DX_ROOT+aaa}" ]; then
# ... if COCOS2DX_ROOT is not set
# ... find current working directory
    DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
    COCOS2DX_ROOT="$DIR/../../../.."
    APP_ROOT="$DIR/.."
    APP_ANDROID_ROOT="$DIR"
else
    APP_ROOT="$COCOS2DX_ROOT/samples/$APPNAME"
    APP_ANDROID_ROOT="$COCOS2DX_ROOT/samples/$APPNAME/proj.android"
fi

echo "NDK_ROOT = $NDK_ROOT"
echo "SDK_ROOT = $SDK_ROOT"
echo "COCOS2DX_ROOT = $COCOS2DX_ROOT"
echo "APP_ROOT = $APP_ROOT"
echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
echo "APP_ANDROID_NAME = $APP_ANDROID_NAME"

echo
echo "Killing and restarting ${APP_ANDROID_NAME}"
echo

set -x

"${SDK_ROOT}"/platform-tools/adb shell am force-stop "${APP_ANDROID_NAME}"

NDK_MODULE_PATH="${COCOS2DX_ROOT}":"${COCOS2DX_ROOT}"/cocos2dx/platform/third_party/android/prebuilt \
    "${NDK_ROOT}"/ndk-gdb \
    --adb="${SDK_ROOT}"/platform-tools/adb \
    --verbose \
    --start \
    --force

My NDK version is android-ndk-r8e
ANDORID SDK is download with ADT, date is 20130219.
OS: WIN7
cygwin version: 1.7.18-14
cocos2dx version: cocos2d-2.1rc0-x-2.1.2

My error message is:

$ ./ndkgdb.sh
NDK_ROOT = /cygdrive/d/work/adt-bundle-windows-x86_64-20130219/android-ndk-r8e
SDK_ROOT = /cygdrive/d/work/adt-bundle-windows-x86_64-20130219/sdk
COCOS2DX_ROOT = /cygdrive/d/work/SVN/cocos2dx/2.1.2/projects/KillBulls/proj.android/../../../..
APP_ROOT = /cygdrive/d/work/SVN/cocos2dx/2.1.2/projects/KillBulls/proj.android/..
APP_ANDROID_ROOT = /cygdrive/d/work/SVN/cocos2dx/2.1.2/projects/KillBulls/proj.android
APP_ANDROID_NAME = com.bailin.killbulls

Killing and restarting com.bailin.killbulls

++ /cygdrive/d/work/adt-bundle-windows-x86_64-20130219/sdk/platform-tools/adb shell am force-stop com.bailin.killbulls
++ NDK_MODULE_PATH=/cygdrive/d/work/SVN/cocos2dx/2.1.2/projects/KillBulls/proj.android/../../../..:/cygdrive/d/work/SVN/cocos2dx/2.1.2/projects/KillBulls/proj.android/../../../../cocos2dx/platform/third_party/android/prebuilt
++ /cygdrive/d/work/adt-bundle-windows-x86_64-20130219/android-ndk-r8e/ndk-gdb --adb=/cygdrive/d/work/adt-bundle-windows-x86_64-20130219/sdk/platform-tools/adb --verbose --start --force
Android NDK installation path: /cygdrive/d/work/adt-bundle-windows-x86_64-20130219/android-ndk-r8e
Using specific adb command: /cygdrive/d/work/adt-bundle-windows-x86_64-20130219/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.bailin.killbulls
jni/Android.mk:23: *** Android NDK: Aborting.    . Stop .
ABIs targetted by application: Android NDK:
Device API Level: 16
Device CPU ABIs: armeabi-v7a armeabi
ERROR: The device does not support the application's targetted CPU ABIs!
       Device supports:  armeabi-v7a armeabi
       Package supports: Android NDK:

Then I look up the Android.mk in jni floder, line 23 is the *$(call import-module,cocos2dx)*

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := cocos2dcpp_shared

LOCAL_MODULE_FILENAME := libcocos2dcpp

LOCAL_SRC_FILES := hellocpp/main.cpp \
                   ../../Classes/AppDelegate.cpp \
                   ../../Classes/HelloWorldScene.cpp

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes

LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static

include $(BUILD_SHARED_LIBRARY)

$(call import-module,cocos2dx)
$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl)
$(call import-module,CocosDenshion/android)
$(call import-module,extensions)
$(call import-module,external/Box2D)
$(call import-module,external/chipmunk)

The Application.mk file which in jni floder was add the configuration:

APP_ABI := armeabi-v7a
APP_OPTIM := debug

It still doesn’t work :frowning: .
I feel I should concern about the Android.mk:23, but I don’t know how :frowning: .
Is there any one could help me solve this problem?

I found that my APP_ABIS value is Android NDK:! Neither armeabi nor armebi-v7a, just Android NDK:!

In the ndk-gdb file, the APP_ABIS was set after function get_build_var:

APP_ABIS=`get_build_var APP_ABI`

get_build_var function is:

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
}

I confused …

I specify the APP_ABIS to armeabi or armeabi-v7a in $NDK_ROOT/ndk-gdb file like this:

APP_ABIS=`get_build_var APP_ABI`
echo "[APP_ABIS:1]$APP_ABIS" #echo the APP_ABIS value
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
APP_ABIS="armeabi-v7a"
echo "[APP_ABIS:2]$APP_ABIS" #echo the APP_ABIS value
log "ABIs targetted by application: $APP_ABIS"

Then I launch the ndk-gdb $NDK_ROOT/ndk-gdb —verbose and get this infomation in cygwin:

$ $NDK_ROOT/ndk-gdb --verbose --start --force
Android NDK installation path: /cygdrive/d/work/adt-bundle-windows-x86_64-20130219/android-ndk-r8e
Using default adb command: /cygdrive/d/work/adt-bundle-windows-x86_64-20130219/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.bailin.killbulls
jni/Android.mk:23: *** Android NDK: Aborting.    。 停止。
[APP_ABIS:1]Android NDK:
[APP_ABIS:2]armeabi-v7a
ABIs targetted by application: armeabi-v7a
Device API Level: 16
Device CPU ABIs: armeabi-v7a,armeabi,
Compatible device ABI: armeabi-v7a
jni/Android.mk:23: *** Android NDK: Aborting.    。 停止。
Using gdb setup init: Android NDK:
jni/Android.mk:23: *** Android NDK: Aborting.    。 停止。
Using toolchain prefix: Android NDK:
jni/Android.mk:23: *** Android NDK: Aborting.    。 停止。
Using app out directory: Android NDK:
Found debuggable flag: true
Found device gdbserver: /data/data/com.bailin.killbulls/lib/gdbserver
Found data directory: '/data/data/com.bailin.killbulls'
Found first launchable activity: .KillBulls
Launching activity: com.bailin.killbulls/.KillBulls
## COMMAND: adb_cmd shell am start -n com.bailin.killbulls/.KillBulls
Starting: Intent { cmp=com.bailin.killbulls/.KillBulls }
## COMMAND: adb_cmd shell sleep 2
Found running PID: 9809
Launched gdbserver succesfully.
Setup network redirection
## COMMAND: adb_cmd forward tcp:5039 localfilesystem:/data/data/com.bailin.killbulls/debug-socket
## COMMAND: adb_cmd shell run-as com.bailin.killbulls lib/gdbserver +debug-socket --attach 9809
Attached; pid = 9809
Listening on Unix socket debug-socket
## COMMAND: adb_cmd pull /system/bin/app_process Android
2320 KB/s (9504 bytes in 0.004s)
Pulled app_process from device/emulator.
## COMMAND: adb_cmd pull /system/bin/linker Android
3546 KB/s (79908 bytes in 0.022s)
Pulled linker from device/emulator.
## COMMAND: adb_cmd pull /system/lib/libc.so Android
6216 KB/s (286464 bytes in 0.045s)
Pulled libc.so from device/emulator.
cp: 目标"/gdb.setup" 不是目录
/cygdrive/d/work/adt-bundle-windows-x86_64-20130219/android-ndk-r8e/ndk-gdb: line 705: Android NDK:         /gdb.setup: No such file or directory
/cygdrive/d/work/adt-bundle-windows-x86_64-20130219/android-ndk-r8e/ndk-gdb: line 706: Android NDK:         /gdb.setup: No such file or directory
/cygdrive/d/work/adt-bundle-windows-x86_64-20130219/android-ndk-r8e/ndk-gdb: line 710: Android: command not found

As same time, my Samsung GALAXY III just answer the ndk-gdb, it ran the demo APP, but I can’t terminate the demo program, it was just running all the time, and the shutdown button on the screen was not answer my touch.
Demo is alive cause I can see the FPS parameter changed, it just can’t be shutdown. Maybe it was blocked somewhere :frowning:

I don’t know how get_build_var return the value Android NDK:, but I know reason it just the ABIs not match.

I put 2 days time in this step, it really makes me feel grief :frowning: If some one could help me, I will appreciate and thx a lot!

Jason Tou wrote:

I specify the APP_ABIS to armeabi or armeabi-v7a in $NDK_ROOT/ndk-gdb file like this:
>
[…]
>
Then I launch the ndk-gdb $NDK_ROOT/ndk-gdb —verbose and get this infomation in cygwin:
[…]
>
As same time, my Samsung GALAXY III just answer the ndk-gdb, it ran the demo APP, but I can’t terminate the demo program, it was just running all the time, and the shutdown button on the screen was not answer my touch.
Demo is alive cause I can see the FPS parameter changed, it just can’t be shutdown. Maybe it was blocked somewhere :frowning:
>
I don’t know how get_build_var return the value Android NDK:, but I know reason it just the ABIs not match.
>
I put 2 days time in this step, it really makes me feel grief :frowning: If some one could help me, I will appreciate and thx a lot!

i also meet the some problem. since the YOUR_PROJECET/ndkgdb.sh is running ok. why does the ndk-gdb error.

jni/Android.mk:19: *** Android NDK: Aborting. . Stop.
ERROR: The device does not support the application’s targetted CPU ABIs!
Device supports: armeabi-v7a armeabi
Package supports: Android NDK:
i think may be there is some problem with the Android.mk line 19 in my file is

$(call import-module,CocosDenshion/android) \

as Jason Tou say

force write those words APP_ABIS=“armeabi-v7a” in ndk-gdb

just works

maybe the “Package supports: Android NDK:” is a f**king bug

Those facing issues might want to check the output (from ndkgdb.sh) values of:
* Initially: NDK_ROOT, SDK_ROOT, COCOS2DX_ROOT, APP_ROOT, APP_ANDROID_ROOT, APP_ANDROID_NAME
* Futher: NDK_MODULE_PATH
If you’re using Windows, make sure the paths are in “nix/cygwin convention" - /cygdrive/c/Some/Path instead of C:\Some\Path
While COCOS2DX_ROOT was a win32 path , even I saw the error about not supporting the ABI. I think that’s a false positive or inaccurate error message.
Error initially seen:
<pre>
$ ./ndkgdb.sh
NDK_ROOT = /cygdrive/d/android-ndk-r8e
SDK_ROOT = /cygdrive/c/android-sdk-windows
COCOS2DX_ROOT = D:2d-x

++ NDK_MODULE_PATH=’D:2d-x:…

jni/Android.mk:34:
** Android NDK: Aborting. . Stop.
ABIs targetted by application: Android NDK:
Device API Level: 10
Device CPU ABIs: armeabi
ERROR: The device does not support the application’s targetted CPU ABIs!
Device supports: armeabi
Package supports: Android NDK:

</pre>
(In ndkgdb.sh) I set correct paths for my system right after APP_ANDROID_NAME in the cygwin convention (using forward slashes”/“) and made sure APP_ROOT and APP_ANDROID_ROOT were correctly set in the else block that checks whether COCOS2DX_ROOT exists or not. (On my system COCOS2DX_ROOT is set to a win32 path - with back slashes” for Visual Studio projects to be relocatable - [[Relocate_VCProj-SLN]]).

I added these changes to my ndkgdb.sh (paths specific to my system)

SDK_ROOT=/cygdrive/c/android-sdk-windows
NDK_ROOT=/cygdrive/d/android-ndk-r8e
COCOS2DX_ROOT=/cygdrive/d/Projects/ThirdParty/cocos2d-x

and made sure (this is a change specific to my system since I’ve kept the project in a location other than COCOS2DX_ROOT).

    APP_ROOT="$DIR/.."
    APP_ANDROID_ROOT="$DIR"

Running ndkgdb.sh after this worked fine.

OS: Win8, cocos2d-x 2.1.2 (git), NDK: r8e, Connected device’s API Level: 10

thx PAT RZ2

I didn’t found ndkgdb.sh file. Nor the Windows did.
This cocos2d-x is getting me mad! Why things don’t just works?

Errors never stop coming!