* Ada on Android? @ 2011-09-05 17:22 Stephen Leake 2011-09-05 20:15 ` onox 0 siblings, 1 reply; 13+ messages in thread From: Stephen Leake @ 2011-09-05 17:22 UTC (permalink / raw) I managed to modify an open source music player written in Java to do what I want on my new Android. Now I want to make it even better, but I'm already tired of saying "I wish this was in Ada!". So I install GNAT GPL 2011 for jvm target, and ran jvm2ada on android.jar (which generated about 2,900 files!, after some hiccups). Then I tried building the Java hello world tutorial translated to Ada. The compiler reported several bugs in the generated code; some obvious errors (duplicate identifiers) some apparently compiler bugs. After finding work-arounds for all of those, I finally hit a bug box that I don't see how to fix. I'm doing this at home, so I can't use my work AdaCore support contract to get help. Has anyone here done any Ada for Android? I could compromise and write the GUI and Android API-intensive stuff in Java and the rest in Ada, but for this program, most of it is GUI or Android-intensive (there are a _lot_ of very nice facilities in the Android API). So that would not gain much. -- -- Stephe ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Ada on Android? 2011-09-05 17:22 Ada on Android? Stephen Leake @ 2011-09-05 20:15 ` onox 2011-09-06 1:16 ` Stephen Leake 2011-09-06 16:54 ` Pascal Obry 0 siblings, 2 replies; 13+ messages in thread From: onox @ 2011-09-05 20:15 UTC (permalink / raw) On Sep 5, 7:22 pm, Stephen Leake <stephen_le...@stephe-leake.org> wrote: > I managed to modify an open source music player written in Java to do > what I want on my new Android. > > Now I want to make it even better, but I'm already tired of saying "I > wish this was in Ada!". > > So I install GNAT GPL 2011 for jvm target, and ran jvm2ada on > android.jar (which generated about 2,900 files!, after some hiccups). > > Then I tried building the Java hello world tutorial translated to Ada. > The compiler reported several bugs in the generated code; some obvious > errors (duplicate identifiers) some apparently compiler bugs. After > finding work-arounds for all of those, I finally hit a bug box that I > don't see how to fix. > > I'm doing this at home, so I can't use my work AdaCore support contract > to get help. > > Has anyone here done any Ada for Android? > > I could compromise and write the GUI and Android API-intensive stuff in > Java and the rest in Ada, but for this program, most of it is GUI or > Android-intensive (there are a _lot_ of very nice facilities in the > Android API). So that would not gain much. > > -- > -- Stephe You might be interested in checking the GNATDroid (Android 2.3+) cross- compiler for FreeBSD at http://www.dragonlace.net/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Ada on Android? 2011-09-05 20:15 ` onox @ 2011-09-06 1:16 ` Stephen Leake 2011-09-06 10:33 ` Brian Drummond 2011-09-06 16:54 ` Pascal Obry 1 sibling, 1 reply; 13+ messages in thread From: Stephen Leake @ 2011-09-06 1:16 UTC (permalink / raw) onox <denkpadje@gmail.com> writes: > On Sep 5, 7:22 pm, Stephen Leake <stephen_le...@stephe-leake.org> > wrote: >> Has anyone here done any Ada for Android? >> > > You might be interested in checking the GNATDroid (Android 2.3+) cross- > compiler for FreeBSD at http://www.dragonlace.net/ I don't need to target ARM; the Android API is for the JVM target. The problem is binding to the Android API; I don't see any mention of that on the DragonLace.Net page. -- -- Stephe ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Ada on Android? 2011-09-06 1:16 ` Stephen Leake @ 2011-09-06 10:33 ` Brian Drummond 2011-09-06 12:08 ` jrmarino 2011-09-08 0:15 ` Stephen Leake 0 siblings, 2 replies; 13+ messages in thread From: Brian Drummond @ 2011-09-06 10:33 UTC (permalink / raw) On Mon, 05 Sep 2011 21:16:13 -0400, Stephen Leake wrote: > onox <denkpadje@gmail.com> writes: > >> On Sep 5, 7:22 pm, Stephen Leake <stephen_le...@stephe-leake.org> >> wrote: >>> Has anyone here done any Ada for Android? >>> >>> >> You might be interested in checking the GNATDroid (Android 2.3+) cross- >> compiler for FreeBSD at http://www.dragonlace.net/ > > I don't need to target ARM; the Android API is for the JVM target. Was. As of Android 2.3, the API has also been opened up to native (usually ARM) code. See http://developer.android.com/sdk/ndk/index.html There was some support for C on earlier Android versions but as of 2.3 it's supposed to be complete and for C++ too. Performance aside, this may be a better approach than targetting the JVM. For example, is it possible the Ada compiler hits some difference between JVM and Dalvik that isn't important to the Java compiler? This (in 2.3) was apparently intended as a sop to the C++ community but opens the way to Ada as well via the Dragonlace compiler (or my so far unsuccessful attempts at building FSF Gnat 4.6/4.7 to target Arm on Linux). > The problem is binding to the Android API; I don't see any mention of > that on the DragonLace.Net page. The NDK documentation will cover that (for C++ anyway); as far as I can see, it's a mess. You may not ever need Java but you will need the SDK's GUI builder (and from the SDK examples, that still requires hand editing XML!) A GTKAda binding to that mess would be nice ... (though probably difficult to impossible) Meanwhile, I think getting the ACATS suite to pass on Android is quite impressive. Kudos to jrmarino. Here, I have FreeBSD going in VirtualBox on my laptop, and am working through installing the tools via ports. (GTK took 24 hours building several hundred packages from source; and now GPS insists on building an obsolete GCC4.5.x before it will install...) Then my cheap Flytouch pad is only Android 2.2(Froyo). I may have to look around for an upgrade to 2.3... I'll report if/when I have a HelloWorld running. But I think we're close. - Brian ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Ada on Android? 2011-09-06 10:33 ` Brian Drummond @ 2011-09-06 12:08 ` jrmarino 2011-09-07 23:09 ` Brian Drummond 2011-09-08 0:15 ` Stephen Leake 1 sibling, 1 reply; 13+ messages in thread From: jrmarino @ 2011-09-06 12:08 UTC (permalink / raw) On Sep 6, 12:33 pm, Brian Drummond <br...@shapes.demon.co.uk> wrote: > Meanwhile, I think getting the ACATS suite to pass on Android is quite > impressive. Kudos to jrmarino. Thanks, Brian. > Here, I have FreeBSD going in VirtualBox on my laptop, and am working > through installing the tools via ports. (GTK took 24 hours building > several hundred packages from source; and now GPS insists on building an > obsolete GCC4.5.x before it will install...) GPS meaning GNAT Programming Studio? It doesn't require GCC 4.5. Some other dependency must be pulling that in (probably in error). GPS only requires GNAT-AUX to build. John ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Ada on Android? 2011-09-06 12:08 ` jrmarino @ 2011-09-07 23:09 ` Brian Drummond 0 siblings, 0 replies; 13+ messages in thread From: Brian Drummond @ 2011-09-07 23:09 UTC (permalink / raw) On Tue, 06 Sep 2011 05:08:30 -0700, jrmarino wrote: >> ... and now GPS insists on building >> an obsolete GCC4.5.x before it will install...) > > GPS meaning GNAT Programming Studio? It doesn't require GCC 4.5. Some > other dependency must be pulling that in (probably in error). GPS only > requires GNAT-AUX to build. ... finally, GCC4.5 built (after a frustrating time, trying to enlarge the virtualbox "disk" allocated to freeBSD). It appears LAPack requires GCC4.5, NumPy requires LAPack, Py26-gtk requires NumPy and so on... Saw the GnatDroid ports in portsnap, just before I saw your other post. Cool... - Brian ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Ada on Android? 2011-09-06 10:33 ` Brian Drummond 2011-09-06 12:08 ` jrmarino @ 2011-09-08 0:15 ` Stephen Leake 2011-09-09 13:16 ` Brian Drummond 1 sibling, 1 reply; 13+ messages in thread From: Stephen Leake @ 2011-09-08 0:15 UTC (permalink / raw) Brian Drummond <brian@shapes.demon.co.uk> writes: > On Mon, 05 Sep 2011 21:16:13 -0400, Stephen Leake wrote: > >> onox <denkpadje@gmail.com> writes: >> >>> On Sep 5, 7:22 pm, Stephen Leake <stephen_le...@stephe-leake.org> >>> wrote: >>>> Has anyone here done any Ada for Android? >>>> >>>> >>> You might be interested in checking the GNATDroid (Android 2.3+) cross- >>> compiler for FreeBSD at http://www.dragonlace.net/ >> >> I don't need to target ARM; the Android API is for the JVM target. > > Was. > > As of Android 2.3, the API has also been opened up to native (usually > ARM) code. See > http://developer.android.com/sdk/ndk/index.html > > There was some support for C on earlier Android versions but as of 2.3 > it's supposed to be complete and for C++ too. Performance aside, this may > be a better approach than targetting the JVM. For example, is it possible > the Ada compiler hits some difference between JVM and Dalvik that isn't > important to the Java compiler? I never got as far as actually trying to run things. I'm writing a music player app, that uses lots of neat stuff (like a low level music player) in the Android API. So I need to use the JVM. The compiler bugs are encountered when trying to compile the specs of the Ada binding to the API, not in the code generator. > This (in 2.3) was apparently intended as a sop to the C++ community >but > opens the way to Ada as well via the Dragonlace compiler (or my so far > unsuccessful attempts at building FSF Gnat 4.6/4.7 to target Arm on > Linux). Ada is supposed to be able to target the JVM; also being able to target ARM is an orthogonal issue. Targeting the ARM would be useful for compiling a new cryptographic library, for example. Totally unnecessary for building a music player. >> The problem is binding to the Android API; I don't see any mention of >> that on the DragonLace.Net page. > > The NDK documentation will cover that (for C++ anyway); as far as I can > see, it's a mess. You may not ever need Java but you will need the SDK's > GUI builder (and from the SDK examples, that still requires hand editing > XML!) I already have a working app written in Java; I found the Java source code for the example music player written by Google, and adapted it. Not hard, and I found the on-line Android API docs to be adequate, if not outstanding. But I still want to redo it in Ada before I add more features. I'm don't understand what "SDK GUI Builder" you are talking about; I used Eclipse and the Android toolkit, as the Hello World tutorial says. And yes, the GUI builder suffers from the same WYSIAYG problems every other GUI builder I've used has; editing XML was necessary, but also far easier than trying to do the same thing in the GUI builder. It is possible to do without the GUI builder by writing either Java or Ada code that constructs the GUI; we have the same choice in GtkAda. I'm going with the recommended approach to make sure I know what its advantages are before I give up on it. For example, that might be the best way to allow skin customizations, which is a nice feature. > A GTKAda binding to that mess would be nice ... > (though probably difficult to impossible) Why would that be nice? So far, the Android windowing stuff is _far_ cleaner and easier to use than the equivalent GtkAda stuff. I don't have to immediately do unsafe type conversions to write marshallers for my app event handlers; that's all hidden. All I have to do is declare an overriding implementation of a JVM class method. I'm sure I will run into limitations with this method; I'm already having trouble keeping track of what thread each method call is running in (the API docs are _not_ clear about that; I'm assuming anything called a "callback" can be running in a different thread than the read of the app). In fact, I'm thinking of writing a similar music player for Windows, using the JVM and Java windowing stuff there. It may not be as clean as Android, but it would be hard to be much worse than Gtk. The alternative would be to try to write a plugin for VLC or one of the other existing players: I have not looked into that yet, so I don't know what GUI kit they use. > Meanwhile, I think getting the ACATS suite to pass on Android is quite > impressive. Kudos to jrmarino. That is good, but not my need at the moment. > Here, I have FreeBSD going in VirtualBox on my laptop, and am working > through installing the tools via ports. (GTK took 24 hours building > several hundred packages from source; and now GPS insists on building an > obsolete GCC4.5.x before it will install...) > > Then my cheap Flytouch pad is only Android 2.2(Froyo). I may have to look > around for an upgrade to 2.3... > > I'll report if/when I have a HelloWorld running. I'm talking about the full Android windowing Hello World at http://developer.android.com/resources/tutorials/hello-world.html. _not_ just Ada.Text_IO.Put_line. > But I think we're close. You are way overly optimistic. But that's a necessary attitude in this business :). -- -- Stephe ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Ada on Android? 2011-09-08 0:15 ` Stephen Leake @ 2011-09-09 13:16 ` Brian Drummond 2011-09-10 17:38 ` Stephen Leake 0 siblings, 1 reply; 13+ messages in thread From: Brian Drummond @ 2011-09-09 13:16 UTC (permalink / raw) On Wed, 07 Sep 2011 20:15:12 -0400, Stephen Leake wrote: > Brian Drummond <brian@shapes.demon.co.uk> writes: > Ada is supposed to be able to target the JVM; also being able to target > ARM is an orthogonal issue. Targeting the ARM would be useful for > compiling a new cryptographic library, for example. Totally unnecessary > for building a music player. Not necessary. Perhaps sufficient if you can bind to the API from native code and write native code callbacks (you can from C/C++ in Android 2.3, so presumably also Ada). I am not suggestion there is anything wrong in targetting the JVM in Ada! However, if that turns out to be problematic, native code could offer an alternative approach. Ideally, both will work. > I'm don't understand what "SDK GUI Builder" you are talking about; I > used Eclipse and the Android toolkit, as the Hello World tutorial says. That is the one I meant. (I don't know how you installed it; for me, it came with the SDK. But it's some sort of Eclipse plugin) > It is possible to do without the GUI builder by writing either Java or > Ada code that constructs the GUI; we have the same choice in GtkAda. I'm > going with the recommended approach to make sure I know what its > advantages are before I give up on it. Interesting. As far as I could see, we have to use XML (or the builder) to control layout. If you can do that in [Java/Ada] instead, that's very good news! I missed that. Any references to it, or sample projects? >> A GTKAda binding to that mess would be nice ... (though probably >> difficult to impossible) > > Why would that be nice? Just commonality with other platforms. I hear you about the mess in GTK underneath! If we can develop for Android and use the same product on other platforms (not just Windows), that would also be nice. Nicer, if the underlying windowing stuff is cleaner. >> I'll report if/when I have a HelloWorld running. > > I'm talking about the full Android windowing Hello World at > http://developer.android.com/resources/tutorials/hello-world.html. > _not_ just Ada.Text_IO.Put_line. So am I; or rather, the exact equivalent "hello-jni" example from http://developer.android.com/sdk/ndk/overview.html#samples This ought to work on Android 1.5 and above. Then proceeding to the "native activity" and other samples, which will require 2.3. For Ada.Text_IO.Put_line we are there already. > You are way overly optimistic. But that's a necessary attitude in this > business :). Thanks! - Brian ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Ada on Android? 2011-09-09 13:16 ` Brian Drummond @ 2011-09-10 17:38 ` Stephen Leake 0 siblings, 0 replies; 13+ messages in thread From: Stephen Leake @ 2011-09-10 17:38 UTC (permalink / raw) Brian Drummond <brian@shapes.demon.co.uk> writes: > On Wed, 07 Sep 2011 20:15:12 -0400, Stephen Leake wrote: > >> Ada is supposed to be able to target the JVM; also being able to target >> ARM is an orthogonal issue. Targeting the ARM would be useful for >> compiling a new cryptographic library, for example. Totally unnecessary >> for building a music player. > > Not necessary. Perhaps sufficient if you can bind to the API from native > code and write native code callbacks (you can from C/C++ in Android 2.3, > so presumably also Ada). > > I am not suggestion there is anything wrong in targetting the JVM in Ada! > However, if that turns out to be problematic, native code could offer an > alternative approach. Ideally, both will work. Ah. I guess JNI is more complicated/complete than I had thought. I'll have to read more about it. For example, there is now a NativeActivity that allows writing a complete Activity in native code. >> It is possible to do without the GUI builder by writing either Java or >> Ada code that constructs the GUI; we have the same choice in GtkAda. I'm >> going with the recommended approach to make sure I know what its >> advantages are before I give up on it. > > Interesting. As far as I could see, we have to use XML (or the builder) > to control layout. If you can do that in [Java/Ada] instead, that's very > good news! I missed that. Any references to it, or sample projects? I haven't tried it yet, but see http://developer.android.com/reference/android/widget/LinearLayout.html ; you can specify a LinearLayout in code, and add things to it. There are reasons to use the XML; it keeps layout separate from the rest of the code, so specifying portrait vs landscape vs widget is cleaner. But similar separation could be achieved with appropriate subprograms (or should I say "methods"? sigh). Allowing users to specify layout at runtime might be a big advantage. >>> A GTKAda binding to that mess would be nice ... (though probably >>> difficult to impossible) >> >> Why would that be nice? > > Just commonality with other platforms. I hear you about the mess in GTK > underneath! > > If we can develop for Android and use the same product on other platforms > (not just Windows), that would also be nice. Nicer, if the underlying > windowing stuff is cleaner. Yes, cross platform is a nice dream. I had high hopes for GtkAda for that. At the moment, I think QtAda is better, but not by much. I would like to port my Android music App to windows. It may be that the Android windowing classes are built on top of Gtk, in which case it _might_ be possible to port them to Windows. That would be neat. >>> I'll report if/when I have a HelloWorld running. >> >> I'm talking about the full Android windowing Hello World at >> http://developer.android.com/resources/tutorials/hello-world.html. >> _not_ just Ada.Text_IO.Put_line. > > So am I; or rather, the exact equivalent "hello-jni" example from > http://developer.android.com/sdk/ndk/overview.html#samples Ok. I guess I should install the NDK and look at that. -- -- Stephe ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Ada on Android? 2011-09-05 20:15 ` onox 2011-09-06 1:16 ` Stephen Leake @ 2011-09-06 16:54 ` Pascal Obry 2011-09-06 18:11 ` jrmarino 1 sibling, 1 reply; 13+ messages in thread From: Pascal Obry @ 2011-09-06 16:54 UTC (permalink / raw) To: onox Le 05/09/2011 22:15, onox a �crit : > You might be interested in checking the GNATDroid (Android 2.3+) cross- > compiler for FreeBSD at http://www.dragonlace.net/ I haven't looked, but is there a script or instruction to build a cross for Android somewhere? Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.net - http://v2p.fr.eu.org --| "The best way to travel is by means of imagination" --| --| gpg --keyserver keys.gnupg.net --recv-key F949BD3B ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Ada on Android? 2011-09-06 16:54 ` Pascal Obry @ 2011-09-06 18:11 ` jrmarino 2011-09-08 0:18 ` Stephen Leake 0 siblings, 1 reply; 13+ messages in thread From: jrmarino @ 2011-09-06 18:11 UTC (permalink / raw) On Sep 6, 6:54 pm, Pascal Obry <pas...@obry.net> wrote: > Le 05/09/2011 22:15, onox a écrit : > > > You might be interested in checking the GNATDroid (Android 2.3+) cross- > > compiler for FreeBSD athttp://www.dragonlace.net/ > > I haven't looked, but is there a script or instruction to build a cross > for Android somewhere? > > Pascal. > Pascal, Only the GNAT-AUX repository has the necessary patches to build GNAT for Android. Unless somebody duplicates my work, any new android cross-compiler would have use this codebase. The ports listed on Dragonlace are being added to FreeBSD now, two of the four are already committed. When the final two get committed, FreeBSD users with be able to do something like "cd /usr/ports/lang/ gnatdroid-armv7 && make install" to get their cross-compiler. Users of other OS's will have to use the FreeBSD makefiles as a template and hopefully publish their work if successful. I won't have time to port this over to other hosts any time soon. Regards, John ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Ada on Android? 2011-09-06 18:11 ` jrmarino @ 2011-09-08 0:18 ` Stephen Leake 2011-09-08 5:51 ` jrmarino 0 siblings, 1 reply; 13+ messages in thread From: Stephen Leake @ 2011-09-08 0:18 UTC (permalink / raw) jrmarino <dragonlace.cla@marino.st> writes: > On Sep 6, 6:54 pm, Pascal Obry <pas...@obry.net> wrote: >> Le 05/09/2011 22:15, onox a écrit : >> >> > You might be interested in checking the GNATDroid (Android 2.3+) cross- >> > compiler for FreeBSD athttp://www.dragonlace.net/ >> >> I haven't looked, but is there a script or instruction to build a cross >> for Android somewhere? >> >> Pascal. >> > > Pascal, > Only the GNAT-AUX repository has the necessary patches to build GNAT > for Android. This is ambiguous. Android is an operating system; you also need to specify the machine when talking about cross compilers. As far as I can tell, GNAT-AUX only targets the ARM machine. > Unless somebody duplicates my work, any new android cross-compiler > would have use this codebase. I see no reason why the GNAT GPL 2011 jvm target should not work for Android (except for the bugs I'm complaining about, of course. but they are at a different level of detail :). -- -- Stephe ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Ada on Android? 2011-09-08 0:18 ` Stephen Leake @ 2011-09-08 5:51 ` jrmarino 0 siblings, 0 replies; 13+ messages in thread From: jrmarino @ 2011-09-08 5:51 UTC (permalink / raw) On Sep 8, 2:18 am, Stephen Leake <stephen_le...@stephe-leake.org> wrote: > jrmarino <dragonlace....@marino.st> writes: > > On Sep 6, 6:54 pm, Pascal Obry <pas...@obry.net> wrote: > >> Le 05/09/2011 22:15, onox a écrit : > > >> > You might be interested in checking the GNATDroid (Android 2.3+) cross- > >> > compiler for FreeBSD athttp://www.dragonlace.net/ > > >> I haven't looked, but is there a script or instruction to build a cross > >> for Android somewhere? > > >> Pascal. > > > Pascal, > > Only the GNAT-AUX repository has the necessary patches to build GNAT > > for Android. > > This is ambiguous. Android is an operating system; you also need to > specify the machine when talking about cross compilers. > > As far as I can tell, GNAT-AUX only targets the ARM machine. > > > Unless somebody duplicates my work, any new android cross-compiler > > would have use this codebase. > > I see no reason why the GNAT GPL 2011 jvm target should not work for > Android (except for the bugs I'm complaining about, of course. but they > are at a different level of detail :). > > -- > -- Stephe Stephe, you're talking apples to oranges. We're talking about building native Ada applications which (like native C/C++ applications) could utilize the Android API for windows, accelerator sensor access, etc. The binding with those libraries still need to be made, and you need to wrap in the xml manifests described in the "nativeactivity" capability that was introduced with Android 2.3. You're talking about building the apps in the Java VM I think, and that's just an entirely different approach. GNAT-AUX specifically targets x86, x86_64 on four BSDs and Solaris, and ARM on Android. It will very likely work on other platforms (namely Linux) and even other processors, but that is just a carryover from gcc and it's not tested. Stock GCC/GNAT can not be built for Android/ARM, although it should work fine for Linux/ARM. John ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2011-09-10 17:38 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-09-05 17:22 Ada on Android? Stephen Leake 2011-09-05 20:15 ` onox 2011-09-06 1:16 ` Stephen Leake 2011-09-06 10:33 ` Brian Drummond 2011-09-06 12:08 ` jrmarino 2011-09-07 23:09 ` Brian Drummond 2011-09-08 0:15 ` Stephen Leake 2011-09-09 13:16 ` Brian Drummond 2011-09-10 17:38 ` Stephen Leake 2011-09-06 16:54 ` Pascal Obry 2011-09-06 18:11 ` jrmarino 2011-09-08 0:18 ` Stephen Leake 2011-09-08 5:51 ` jrmarino
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox