Unable to use ndk-gdb - android

when i run ndk-gdb in cgywin i get error saying "make: command not found" and "the device does not support the applications targetted CPU abi's"
$ ndk-gdb --verbose --nowait
Android NDK installation path: /cygdrive/c/Android/ndk
Using default adb command: /cygdrive/c/Android/sdk/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.31
Using ADB flags:
Using JDB command:
Using auto-detected project path: .
Found package name: com.example.mygame
/cygdrive/c/Android/ndk/ndk-gdb: line 120: make: command not found
ABIs targetted by application:
Device API Level: 10
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.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := \
c:/cocos2d-x/external/Box2D
LOCAL_MODULE := mygame
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static box2d_static
LOCAL_SRC_FILES := \
b2DebugDraw.cpp \
Box2DRenderer.cpp \
Main.cpp \
InGameScreen.cpp
include $(BUILD_SHARED_LIBRARY)
$(call import-add-path, c:/cocos2d-x)
$(call import-add-path, c:/cocos2d-x/cocos2dx/platform/third_party/android/prebuilt)
$(call import-module, cocos2dx)
$(call import-module, external/Box2D)
Application.mk
APP_ABI := armeabi-v7a
APP_STL := gnustl_static
APP_OPTIM:= debug
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11 -Wno-literal-suffix -g
NDK_TOOLCHAIN_VERSION := 4.8
im using a kindle fire with 2.3.3 installed

The obvious first answer is that make.exe (GNU Make) needs to be in your path. Is it installed in Cygwin? Check the Cygwin installer.

Related

android NDK debugging in eclipse

I am using ndk 12b or ndk 10d
I want to debug .so file in eclipse.
But I have a problem.
I tried to debug .so using android native application in "DEBUG AS".
But I received this result from console.
"gdbserver output: run-as: exec failed for lib/gdbserver Error:No such file or directory"
I set my android.mk and application.mk like this.
LOCAL_MODULE := test
LOCAL_SRC_FILES := test.cpp
LOCAL_LDLIBS := -llog -landroid
APP_STL:=stlport_static
APP_OPTIM:=debug
APP_ABI := all
APP_CFLAGS += -Wno-error=format-security
LOCAL_LDFLAGS += --no-warn-shared-textrel
I also set NDK_DEBUG=1 as build option.
what should I do solve it?

Android ndk: utils/Log.h: No such file or directory compilation terminated

