How to fix CMAKE Android-Toolchain RPATH Problem - android

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

Related

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.

dx.bat hangs while processing .class files

I'm using dx.bat to prepare my java code and java libraries I'm using for device. I have several .jar's, and the tool always hangs on the same class. It doesn't finish or report any errors. If I remove the .jar that contains that class, then dx.bat completes successfully, but the app won't run, of course, because classes are missing.
The .jar causing problems is aws-android-sdk-1.4.0-core.jar, from Amazon. The class is com/amazonaws/javax/xml/stream/StaxErrorReporter$1.class
I've searched extensively and found other dx errors, but not this one. Has anyone else seen this happen?
UPDATE: I'm running dx.bat from a java build tool I made when it hangs. I tried running the same command from the windows command line, and it runs just fine. So the problem appears to be with java?
Well, it turns out the problem was my java code that was running dx.bat. The issue is explained here:
Java Process with Input/Output Stream
I redirected the error stream, and now it's working.

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.

Why does Python fail to run ant build?

If I run ant release in the shell in my dir proj it works fine, however, when I try to execute it from python, it fails, why?
/Users/hunterp/proj
Buildfile: /Users/hunterp/proj/build.xml
BUILD FAILED
/Users/hunterp/proj/build.xml:46: sdk.dir is missing. Make sure to generate local.properties using 'android update project'
It is difficult to answer this question without more information about your setup or the code you are using. Particularly the parts that are generating the error since we don't know what your code looks like (either in build.xml or in your python script).
An easy thing to start with, as indicated by #Mark, is to <echo>${basedir}</echo> in your release task to see where exactly it thinks it is running from. My guess is that you are trying to load a properties file or some such and it isn't finding it in an earlier step.
What you can do if the location of ${basedir} looks different when run from within the directory versus within your python script is use a reference to where your build.xml file lives and reference from there:
<dirname property="project.basedir" file="${ant.file.project_name}"/>
Then use use ${project.basedir} instead of ${basedir}.
All of this assuming, of course, that your ${basedir} appears differently between the two. Otherwise I'd need to know more in order to diagnose the issue.

How to build Android NDK sample: "bitmap-plasma"

I am trying to build the bitmap-plasma sample that is included with the ndk, but getting an error. I run ndk-build from the samples/bitmap-plasma directory, and the error it displays is that it cannnot locate android/bitmap.h file.
How do i direct the ndk-build script to the file it needs?
Using android-ndk-r4 on Ubuntu Lucid 10.04
Well it's working now, so in case anyone was having my same problem:
There as an android-ndk-r4b bugfix release today, which it seems no longer has this problem.
Available to download here.
http://developer.android.com/sdk/ndk/index.html
With Ubuntu 10.04 and NDK r5b, I have just posted a bug report (with the fix included) for build_platforms.sh. See http://code.google.com/p/android/issues/detail?id=15180 for details. Essentially, the local declarations in the symlink routine must be amended. Otherwise, it only links the first file (alphabetically) from each directory, and truncates the remainder from the list.
Correcting this allowed the symbolic links to be fully populated, thereby filling in the missing header files and libraries and allowing the samples to build successfully.

Categories

Resources