www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - What is the current state of D for android development?

reply "js.mdnq" <js_adddot+mdng gmail.com> writes:
I would like to get into writing apps for android and would like 
to choose D for this if it is mature enough.

What is the D progress on the android?

I see that at least others are interested but not finding a ton 
of information:

http://forum.dlang.org/thread/20120204203109.26c9a80b jpf-laptop?page=1
Mar 27 2013
next sibling parent reply "js.mdnq" <js_adddot+mdng gmail.com> writes:
On Thursday, 28 March 2013 at 06:13:17 UTC, js.mdnq wrote:
 I would like to get into writing apps for android and would 
 like to choose D for this if it is mature enough.

 What is the D progress on the android?

 I see that at least others are interested but not finding a ton 
 of information:

 http://forum.dlang.org/thread/20120204203109.26c9a80b jpf-laptop?page=1

I guess that means none... :/
Mar 28 2013
parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
Am 29.03.2013 07:35, schrieb js.mdnq:
 On Thursday, 28 March 2013 at 06:13:17 UTC, js.mdnq wrote:
 I would like to get into writing apps for android and would like to
 choose D for this if it is mature enough.

 What is the D progress on the android?

 I see that at least others are interested but not finding a ton of
 information:

 http://forum.dlang.org/thread/20120204203109.26c9a80b jpf-laptop?page=1

I guess that means none... :/

Some time ago there was a post on the newsgroup of someone that had a working GDC which would output ARM binaries and he even converted the most important parts of druntime to work for android to. But unfortunately I can't remember where that was. Kind Regards Bejamin Thaut
Mar 29 2013
parent =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
On 03/29/2013 02:32 AM, Benjamin Thaut wrote:
 Am 29.03.2013 07:35, schrieb js.mdnq:
 On Thursday, 28 March 2013 at 06:13:17 UTC, js.mdnq wrote:
 I would like to get into writing apps for android and would like to
 choose D for this if it is mature enough.

 What is the D progress on the android?

 I see that at least others are interested but not finding a ton of
 information:

 http://forum.dlang.org/thread/20120204203109.26c9a80b jpf-laptop?page=1

I guess that means none... :/

Some time ago there was a post on the newsgroup of someone that had a working GDC which would output ARM binaries and he even converted the most important parts of druntime to work for android to. But unfortunately I can't remember where that was. Kind Regards Bejamin Thaut

I haven't tried it myself but there is this information: http://gdcproject.org/wiki/Cross%20Compiler/crosstool-NG Ali
Mar 29 2013
prev sibling next sibling parent "BLM768" <blm768 gmail.com> writes:
On Friday, 29 March 2013 at 06:35:10 UTC, js.mdnq wrote:
 I guess that means none... :/

Unfortunately, there hasn't been a lot of focus on ARM platforms; people are too busy improving the language and tools to work on standard PC hardware. The DMD compiler definitely won't work for Android development, but I'm pretty sure that GDC can be compiled for ARM output, and I think LDC has that capability as well. You'd probably need to write your own linkscripts, and the runtime would definitely have to be modified.
Mar 29 2013
prev sibling next sibling parent "deadalnix" <deadalnix gmail.com> writes:
On Friday, 29 March 2013 at 07:02:24 UTC, BLM768 wrote:
 On Friday, 29 March 2013 at 06:35:10 UTC, js.mdnq wrote:
 I guess that means none... :/

Unfortunately, there hasn't been a lot of focus on ARM platforms; people are too busy improving the language and tools to work on standard PC hardware. The DMD compiler definitely won't work for Android development, but I'm pretty sure that GDC can be compiled for ARM output, and I think LDC has that capability as well. You'd probably need to write your own linkscripts, and the runtime would definitely have to be modified.

Being able to codegen is easy. But the runtime needs to follow, and that another issue altogether.
Mar 29 2013
prev sibling next sibling parent "Dicebot" <m.strashun gmail.com> writes:
On Thursday, 28 March 2013 at 06:13:17 UTC, js.mdnq wrote:
 I would like to get into writing apps for android and would 
 like to choose D for this if it is mature enough.

 What is the D progress on the android?

 I see that at least others are interested but not finding a ton 
 of information:

 http://forum.dlang.org/thread/20120204203109.26c9a80b jpf-laptop?page=1