am compiling android ndk project but couldn't get it successfully done. It says no such file or directory found for Log header file at main.cpp file. I'm new to android ndk please help.
here is my android.mk file.
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := user
LOCAL_ARM_MODE := arm
# This is the target being built.
LOCAL_MODULE := libemu
# All of the source files that we will compile.
LOCAL_SRC_FILES := \
ticks.c \
main.cpp \
emulator.cpp
# All of the shared libraries we link against.
LOCAL_SHARED_LIBRARIES := \
libdl \
libnativehelper \
libutils
# Static libraries.
LOCAL_STATIC_LIBRARIES :=
# Also need the JNI headers.
LOCAL_C_INCLUDES += \
$(JNI_H_INCLUDE)
# Special compiler flags.
LOCAL_CFLAGS += -O3 -fvisibility=hidden
# Don't prelink this library. For more efficient code, you may want
# to add this library to the prelink map and set this to true. However,
# it's difficult to do this for applications that are not supplied as
# part of a system image.
LOCAL_PRELINK_MODULE := false
include $(BUILD_SHARED_LIBRARY)
here is the log
"Compile++ arm : emu <= main.cpp
D:/EclipseWorkspace/NineTendo//jni/main.cpp:2:23: fatal error: utils/Log.h: No such file or directory
compilation terminated.
make: *** [D:/EclipseWorkspace/NineTendo//obj/local/armeabi/objs/emu/main.o] Error 1
any help would be much appreciated.
Thanks
This error started to show up in NDK version R9x. You need to declare the API version number in your Application.mk file. Here's how it looks to define a minimum API level of 8:
APP_PLATFORM := android-8
The Application.mk file should live alongside your Android.mk file in the JNI directory. Here's a sample from one of my projects:
APP_ABI := armeabi armeabi-v7a x86
APP_CFLAGS += -O2
LOCAL_ARM_MODE := arm
APP_PLATFORM := android-8

building android project produces make error 2

I have recently purchased a book to assist in my development of C++ for Android which contained some code samples. However, when I come to build some of the sample code, I receive the following error:
C:\ndk\android-ndk-r9\ndk-build.cmd all
"Compile++ : Chapter10 <= Chapter10.cpp
process_begin: CreateProcess(NULL, C:/ndk/android-ndk-r9/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-g++ -MMD -MP -MF ./obj/local/armeabi/objs/Chapter10/Chapter10.o.d -fno-exceptions -fno-rtti -Ijni -IC:/ndk/android-ndk-r9/sources/android/native_app_glue -IC:/ndk/android-ndk-r9/sources/cxx-stl/stlport/stlport -IC:/ndk/android-ndk-r9/sources/cxx-stl//gabi++/include -Ijni -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security -frtti -c jni/Chapter10.cpp -o ./obj/local/armeabi/objs/Chapter10/Chapter10.o, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [obj/local/armeabi/objs/Chapter10/Chapter10.o] Error 2
The make file is as shown below:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_MODULE := Chapter10
LOCAL_SRC_FILES := Chapter10.cpp \
(Other cpp Files . . . )
LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv2 -lOpenSLES
LOCAL_STATIC_LIBRARIES := android_native_app_glue
include $(BUILD_SHARED_LIBRARY)
$(call import-module,android/native_app_glue)
The Application.mk file is as below:
APP_PLATFORM := android-9
APP_STL := stlport_static
NDK_TOOLCHAIN_VERSION := 4.7
This was compiled using ADT v22.2.1 and Android NDK r9 on a Windows 7 Machine.
The NDK was installed to 'C:\ndk\android-ndk-r9\'.
Android NDK r9 contains the following toolchains:
arm-linux-androideabi-4.6
arm-linux-androideabi-4.8
arm-linux-androideabi-clang3.2
arm-linux-androideabi-clang3.3
llvm-3.2
llvm-3.3
mipsel-linux-android-4.6
mipsel-linux-android-4.8
mipsel-linux-android-clang3.2
mipsel-linux-android-clang3.3
x86-4.6
x86-4.8
x86-clang3.2
x86-clang3.3
There is no toolchain for gcc 4.7. However, your Application.mk contains the line:
NDK_TOOLCHAIN_VERSION := 4.7
Which tells the NDK to look for the 4.7 toolchain. And it fails.
So, the solution to your problem is changing the NDK_TOOLCHAIN_VERSION variable to 4.6, 4.8, clang3.2, clang3.3, or just clang (which will use the most recent version of Clang available in the NDK).
Check your project path if is contain spaces and non-english characters.
I moved my project into somewhere without spaces, re-build it and works.

Compiling code with OpenCV dependency Android NDK

I am trying to compile C++ code dependent on OpenCV on the Android NDK.
I have looked into several answers (mainly this) but apparently the NDK still cannot see the directory I'm giving it in the LOCAL_C_INCLUDES variable.
This is my Application.mk:
APP_ABI :=armeabi armeabi-v7a
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_PLATFORM :=android-14
NDK_TOOLCHAIN_VERSION=4.7
This is my Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE:= swt
LOAL_CPP_EXTENSIO:=.cpp
LOCAL_C_INCLUDES := /usr/include:/usr/include/i386-linux-gnu:/usr/include/i386-linux-gnu/bits:/usr/include/i386-linux-gnu/sys:/usr/include/i386-linux-gnu/gnu:/usr/include/i386-linux-gnu/asm:/home/hamdy/Downloads/android-ndk-r8e/sources:/usr/local/include/opencv:/usr/local/include/opencv2/core
LOCAL_CFLAFS := -x c++ -lopencv_core -lopencv_highgui -lopencv_imgproc
LOCAL_SRC_FILES := TextDetection.cpp FeaturesMain.cpp
include $(BUILD_SHARED_LIBRARY)
This is the error I'm getting [cv.h is the file included in my .cpp so it can apparently see that in the /usr/local/include/opencv directory but cannot get past the includes in it]:
/usr/local/include/opencv/cv.h:63:33: fatal error: opencv2/core/core_c.h: No such file or directory
compilation terminated.
I don't know why but when I've compiled the same under Linux everything compiled fine. Under Windows there were errors. So I've switched to Linux

ndk-gdb error: device does not support the application's targetted CPU ABIs

Trying to run ndk-gdb and getting this error:
Android NDK installation path: /Library/AndroidSDK/ndk/
Using specific adb command: /Library/AndroidSDK/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.dev.project
jni/Android.mk:18: * Android NDK: Aborting. . Stop.
ABIs targetted by application: Android NDK:
Device API Level: 17
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:
The 18th line in the jni/Android.mk is an import module call.
What does that mean and how to remedy it?
App is debuggable as per ndk documentation. I'm using Mac.
I can build and run the App, so build script should be fine.
Android.mk
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libgl2jni
LOCAL_CFLAGS := -Werror -Wall -g
LOCAL_CPPFLAGS := -std=c++11
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../src $(LOCAL_PATH)/../../include $(LOCAL_PATH)/../../../boost
NDK_MODULE_PATH := $(LOCAL_PATH)/../../lib/ndk
LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(LOCAL_PATH)/../../src/*/*.cpp))
LOCAL_LDLIBS := -llog -lGLESv2
LOCAL_STATIC_LIBRARIES := freetype
include $(BUILD_SHARED_LIBRARY)
$(call import-module,otherlib) #commenting this line launches the ndk-gdb, but ndk-build fails
Application.mk
APP_STL := gnustl_static
#remove for release?
APP_ABI := armeabi armeabi-v7a
APP_OPTIM := debug
I had the same problem. I'm quite sure it is a bug in the core/build-local.mk script. At least the error message is not meaningful.
I fixed doing this:
export NDK_MODULE_PATH=path_to_look_for_modules
Where path_to_look_for_modules should be the parent directory of your module declared in the Android.mk. That is, if you have /myproject/mylibs/otherlib export the path /myproject/mylibs
If you have several paths, as usual:
export NDK_MODULE_PATH=path1:path2:path3
If you are building an Android app and have some ndk code you may be able to solve this problem by adding/modifying your Application.mk (usually in the jni directory) with the following line:
# The ARMv7 is significanly faster due to the use of the hardware FPU
APP_ABI := armeabi armeabi-v7a x86 mips
#APP_ABI := armeabi
APP_PLATFORM := android-10
I mean the APP_ABI line. This is specifying the target processors to compile the ndk code for. I am assuming from the error message that you are testing on a device that has a different cpu type than the ones you built the app for.
Useful information about third party libraries
Possible issue with makefile or environment
export NDK_PROJECT_PATH=[Path]
where [Path] is the parent of "jni" directory, which in turn contains your NDK code.
You "might" face this issue if your NDK code (jni directory) is located separately from your Android java code.
A common solution to this problem is to include this line in your Application.mk.
APP_ABI := armeabi-v7a
Replace armeabi-v7a by the appropriate API as per the Device supports line. This will ensure that your application is built for the correct platform, and that ndk-gdb can find it.

Categories

Resources