Building Autotools for Android - android

Perhaps some of you are aware that there is an Android port of GCC 4.7.
I've tested it and it works perfectly, however when 'make' and 'configure' are out of the picture, it is rather useless.
What would it take to port Autotools, including make and configure to Android itself?
If you are wondering who in the world would develop on a phone, you are forgetting that some tablets run Android, though I myself have a phone.

make require nothing, but C library and shell; configure is actually shell script, produced by autoconf, which in turn depends on awk, m4 and diffutils. The hardest part is using autoconf and make with Android built-in shell, which is said to lack lot of functionality. Fortunately Android ports of bash already exist.
The most problematic part with porting GNU programming stack to Android is undocumented file hierarchy (device vendors tend to modify it on every whim) and severely lacking Bionic library. There is number of projects, trying to work around this issues (such as http://sourceforge.net/projects/droidoverlay/, for example), but generally this area is still to be explored.

Related

Is it possible to run containers on android devices?

I’m a mobile developer and recently adept at using containers with docker. I’m developing a container architecture for my graduate project. One of the modules of this architecture would need to be run on an android device. But I could not find information on how to run a container on an android device. It could be something simple like an alpine image with python.
Can anyone tell me if there is a possibility to run a container on an android device with docker, or even kubernetes?
In 2021, the answer is definitely yes.
Here is a tutorial on that topic, which shows you how to run docker directly on Android, without VMs nor chroot. Note that you do need to root your phone and build a custom kernel though.
If you only want a quick look of docker running on android without getting your hands dirty, check out this comment on GitHub.
It is possible to use it for running docker on an android device using an application like termux or userland to install a qemu package.
The best way is to use alpine linux terminal, an android app available on github.
This alpine term app has a QEMU to run like alpine ISO. All things are automated
and this works with x86_64 kernel on any android.
Some android phones have a KVM kernel so this device can run faster alpine term
Also my friends made a video on a YouTube channel to run docker on any android phone without root.
I must note that I am not an expert in Android development. But I researched on this topic, and #Emile's answer is the easiest and closest you can get - as it seems.
You can actually run Fedora (and not only) image on top of the Termux and then launch Python inside. This is obviously not a docker, but might be helpful.You can find more info here.
In addition, I've found this topic on Quora which is a similar question:
Think about it: Docker abstracts the OS and that is all. The Android
OS is quite a different kernel than linux distributions, even though
it is linux. It might be tricky to get applications meant for a linux
distribution to run on Android/Docker.
One of the main reasons to use docker is that it can provide
self-contained packages of applications which do not affect the rest
of the system. The Android applications, packaged as .apk files are
just that.
Other than that I was able to find this topic on StackOverflow which does not really resolve the issue. As the issue might be related to AUFS and some Kernel features needed by LXT which are not present in Android - now some of them is from what I remember.
Also there is a claim that it is possible on docker forum and weibo (use translation to English), but there is only a screenshot provided by user and no details on how to do it, besides "it took a lot of effort" statement. So it would seam that this is still a not well known part, or maybe someone will be able to actually provide more complementary information - maybe try on Docker forum or GitHub.
We open the Android container, which can run the docker container on the Android operating system. Not only can run Docker containers, but also other containers, such as podman. In addition, we have also enabled the container to support checkpoint and restore functions, and support the migration of containers across architectures and operating systems. See https://github.com/CGCL-codes/Android-Container for details.
Some people think it's impossible but it isn't you can run a full ubuntu on your phone by this android app https://play.google.com/store/apps/details?id=com.termux
You can even install gui envrioment and connect over vnc everything is supported in this so also docker or website hosting and so on
(Make sure you follow al install steps in the app https://play.google.com/store/apps/details?id=studio.com.techriz.andronix to install linuxes like arch or ubuntu fedora or more you have to install these it doesn't work by just opening termux)
YOU DON'T HAVE TO ROOT TO USE THIS METHOD

How do I execute a Fortran based program in Android

I have coded a program in Fortran an works perfectly in Windows, my question is if there is any way I can use it in Android.
I don't have the reputation to just make a comment, but I will answer the concern you raise of "not wanting to install compilers" to build fortran programs for android. On pretty much any operating system there are no default compilers for any language, so you have to install compilers (luckily for fortran on windows you even have a lot of options). For Android, right now, you have only one choice. That is to build your own custom version of the NDK gcc cross toolchain and force it to build gfortran and libgfortran. As of right now, gcc has been deprecated in the toolchain. Soon that won't even be an option. I have recently built the previous version of the NDK with gfortran using the following link:
https://github.com/buffer51/android-gfortran
The other problem you're going to run into is that depending on what kind of application you have on windows (command line, gui, webapp, etc.), you're not going to be able to run it on a typical android tablet or phone because there is no command line interface by default (you'll probably have to root the device to get one). The easiest way to develop a usable android app is to write a Java app (using the SDK), and then use JNI to interface with a fortran "library". Unfortunately, there is no straightforward way to compile and use your program on Android, and soon even the complicated ways (building a custom compiler) will get even more complicated.

Developing native C applications android without the NDK?

OK this is a strange one:
Is there a way someone can develop native C applications or libraries for Android without using the Android NDK?
What was happening before the NDK was released?
(It's not there for too long, I think it was released only one or two years ago).
Apparently, you can -- a friend of mine is a real Android guru and he managed to build a GCC-based native toolchain entirely by hand. He also fixed some missing parts in Android's libc. The main idea is the following: GCC has builtin support for the arm-elf-linux target, so with an appropriate build script, you can configure it to build for Android. However, you have to root the phone to run the resulting binaries. One even cooler thing is that because GCC is a self-hosting compiler, with the arm-linux-elf toolchain, you can recompile GCC once again and have the toolchain on the phone itself.
Before the NDK was released, the only officially supported way of developing Android applications was to use the Android SDK and writing your applications in Java.
As others have mentioned, it's possible to cross-compile some applications as completely stand-alone and run them on a rooted phone. The downsides of this should be obvious: very few people will be able to run your application (they also need to be root, plus you won't be able to get your application up on the Play store); and you might even run into compatibility problems yourself across different devices e.g. if you rely on dynamic linking against various libraries (which you might need to do in order to keep the size of the binary down).
TL;DR: it's possible, but severly limited, and not recommended.
You can compile your C code with an Android-compatible toolchain (such as CodeSourcery) and run it on a non-rooted phone, from its command line (for example through an SSH connection like SSHDroid).

Can I run Wine on an Android slate?

I would like to run a small Windows program on an Android slate. It runs just fine under Wine in Ubuntu, but I am unsure how to install & run Wine on the Android slate.
Sorry if it's not strictly a programming question. If you want it to be so, I could rephrase it as "will I have to write my Delphi code again Java in order to run it on an Android slate?"
but I am unsure how to install & run Wine on the Android slate.
I sincerely doubt that is possible or will be within the next decade. While Android runs a Linux kernel, most of what WINE depends upon in Linux will look very different on Android. Not to mention the opcode issue noted by JOTN.
"will I have to write my Delphi code again Java in order to run it on an Android slate?"
Most likely. I don't know what "my Delphi code" entails. If it is pure algorithm stuff, conceivably you could use Free Pascal to get an ARM library you could link to via the Android NDK. If, however, "my Delphi code" involves the UI and the like, you would have to rewrite it (or cook up your own Delphi->Android translator) to get it to use Android's widget library.
I don't believe it will work because you would be trying to run x86 software on a non-x86 processor. To start you would need binaries compiled for an ARM processor.
If your windows program has any GUI, then it will definitely not work. Wine relies on an X-windows system when Android has its own graphical framework...
I've been looking at something similar recently. Wine doesn't run on anything that is not x86, period. When you introduce a GUI (as noted by Matthieu), anything outside of wine will need to utilise another graphics libraries.
It might be worth mentioning wine-lib, you can use this with gcc to cross complile to ARM but you'll end up in a 'world of pain' as soon as you have a GUI. I cannot be 100% but my guess is you're in for a rewrite. http://wiki.winehq.org/ARM
If you do go for a rewrite perhaps look at other languages as Java for android is not nessarliy the same Java you'll run on your desktop. http://www.oreillynet.com/onjava/blog/2007/11/dalvik_googles_tweaked_nonstan.html
I know it's a bit of a 'fad' but you might be best looking at html5/webapp or using c/c++ and gtk/qt if you can find work-arounds.
You can, but it is not easy and possibly too slow. The experimental process is described here: http://forum.xda-developers.com/showthread.php?t=1258506
It is a multi-step process. First you get an Ubuntu system image and chroot into that. Then from there you can invoke wine to display on the local vncserver. Then you install a vncviewer app on android to view the GUI.
Your android device would need to have an x86 CPU. So far, only netbooks will work for this as I don't believe there are any tablets available with x86 and Android compatability. I would only recommend going this route for fun and experimentation -- not productivity.

gcc -x objective-c with Android SDK

Since Objective-C exists and is supported even in MinGW, by passing -x objective-c, is there a hack to achieve this with Android SDK? I've did a rudimentary test on a colleague's machine where it appears that language objective-cis not supported.
I am not interested in getting UIKit or AppKit, or even Foundation, to work; I've written most of an OpenGLES game in Objective-C, and successfully ported it to Mac OS X and Windows; I am fairly certain I could easily port it to GNU/Linux once I get time to figure out enough of GNUStep (and even without it, I could create the classes to get the game running).
I'm just interested in the base language and basic runtime (including properties, if possible); even NSObject can be easily written to the extent I need it.
In the meantime, I've managed to compile some Objective-C code, and have written a guide for this:
Developing Objective-C apps for Android using Mac OS X
There are more details in my answer below.
The Apportable platform includes a Clang compiler integration with the Android NDK. It also includes a bunch of other useful features if you want to go beyond basic Objective-C language and runtime support.
You probably have to recompile the ndk gcc's sources with that option enabled. At the extreme you might have to find the code for that option upstream and add it to the ndk gcc's sources.
Porting runtime libraries to work on top of bionic instead of glibc may be more interesting.
Note that android doesn't really handle pure-native binaries very well, you will need to either be called as a jni library from a java wrapper application which you will have to call back up through for audio or forked and exec'd off of one (not recommended, and leaving you with device-dependent hacks for audio).
There is this Google Code project: http://code.google.com/p/android-gcc-objc2-0/ however I have not tested it yet.
Also, I have inquired on the Cocotron mailing list whether or not this compiler is usable with Cocotron's Foundation and CoreFoundation; one person responded that it is not, and that he has worked on the problem: http://groups.google.com/group/cocotron-dev/browse_thread/thread/448355f2a6c9c28e#
In the meantime, I've managed to compile some Objective-C code, and have written a guide for this:
* Developing Objective-C apps for Android using Mac OS X
Clang is included in NDK nowadays if that's all you need.

Categories

Resources