That is one of dark sides of comunity-driven development. Techincally, it is possible: at least GDC can do ARM code gen, there is nothing inherently blocking the port in language design. What is required is that someone will actually take his time to port druntime and test everything. And that supposes some substantial time investments from someone both familiar with druntime and interested in Android dev. Looks like no such person exist so far.
Mar 29 2013
prev sibling next sibling parent reply Paulo Pinto <pjmlp progtools.org> writes:
On 28.03.2013 07:13, js.mdnq wrote:
 I would like to get into writing apps for android and would like to
 choose D for this if it is mature enough.

 What is the D progress on the android?

 I see that at least others are interested but not finding a ton of
 information:

 http://forum.dlang.org/thread/20120204203109.26c9a80b jpf-laptop?page=1

Please note that native development in Android has a second class status. Support is only available as a means to bring "legacy" C and C++ code to the platform. The few Android APIs available to languages outside the Dalvik world are actually wrappers around JNI calls. -- Paulo
Mar 29 2013
next sibling parent reply Paulo Pinto <pjmlp progtools.org> writes:
On 30.03.2013 05:58, Nick Sabalausky wrote:
 On Fri, 29 Mar 2013 18:45:33 +0100
 Paulo Pinto <pjmlp progtools.org> wrote:

 On 28.03.2013 07:13, js.mdnq wrote:
 I would like to get into writing apps for android and would like to
 choose D for this if it is mature enough.

 What is the D progress on the android?

 I see that at least others are interested but not finding a ton of
 information:

 http://forum.dlang.org/thread/20120204203109.26c9a80b jpf-laptop?page=1

Please note that native development in Android has a second class status. Support is only available as a means to bring "legacy" C and C++ code to the platform. The few Android APIs available to languages outside the Dalvik world are actually wrappers around JNI calls.

That's actually something that's been rolling around in my head for months, and now that it's brought up again, I have to just go ahead and say it: What...the *FUCK* is Google thinking??? How is it *possible* that the one company in the word that's been known, more than any other, for recruiting as many of the supposedly best and brightest developers in the world as they possibly can, portrayed by approximately...everyone in the world...as being practically a developer's utopia, with nary a pointy-hair in sight, and the streets paved with latte, can be so incredibly dumb as to decide "Hey, let's make our system API be *JVM-only* (ok, "JVM-knockoff", whatever, like it even matters) and marginalize native in general, and shit all over the idea of being anything more than halfway Posix"?? Even *Apple* isn't that goddamn stupid, for crap's sakes, and *Apple* was never a developer's company, it was run by a dicatoring *salesman*! A drugged-out fucking *salesman* for fuck's sakes, and even *they* didn't botch things up *that* badly! Not only that, but this is the same - apparently schizophrenic - company that's been trying to push the *Google* **NATIVE** **CLIENT**, ie NaCl!! [Just insert a mental image right here of Lewis Black's trademark freak-out saying "What...the...FUUUCK?!?'] Sheesh. Sorry, had to get it outta my system...

Personally my issue is another one. I don't mind that they use Java (the language), but I think that instead of having the effort of implementing Dalvik, they could have implemented a native code compiler instead. This way the platform would be fully native. This is Microsoft current approach, regardless of C++ or .NET, since Windows Phone 8, everything is compiled to native code. As for POSIX compatibility, it is oversold. You only have APIs for command line applications and daemons, and like any standard, it has undefined behaviors, with each vendor having a different idea what POSIX means. Nowadays they could even support Go in the platform, but the Android group does not seem to care that much (issue was created by me). http://code.google.com/p/android/issues/detail?id=39482 -- Paulo
Mar 29 2013
parent Jacob Carlborg <doob me.com> writes:
On 2013-03-30 08:26, Nick Sabalausky wrote:

 You've got the Go team which has historically been staunchly opposed to
 dynamic linking, and the Android team ten miles in the opposite
 direction. Classic corporate "left-hand vs right-hand" discrepancy.
 Makes them sound like Sony or MS.

