Running Unix Binaries in Android NDK - android

is it (theoretically) possible to run any Unix binary from the Android NDK? I have the following binaries available:
.rpm, Redhat / CentOS 5.8 i386 RPM
.rpm, Redhat / CentOS 5.8 x86_64 RPM
.tar.gz, Solaris Sparc 2.10
.tar.gz, Cygwin
.tar.gz, MinGW
There is also a .tar.gz available that can be installed from Unix Source. The application has command line tools available that I hope to exploit with the NDK. For example:
convert image.jpg image.png
While I am just starting to run through NDK examples and tutorials, I wanted to see if what I am trying to achieve is possible.
I'm not sure if the above information is enough to tell but, please let me know if there is any more information that I can provide.

Android is its very own architecture, so the files targeted for architectures like i386, x86_64, Solaris, etc. won't work there. It should be possible to use the NDK to convert a Unix Source bundle into binaries which will work on Android devices. But how easy or difficult that would be depends on what other libraries or possibly OS features the source itself depends on.

Related

cross compile glibc for Android ARM - configure error

I am trying to cross-compile glibc (version 2.28) for ARM (because the libc.a distributed with Android NDK lacks the xdr_() routines I need) and I am hitting an issue in the configure.
This is my configure:
../glibc-2.28/configure --prefix=/home/me/TEST --host=arm-linux-androideabi --disable-multilib
The error output by configure is:
GNU libc requires kernel header files from Linux 3.2.0 or later to be
installed before configuring.
It is defaulting to kernel headers in /usr/include/linux. I know I can change where it looks for kernel header files with --with-headers, but don't know where to point this to? I tried apt-get upgrade (and update) but still get the same configure error.
Note 1:
I have already built my arm-linux-androideabi-() binaries successfully and have built other packages OK. I am running on a Linux debian 4.9.0-8-amd64 system.
Note 2:
I checked stackoverflow for similar questions and found one, very similar, but the suggestion was to replace --host with --target. However, the responder was mistaken in thinking that the --host argument defines the machine on which the code is being compiled.

Installing NDK (arm-linux-androideabi-gcc) on Android (Remix OS)

I'm trying to install some python packages (pillow) for QPython on Remix however I get the error that arm-linux-androideabi-gcc does not exist.
I googled and I think I need NDK, however looking at the website (https://developer.android.com/ndk/downloads/index.html) I couldn't find a way to do this on android.
Any help is much appreciated, thank you!
Installing the NDK on Android? As in running the NDK compilers on an Android device? We don't support Android as a host OS for the NDK.
Check out AIDE android ide from the Google playstore
Despite Dan's answer, which I respect. It's not entirely accurate. The Android ndk build system doesn't allow for for host to be set to the $TARGET_ARCH, but building it manually in much the same way you would for any custom toolchain is entirely possible.
I should note that I have only done this for gcc, and have not attempted to do so with clang.
From Googles ndk toolchain repo just take the essentials needed, gcc, binutils, gmp, mpfr, etc and set your host and target to the ndk toolchain gcc. Use the ndk sysroot as build-sysroot, and then just add your compiler flags and with a little fiddling you should get it.
Id be happy to post more, it's been a project of mine to build Android on Android, also i highly recommend adding static versions of the ndk libs, as the android system doesn't have a c++ lib, and a few others. You may have to build some manually using aosp build system
I built it with stage-one flags so that the binaries would be static, as you never know when android might remove a lib that your toolchain depends on.
I encourage you to try, as an added benefit you will then he able to build many useful android native binaries that usually aren't available without editing the aosp source. Also having the ability to build binaries on the fly is very useful

"manual" cross-compilation from Linux/x86-64 to Android/ARM?

(Perhaps a border-line question on S.O since I am not showing any source code!)
I want to be able to cross-compile (using the latest GCC trunk, i.e. 4.9) a hello world program in C, compiled on Linux/Debian/Sid/x86-64 for Android (4.4.2 on a rooted Nexus 7), and to be executed in an Android terminal emulator. My goal is to learn how to configure the entire cross-tool chain, probably GCC, binutils, and MUSL libc. So I specifically do not want to use any SDK or NDK for Android!
I guess that my Android is an arm-linux-gnueabi GCC 4.9 primary target platform for GCC & binutils. Is this correct?
Then once I compiled my (statically linked with MUSL libc) hello world, how should I transfer it on the tablet? (MTP probably).
PS. I am quite familiar with Linux (and GCC, to which I contribute, and binutils) but I am a complete Android newbie.
PPS: The real motivation is that I want to compile a plugin for a GCC cross-compiler, preparing a talk about GCC plugins

What is Neon with respect to Android?

I'm a beginner in Android. My friend heard "Neon". So I did Google and found this
Referring it, Neon is related to multimedia for Android OS or all mobile OS, is it? Please share me more.
Neon is an ARM co-processor, meant for vector processing. Neon is used for multimedia data processing. It is an optional co-processor, the Android Linux kernel may or may not have support for this. (Eclair days)
However if Google provides any Android Application APIs to access Neon, then you can safely use it in your application.
NEON is extremely powerful and easy to program. It doesn't solve performance issues, but simply eliminates them in most cases.
NEON intrinsics suck performance-wise, I suggest writing native codes for NEON.
Java : pistol
C/C++ : assault rifle
Assembly : machine gun
NEON : vulcan cannon, or A-10 tank killer
Honestly, I'm not exaggerating in any way. NEON is THAT powerful.
There is an official usage example in the NDK source reproduced at: https://github.com/android/platform_development/tree/android-6.0.1_r16/ndk/samples/hello-neon
It is used from NDK, so the interesting files are the .c files under jni/.
You can build and install it with:
ndk-build
android update project -p . -t android-22
ant clean
ant debug
ant installd

Use ppcrossarm to cross compile to Android?

how can I use ppcrossarm to cross compile a Free Pascal file to Android?
Make sure you have the correct ppcrossarm (it could be for any arm)
Make sure you have the correct binutils installed and that the compiler can find them.
then basically
fpc -Tlinux -Parm file.pas
See also the buildfaq, http://www.stack.nl/~marcov/buildfaq.pdf
Well, the ARM compilers provided at freepascal.org only supports:
Game Boy Advance
Nintendo DS
Linux
Windows CE
which means you can probably only find ppcrossarm files for these four platform.
I did successfully compiled a few exe files for my Windows Phone, and perfectly executed. But, you may need other tools to link the .o file into an Android executable, not WinCE exe.

Categories

Resources