Hi, I am building a graphics and audio engine (In Zig) and for a while I wanted to port some of my code to Ada but one of my targets is android and gcc does not support it. It is unfortunately a major target for me.
I found out that there is a llvm front-end but what is the state of it? I cannot really find relevant information. Has anyone tried to target android with it? Or is it still experimental?
I also found that there is a some sort of android compiler ported to bsd but I have no idea how well it works or even maintained anymore…
I’ve seen some things about Ada on Android, and will pop a few links, but I’ve never compiled for Android. — Keep in mind that Android is essentially Java, and so the question is going to be tied to “Ada on the JVM” [IIUC].
I don’t know if GNAT Pro still has it, the community edition of Ada had it, so if you are ok with an older compiler, then you can play around with interfacing with Java
I build gcc years back with ada enabled for android, you can interface with the native activity, you don’t have to go via JNI. But the latest android toolchain is llvm based, no idea how to build that and I can’t remember what the target is for gcc.
This is just an idea, but it might be possible to build GNAT LLVM (targeting the desired Android architecture) using the Android NDK (as a sysroot). Troy has identified a working configuration of GNAT LLVM [1] you could start with.
With an LLVM compiler that can generate C and Ada code on the correct platform you could try to build a the “rawdrawandroid” project by cnlohr [2]. This brilliant project demonstrates building Android applications using just C and Makefiles (no Java).
At this point you will have a project that runs in the Android platform and a compiler that can generate Ada code. Continuing on, in theory you could create an Ada run time that integrates with the Android framework and use it basis for Ada application development on Android.
I’m kinda curious about the state of the termux thing, too. I know android was trying to restrict things like Termux from creating and running executables, but that was over a year ago and you can still download termux. I remember using that tutorial (and a few others) and compiling an example app for android ON android.
AFAIK, support for arm64 and Android has been improved in the latest versions of GCC (as per the changelogs). Also, as already pointed out, there is LLVM-19 support for GNAT-LLVM, which should be plenty flexible to get Android stuff running with Ada.
It is true that in the past there was more “easy to get started” support, but not anymore. But that does not mean that the behind the scenes support has not been improving!