That's one thing Apple is good at, having the different parts of the company work together. They don't care if a particular device sells less because of another device, as long as they sell more combined. -- /Jacob Carlborg
Mar 30 2013
prev sibling parent reply Paulo Pinto <pjmlp progtools.org> writes:
On 30.03.2013 10:43, Dicebot wrote:
 I hate this decision, too, but in case you wander, initial rationale for
 restricting everything to VM was an attempt to fight device h/w
 fragmentization and avoid necessity to build different application
 versions for different devices.

 Failed attempt, obviously.

 Apple have never needed that though as they 100% control device hardware
 their OS runs on.

You can achieve this by bytecodes that get compiled on the fly at installation time. This is how Windows Phone 8 works, by using an offline compiler on Windows Store to compile .NET to native code, thus you only install native code, there is no JIT on the devices. Or how Windows CE used platform neutral binaries, known as Common Executable Format (CEF). Nowadays I think the best way is a mixture of JIT + AOT, similar to what functional programming languages offer. -- Paulo
Mar 30 2013
next sibling parent Paulo Pinto <pjmlp progtools.org> writes:
On 30.03.2013 16:46, Nick Sabalausky wrote:
 On Sat, 30 Mar 2013 10:53:31 +0100
 Paulo Pinto <pjmlp progtools.org> wrote:

 This is how Windows Phone 8 works, by using an offline compiler on
 Windows Store to compile .NET to native code, thus you only install
 native code, there is no JIT on the devices.

Unless the bytecode is both comparable to LLVM and has an escape hatch to include real pre-compiled binary data, then that still bugs me. STill a huge improvement over Android, though. Well, except that the user has to use Win8 ;)

They use a format known as MDIL (Machine Dependent Intermediate Language). Basically everything is compiled down to machine code, except for memory references and labels. Linking is performed at installation time on the device. This allows the code to be made available in native format, while keeping the flexibility of dynamic libraries to be in sync with operating system updates. More information here, http://channel9.msdn.com/Shows/Going+Deep/Mani-Ramaswamy-and-Peter-Sollich-Inside-Compiler-in-the-Cloud-and-MDIL http://channel9.msdn.com/Events/Build/2012/3-005 -- Paulo
Mar 30 2013
prev sibling parent Paulo Pinto <pjmlp progtools.org> writes:
On 31.03.2013 14:29, deadalnix wrote:
 On Saturday, 30 March 2013 at 15:46:58 UTC, Nick Sabalausky wrote:
 Unless the bytecode is both comparable to LLVM and has an escape hatch
 to include real pre-compiled binary data, then that still bugs me.

 STill a huge improvement over Android, though. Well, except that the
 user has to use Win8 ;)

At infrastructure level, this is also quite scary that everything is done in MS server farm.

It is no different than any other commercial vendor.
Mar 31 2013
prev sibling next sibling parent "jerro" <a a.com> writes:
 Some time ago there was a post on the newsgroup of someone that 
 had a working GDC which would output ARM binaries and he even 
 converted the most important parts of druntime to work for 
 android to. But unfortunately I can't remember where that was.

Johannes Pfau has a GDC fork with Android support here: https://github.com/jpf91/GDC/tree/android and build scripts that build NDK with D support here: https://github.com/jpf91/gdc-android-scripts
Mar 29 2013
prev sibling next sibling parent Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On Fri, 29 Mar 2013 18:45:33 +0100
Paulo Pinto <pjmlp progtools.org> wrote:

 On 28.03.2013 07:13, js.mdnq wrote:
 I would like to get into writing apps for android and would like to
 choose D for this if it is mature enough.

 What is the D progress on the android?

 I see that at least others are interested but not finding a ton of
 information:

 http://forum.dlang.org/thread/20120204203109.26c9a80b jpf-laptop?page=1

Please note that native development in Android has a second class status. Support is only available as a means to bring "legacy" C and C++ code to the platform. The few Android APIs available to languages outside the Dalvik world are actually wrappers around JNI calls.

