ndk-gdb can't find source line numbers - android

I'm using the ndk-gdb to debug some native code on the Android platform. However, the debugger seems to be unable to find source line numbers and source files. I get warnings and errors like this:
warning: shared library handler failed to enable breakpoint
0xaff0c184 in ?? ()
and
Program received signal SIGSEGV, Segmentation fault.
0x80e030a8 in ?? ()
That's not very useful at all... It seems to me that the problem must be in the file and line-number look-up, but as I am quite new to native programming for Android, I'm kinda stuck here. So can anyone tell me how to fix this problem? Any help would be very much appreciated!
Edit 1:
I'm using the NDK r7b on Windows and call the ndk-build script with the following options:
$NDK/ndk-build NDK_DEBUG=1 APP_OPTIM=debug V=1
The APP_OPTIM=debug setting is a modification to the ndk-build script that should disable the stripping of debug symbols as per these instructions.
Edit 2:
I have not solved this problem, but worked around it by switching to using the NDK on Ubuntu linux. It kinda feels like surrendering to the NDK but time and again the linux-roots of the Android platform made developing native code for it on Windows feel unnatural and clumsy.
Kind regards,
Jonas

Related

How to fix CMAKE Android-Toolchain RPATH Problem

Im still on my big project with the topic of porting a big program written in c/c++ to Android.
It worked out fine so far and I could build it succesfully. But there is a problem when executing the files. First of all, there a problem with the libraries. I understand that RPATH is not provided with android.
So doing the following helped a little: LD_LIBRARIES_PATH=./lib programmBinary -v
This command shows the version info.
However, if I want to execute the program with this command it is stuck. Every binary I want to execute with this command is stuck and hangs up. For example there is a binary file which creates an .img during the build process. The binary depends on several other files in order to build the .img file. All necessary file are on the device. When executing the command to create the image its immediately stuck.
Could that be a problem with this command?
I also tried changing my CMakeLists.txt and set the it to set (CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
Nothing changed. -v works and the rest not.
Any idea?
Maybe the problem lays somewhere else? In addition, some infos:
The program builds fine on linux. The .img File also creaties fine. Except when im using the LD_LIBRARIES_PATH=... command. Then I get an error message on Linux too. It says:
Error 3.1: Failure during initialization: File "" is unreadable.
Logic error: Error building kernel image. Image not saved.
fish: Job 1, 'LD_LIBRARY_PATH=./lib executable filename.img' terminated by signal SIGILL (Illegal instruction)
I appreciate any help.
Thank
Thomas

Android ndk-build error make.exe: *** create_child_process: DuplicateHandle(In) failed (e=6)

I'm relatively new to Android and I have a problem using the ndk-build command.
I use the NDK r9d under Windows 7 64bits.
When I run my build system which creates my Android project (makefiles etc...) and then creates a process running ndk-build.cmd (I checked that it is call in the Android project) I get the error:
make.exe: *** create_child_process: DuplicateHandle(In) failed (e=6)
But when I run ndk-build.cmd "manually" in the windows command console in the same Android project created by my build system (or any Android project) everything is working.
I did find some related questions like here:
https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014825836
https://cygwin.com/ml/cygwin/2004-09/msg01506.html
But all I found says either that it's a problem of make version which is not (I think) since ndk-build works fine when I use it "manually" or it says that it is related to stdin handling and again I don't think that the issue here. Plus all the anwsers that I found was related to a similar error but not exactly the same:
process_easy: DuplicateHandle(In) failed (e=6)
Maybe someone knows the meaning of my error message. I don't think that's specific to Android ndk-build but maybe.
Thank you for reading (and sorry for any english mistakes, I am french and not fluent in english)
Finaly, I found a solution to my problem here:
http://www.zeusedit.com/zforum/viewtopic.php?t=174
I am not sure about what the problem was but according to this link, it was related to the make environment and the handles.
The solution : Instead of using the createProcess function (from Windows) directly to call ndk-build.cmd, I created a batch file containing:
start ndk-build.cmd
And I called this batch (.bat) via the createProcess function.
I let you see the link for more details.

Javah cannot find specified lib for jni/android-ndk

So, I have tried everything that I know of possible. I ran an export CLASSPATH=/path/to/bin/classes, and it still isn't able to find the output. I've tried running the command from $PWD/bin/classes, the project's root, and STILL am having troubles getting this to work properly. I have the latest version of the ndk (r8-1 at the time of this writing) and the sdk as well. Generating header files via command line, etc.
So far, I've seen Javah error while using Jni, as well as another question which specified the same problem and received the same answers.
I'm running Arch Linux (Archbang, specifically) in x86_64.
Here's my invocation and output (executed from $PROJECT_ROOT/bin/classes):
javah -d ../../jni com.example.fibonnacinative.libfib
Error: Could not find class file for 'com.example.fibonnacinative.libfib'
I've tried with the -classpath, -verbose, etc. flags and neither appear to help. -classpath just spits out the same error, and -verbose does not give me any information apart from the output I've posted.
Halp?
Yup! It was based on my stupidity.
I should have followed casing conventions for LibFib by typing com.example.fibonnacinative.LibFib as opposed to libfib.
Note: the class itself is typically camel case, whereas the rest of the package directive is lowercase. These are just conventions, mind you.
Sorry folks.

OpenCV C++ with Android

I have checked a lot of threads already but none of them seems to solve my problem. I'm working on a project regarding my study and want to use the OpenCV library with my Android app. Here is a list of the programs and tools I use:
Eclipse IDE for Java Developers (3.7.0)
Android SDK r16
OpenCV 2.3.1
Android NDK r7b
I am following a tutorial, and everything works fine until the part where I need the NDK for using C++ OpenCV code. I can code and run Android apps and the "Tutorial 1" samples from the OpenCV 2.3.1 are working fine. However the "Tutorial 2" samples won't work. I tried following the steps in the C++ part of the tutorial.
When I try to run the NDK-build (tried both the command line and Eclipse part) I keep getting this error:
/usr/bin/sh: -c: line 1: syntax error: unexpected end of file
make: *** [obj/local/armeabi/objs/opencv/cvjni.o] Error 1
Does anyone has a solution for my problem? Thanks in advance
in bash script unexpected "syntax error: unexpected end of file" on if statement
Make sure your shell scripts use Unix-style line endings

Adobe air 3.0 ANE for Android, null ExtensionContext?

I've been working with the vibration example from Adobe for Air 3.0's native extensions on Android.
I have the ANE compiled and the .apk packaged.
The problem I'm having is the actionscript library is getting a null ExtensionContext.
I tried creating the .apk with adt -package -target apk-debug so that I can see the actionscript traces in logcat and that's where I'm finding the null error.
extContext = ExtensionContext.createExtensionContext("com.adobe.Vibration", null);
extContext is null and crashes on the following .call() method.
All of the source is stock from the examples, I haven't changed anything.
Does anyone have any experience with getting one of Adobe's ANE examples working on a windows machine? Most of the examples are for Mac.
Good lord. What a waste of a week.
I was using a tutorial from gotoandlearn.com that was telling me to, in by build script, use a jar command to put my native extension in to a jar.
I simply used the .jar that's automatically built in the NativeAndroid/bin/ folder and all is well.
It turns out, that tutorial is out dated and not really useful for the build anymore.
One additional comment. You need to set target platform and checkbox Is Library from Properties -> Android to get compiled jar in bin folder.
P.S. .sh from gotoandlearn can be executed in Powershell in Windows with minor changes for running bat files: ( cmd "/c adt.bat" )
I'm having the exact same problem on a Native Extension I'm writing, and have open sourced. I started this project with tutorial code from Adobe DevNet. I've found examples of this specific issue I've tried to follow exactly, and have had no luck with it yet. I've identified it to be a sandbox allow-domain problem.
Here's my line of code:
_aneContext = ExtensionContext.createExtensionContext("com.adobe.sampleasextension", "");
Here is a link to the code in my GitHub project:
https://github.com/interactivenyc/ANESampleProject/blob/master/TEST_AndroidAIR/src/ANESampleTest.as
Here is my compiler error:
SecurityError: Error #3207: Application-sandbox content cannot access this feature.
at flash.system::Security$/allowDomain()
at com.adobe.sampleasextension::SampleASExtension()[/Users/stevewarren/Clients/Speakaboos/git_repositories/ANESampleProject/ANESampleSWC/src/com/adobe/sampleasextension/SampleASExtension.as:14]
at ANESampleTest/initializeANE()[/Users/stevewarren/Clients/Speakaboos/git_repositories/ANESampleProject/TEST_AndroidAIR/src/ANESampleTest.as:198]
at ANESampleTest/onAddedToStage()[/Users/stevewarren/Clients/Speakaboos/git_repositories/ANESampleProject/TEST_AndroidAIR/src/ANESampleTest.as:131]
at runtime::ContentPlayer/loadInitialContent()
at runtime::ContentPlayer/playRawContent()
at runtime::ContentPlayer/playContent()
at runtime::AppRunner/run()
at AppEntryCommon/run()
at global/runtime::AndroidMobileDeviceAppEntry()

Categories

Resources