That's actually something that's been rolling around in my head for months, and now that it's brought up again, I have to just go ahead and say it: What...the *FUCK* is Google thinking??? How is it *possible* that the one company in the word that's been known, more than any other, for recruiting as many of the supposedly best and brightest developers in the world as they possibly can, portrayed by approximately...everyone in the world...as being practically a developer's utopia, with nary a pointy-hair in sight, and the streets paved with latte, can be so incredibly dumb as to decide "Hey, let's make our system API be *JVM-only* (ok, "JVM-knockoff", whatever, like it even matters) and marginalize native in general, and shit all over the idea of being anything more than halfway Posix"?? Even *Apple* isn't that goddamn stupid, for crap's sakes, and *Apple* was never a developer's company, it was run by a dicatoring *salesman*! A drugged-out fucking *salesman* for fuck's sakes, and even *they* didn't botch things up *that* badly! Not only that, but this is the same - apparently schizophrenic - company that's been trying to push the *Google* **NATIVE** **CLIENT**, ie NaCl!! [Just insert a mental image right here of Lewis Black's trademark freak-out saying "What...the...FUUUCK?!?'] Sheesh. Sorry, had to get it outta my system...
Mar 29 2013
prev sibling next sibling parent Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On Sat, 30 Mar 2013 07:47:56 +0100
Paulo Pinto <pjmlp progtools.org> wrote:

 On 30.03.2013 05:58, Nick Sabalausky wrote:
 On Fri, 29 Mar 2013 18:45:33 +0100
 Paulo Pinto <pjmlp progtools.org> wrote:

 On 28.03.2013 07:13, js.mdnq wrote:
 I would like to get into writing apps for android and would like
 to choose D for this if it is mature enough.

 What is the D progress on the android?

 I see that at least others are interested but not finding a ton of
 information:

 http://forum.dlang.org/thread/20120204203109.26c9a80b jpf-laptop?page=1

Please note that native development in Android has a second class status. Support is only available as a means to bring "legacy" C and C++ code to the platform. The few Android APIs available to languages outside the Dalvik world are actually wrappers around JNI calls.

That's actually something that's been rolling around in my head for months, and now that it's brought up again, I have to just go ahead and say it: What...the *FUCK* is Google thinking??? How is it *possible* that the one company in the word that's been known, more than any other, for recruiting as many of the supposedly best and brightest developers in the world as they possibly can, portrayed by approximately...everyone in the world...as being practically a developer's utopia, with nary a pointy-hair in sight, and the streets paved with latte, can be so incredibly dumb as to decide "Hey, let's make our system API be *JVM-only* (ok, "JVM-knockoff", whatever, like it even matters) and marginalize native in general, and shit all over the idea of being anything more than halfway Posix"?? Even *Apple* isn't that goddamn stupid, for crap's sakes, and *Apple* was never a developer's company, it was run by a dicatoring *salesman*! A drugged-out fucking *salesman* for fuck's sakes, and even *they* didn't botch things up *that* badly! Not only that, but this is the same - apparently schizophrenic - company that's been trying to push the *Google* **NATIVE** **CLIENT**, ie NaCl!! [Just insert a mental image right here of Lewis Black's trademark freak-out saying "What...the...FUUUCK?!?'] Sheesh. Sorry, had to get it outta my system...

Personally my issue is another one. I don't mind that they use Java (the language), but I think that instead of having the effort of implementing Dalvik, they could have implemented a native code compiler instead. This way the platform would be fully native. This is Microsoft current approach, regardless of C++ or .NET, since Windows Phone 8, everything is compiled to native code.

Exactly. It just makes no sense how they see such little point in native. They've created a *real* machine that exists almost entirely to run a *virtual* machine. WTF is the point of that, if not to deliberately waste both hardware and developer resources? And on a portable, too - one of the top places where efficiency is particularly important.
 As for POSIX compatibility, it is oversold. You only have APIs for
 command line applications and daemons, and like any standard, it has
 undefined behaviors, with each vendor having a different idea what
 POSIX means.
 
 Nowadays they could even support Go in the platform, but the Android 
 group does not seem to care that much (issue was created by me).
 
 http://code.google.com/p/android/issues/detail?id=39482
 

I find this part particularly hilarious: "the Go compilers only generate static executables right now. Which means: ... - These programs *cannot* run in a Dalvik VM." You've got the Go team which has historically been staunchly opposed to dynamic linking, and the Android team ten miles in the opposite direction. Classic corporate "left-hand vs right-hand" discrepancy. Makes them sound like Sony or MS.
Mar 30 2013
prev sibling next sibling parent "Dicebot" <m.strashun gmail.com> writes:
I hate this decision, too, but in case you wander, initial 
rationale for restricting everything to VM was an attempt to 
fight device h/w fragmentization and avoid necessity to build 
different application versions for different devices.

Failed attempt, obviously.

Apple have never needed that though as they 100% control device 
hardware their OS runs on.
Mar 30 2013
prev sibling next sibling parent "Dicebot" <m.strashun gmail.com> writes:
%s/wander/wonder/g
Mar 30 2013
prev sibling next sibling parent "Dicebot" <m.strashun gmail.com> writes:
I have always wondered how it is done by Win 8. It requires 
knowledge of every single released device from Microsoft side, 
isn't it? How will it scale?
Mar 30 2013
prev sibling next sibling parent "jerro" <a a.com> writes:
On Saturday, 30 March 2013 at 09:55:27 UTC, Dicebot wrote:
 I have always wondered how it is done by Win 8. It requires 
 knowledge of every single released device from Microsoft side, 
 isn't it? How will it scale?

Doesn't it only require knowledge of every architecture? And supporting ARM and x86 would cover a great majority of devices. They could improve performance by targeting specific versions of the architecture, such as ARMv7 or x86_64, but even without that, performance would likely be better than that of a JIT.
Mar 30 2013
prev sibling next sibling parent Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On Sat, 30 Mar 2013 10:53:31 +0100
Paulo Pinto <pjmlp progtools.org> wrote:

 On 30.03.2013 10:43, Dicebot wrote:
 I hate this decision, too, but in case you wander, initial
 rationale for restricting everything to VM was an attempt to fight
 device h/w fragmentization and avoid necessity to build different
 application versions for different devices.

 Failed attempt, obviously.


Which begs the question, "Why haven't they noticed this and stopped treating native as second-class?"
 Apple have never needed that though as they 100% control device
 hardware their OS runs on.

You can achieve this by bytecodes that get compiled on the fly at installation time. This is how Windows Phone 8 works, by using an offline compiler on Windows Store to compile .NET to native code, thus you only install native code, there is no JIT on the devices.

Unless the bytecode is both comparable to LLVM and has an escape hatch to include real pre-compiled binary data, then that still bugs me. STill a huge improvement over Android, though. Well, except that the user has to use Win8 ;)
Mar 30 2013
prev sibling next sibling parent Johannes Pfau <nospam example.com> writes:
Am Fri, 29 Mar 2013 22:39:52 +0100
schrieb "jerro" <a a.com>:

 Some time ago there was a post on the newsgroup of someone that 
 had a working GDC which would output ARM binaries and he even 
 converted the most important parts of druntime to work for 
 android to. But unfortunately I can't remember where that was.

Johannes Pfau has a GDC fork with Android support here: https://github.com/jpf91/GDC/tree/android and build scripts that build NDK with D support here: https://github.com/jpf91/gdc-android-scripts

But it's probably horribly outdated now ;-) I'll have to revisit this when shared library support is stable.
Mar 30 2013
prev sibling parent "deadalnix" <deadalnix gmail.com> writes:
On Saturday, 30 March 2013 at 15:46:58 UTC, Nick Sabalausky wrote:
 Unless the bytecode is both comparable to LLVM and has an 
 escape hatch
 to include real pre-compiled binary data, then that still bugs 
 me.

 STill a huge improvement over Android, though. Well, except 
 that the
 user has to use Win8 ;)

At infrastructure level, this is also quite scary that everything is done in MS server farm.
Mar 31 2013