www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - It's alive! D building D building D, all on Android

reply Joakim <dlang joakim.fea.st> writes:
After a sleepless night of trying to build the latest ldc master 
branch 2.070.2 on my Android tablet a couple nights ago, almost 
the full druntime/phobos standard library test suite passes (only 
one assert in std.conv) and the same for the dmd test suite, with 
a handful of failures across three modules exclusively testing 
C/C++ ABI compatibility.

The 2.070 frontend is written in D, ie ddmd, and also natively 
compiled on the Android tablet by ldc 2.068 (alpha build 
available here, first download link - 
https://github.com/joakim-noah/android/releases/tag/polish), 
hence D (2.068) building D (2.070) building D (tests, apps, 
etc.). :) Of course ldc 2.068 was itself built natively on 
Android, using the Termux Android app and the dev tools that it 
comes with 
(https://play.google.com/store/apps/details?id=com.termux&hl=en). 
Using ldc and Termux, it's possible to build an Android app from 
scratch _on_ your Android device, by following these instructions:

https://github.com/termux/termux-packages/issues/63#issuecomment-184115581

It only took a single night of tweaking to build this because of 
all the great work many contributors have put in over the past 
year.  First, there's all the work that Walter, Daniel, and 
others have put into C++ integration, as ldc is now a moderately 
large mixed D/C++ codebase (Dscanner counts 62.5k klocs of D in 
the ddmd frontend, plus ldc's C++ layer and how many ever umpteen 
lines are invoked in llvm's C++ codebase).

Dan got the full ldc testsuite working on the Raspberry Pi a 
couple weeks ago 
(https://github.com/ldc-developers/ldc/issues/1283), in the 
process fixing several ARM codegen issues that were hitting 
Android/ARM also. Finally, there's all the great work put into 
ldc recently by Johan, kinke, Dan, Rainer, and of course David 
and Kai, to integrate the new D frontend with llvm and get ldc 
working on new platforms.

I'll look at getting JNI working next, along with finishing up a 
translated C++/OpenGL ES 2.0 sample app 
(https://github.com/googlesamples/android-ndk/tree/master/Teapot).  A
linux->Android cross-compiler will need the in-progress work to cross-compile
reals, have to look into that.  Once those issues are rounded up, I'll release
a ldc 1.0.0 beta for Android sometime this month.
May 05 2016
next sibling parent Rory McGuire via Digitalmars-d-announce writes:
On Thu, May 5, 2016 at 10:17 AM, Joakim via Digitalmars-d-announce
<digitalmars-d-announce puremagic.com> wrote:
 After a sleepless night of trying to build the latest ldc master branch
2.070.2 on my Android tablet a couple nights ago, almost the full
druntime/phobos standard library test suite passes (only one assert in
std.conv) and the same for the dmd test suite, with a handful of failures
across three modules exclusively testing C/C++ ABI compatibility.

 The 2.070 frontend is written in D, ie ddmd, and also natively compiled on the
Android tablet by ldc 2.068 (alpha build available here, first download link -
https://github.com/joakim-noah/android/releases/tag/polish), hence D (2.068)
building D (2.070) building D (tests, apps, etc.). :) Of course ldc 2.068 was
itself built natively on Android, using the Termux Android app and the dev
tools that it comes with
(https://play.google.com/store/apps/details?id=com.termux&hl=en). Using ldc and
Termux, it's possible to build an Android app from scratch _on_ your Android
device, by following these instructions:

 https://github.com/termux/termux-packages/issues/63#issuecomment-184115581

 It only took a single night of tweaking to build this because of all the great
work many contributors have put in over the past year.  First, there's all the
work that Walter, Daniel, and others have put into C++ integration, as ldc is
now a moderately large mixed D/C++ codebase (Dscanner counts 62.5k klocs of D
in the ddmd frontend, plus ldc's C++ layer and how many ever umpteen lines are
invoked in llvm's C++ codebase).

 Dan got the full ldc testsuite working on the Raspberry Pi a couple weeks ago
(https://github.com/ldc-developers/ldc/issues/1283), in the process fixing
several ARM codegen issues that were hitting Android/ARM also. Finally, there's
all the great work put into ldc recently by Johan, kinke, Dan, Rainer, and of
course David and Kai, to integrate the new D frontend with llvm and get ldc
working on new platforms.

 I'll look at getting JNI working next, along with finishing up a translated
C++/OpenGL ES 2.0 sample app
(https://github.com/googlesamples/android-ndk/tree/master/Teapot).  A
linux->Android cross-compiler will need the in-progress work to cross-compile
reals, have to look into that.  Once those issues are rounded up, I'll release
a ldc 1.0.0 beta for Android sometime this month.
Congratulations, to you and all those involved! Thanks so much for your time. This is really important work. Cheers, R
May 05 2016
prev sibling next sibling parent reply Vadim Lopatin <coolreader.org gmail.com> writes:
On Thursday, 5 May 2016 at 08:17:07 UTC, Joakim wrote:
 After a sleepless night of trying to build the latest ldc 
 master branch 2.070.2 on my Android tablet a couple nights ago, 
 almost the full druntime/phobos standard library test suite 
 passes (only one assert in std.conv) and the same for the dmd 
 test suite, with a handful of failures across three modules 
 exclusively testing C/C++ ABI compatibility.
Great work!
May 05 2016
parent reply Joakim <dlang joakim.fea.st> writes:
On Thursday, 5 May 2016 at 14:07:07 UTC, Vadim Lopatin wrote:
 On Thursday, 5 May 2016 at 08:17:07 UTC, Joakim wrote:
 After a sleepless night of trying to build the latest ldc 
 master branch 2.070.2 on my Android tablet a couple nights 
 ago, almost the full druntime/phobos standard library test 
 suite passes (only one assert in std.conv) and the same for 
 the dmd test suite, with a handful of failures across three 
 modules exclusively testing C/C++ ABI compatibility.
Great work!
I've slapped up some beta builds, have at it: https://github.com/joakim-noah/android/releases/tag/ddmd Check out this beautiful version string, a natively built ddmd on my Android tablet: LDC - the LLVM D compiler (1.0.0-beta1): based on DMD v2.070.2 and LLVM 3.8.0 built with LDC - the LLVM D compiler (3197d6) Default target: armv7-none-linux-android Host CPU: cortex-a15 http://dlang.org - http://wiki.dlang.org/LDC Registered Targets: arm - ARM armeb - ARM (big endian) thumb - Thumb thumbeb - Thumb (big endian)
May 11 2016
parent reply Joakim <dlang joakim.fea.st> writes:
On Wednesday, 11 May 2016 at 19:07:10 UTC, Joakim wrote:
 On Thursday, 5 May 2016 at 14:07:07 UTC, Vadim Lopatin wrote:
 On Thursday, 5 May 2016 at 08:17:07 UTC, Joakim wrote:
 [...]
Great work!
I've slapped up some beta builds, have at it: https://github.com/joakim-noah/android/releases/tag/ddmd Check out this beautiful version string, a natively built ddmd on my Android tablet: LDC - the LLVM D compiler (1.0.0-beta1): based on DMD v2.070.2 and LLVM 3.8.0 built with LDC - the LLVM D compiler (3197d6) Default target: armv7-none-linux-android Host CPU: cortex-a15 http://dlang.org - http://wiki.dlang.org/LDC Registered Targets: arm - ARM armeb - ARM (big endian) thumb - Thumb thumbeb - Thumb (big endian)
I've put up three more builds, including ldc master, which uses the latest 2.071 frontend. Once I get JNI and the sample app working, I'll make a proper announcement.
May 15 2016
parent reply Joakim <dlang joakim.fea.st> writes:
On Sunday, 15 May 2016 at 11:09:01 UTC, Joakim wrote:
 On Wednesday, 11 May 2016 at 19:07:10 UTC, Joakim wrote:
 On Thursday, 5 May 2016 at 14:07:07 UTC, Vadim Lopatin wrote:
 On Thursday, 5 May 2016 at 08:17:07 UTC, Joakim wrote:
 [...]
Great work!
I've slapped up some beta builds, have at it: https://github.com/joakim-noah/android/releases/tag/ddmd Check out this beautiful version string, a natively built ddmd on my Android tablet: LDC - the LLVM D compiler (1.0.0-beta1): based on DMD v2.070.2 and LLVM 3.8.0 built with LDC - the LLVM D compiler (3197d6) Default target: armv7-none-linux-android Host CPU: cortex-a15 http://dlang.org - http://wiki.dlang.org/LDC Registered Targets: arm - ARM armeb - ARM (big endian) thumb - Thumb thumbeb - Thumb (big endian)
I've put up three more builds, including ldc master, which uses the latest 2.071 frontend. Once I get JNI and the sample app working, I'll make a proper announcement.
I've put up the latest native and cross-compiler ldc 1.1.0 beta builds for Android, fresh from the master branch and using the 2.071 frontend: https://github.com/joakim-noah/android/releases I believe I've fixed the issue that was causing random crashes in the sample apps, a regression from porting the NDK's C wrapper to D, found by Vadim Lopatim. I've added three sample apps that demonstrate calling D code from JNI. The sample C++ Teapot app from the NDK has been ported to D and mostly works, including calling Java methods from D through JNI, but I need to track down some other touch-related bugs from the port before committing it. I'm finishing up reggae files to make building the sample apps very easy. I'd like to write up the process to build and use ldc natively on your Android mobile device, from the Termux app, on the wiki. Once those three are done, I'll create a new thread to properly announce this beta; in the meantime, nothing will change with these new beta builds, so try them out.
Dec 29 2016
next sibling parent Ignacious <I.D.T ProjectMaya.com> writes:
Just reporting here that I was able to get a hello world working 
using windows and UoW.

Some issues I had:

1. Had issues with outdated libraries. (ncurses, gcc, etc)
2. UoW Aniversary is based on Ubuntu 14, I was able to upgrade to 
16.04 following online sources. Lots of snags but eventually 
worked. (had to remove an file like 
50unattended-upgrades.ucf-dist to get everything to finish 
upgrading)

Basically search for solutions of each error online and 
eventually one will work. If anyone does this they could document 
it a bit better for others.

3. Installed android NDK without too much trouble.

4. Building with ldc2 works but must link with something like

$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/clang 
-Wl,-z,nocopyreloc --sysroot=$NDK/platforms/android-9/arch-arm 
-lgcc -gcc-toolchain 
$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 
-target armv7-none-linux-androideabi -no-canonical-prefixes 
-fuse-ld=bfd -Wl,--fix-cortex-a8 -Wl,--no-undefined 
-Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -fPIE -pie -mthumb 
-Wl,--export-dynamic -lc -lm test.o lib/libphobos2-ldc.a 
lib/libdruntime-ldc.a -o test

5. Push to android device and make sure to make executable or it 
will fail silently(e.g., chmod 755 test). Install a terminal 
emulator, obviously.

Haven't tried more complex examples but all the hard work seems 
to be paying off.

Thanks.
Jan 08 2017
prev sibling parent reply Joakim <dlang joakim.fea.st> writes:
On Thursday, 29 December 2016 at 09:16:58 UTC, Joakim wrote:
 On Sunday, 15 May 2016 at 11:09:01 UTC, Joakim wrote:
 On Wednesday, 11 May 2016 at 19:07:10 UTC, Joakim wrote:
     [...]
I've put up three more builds, including ldc master, which uses the latest 2.071 frontend. Once I get JNI and the sample app working, I'll make a proper announcement.
I've put up the latest native and cross-compiler ldc 1.1.0 beta builds for Android, fresh from the master branch and using the 2.071 frontend: https://github.com/joakim-noah/android/releases I believe I've fixed the issue that was causing random crashes in the sample apps, a regression from porting the NDK's C wrapper to D, found by Vadim Lopatim. I've added three sample apps that demonstrate calling D code from JNI. The sample C++ Teapot app from the NDK has been ported to D and mostly works, including calling Java methods from D through JNI, but I need to track down some other touch-related bugs from the port before committing it. I'm finishing up reggae files to make building the sample apps very easy. I'd like to write up the process to build and use ldc natively on your Android mobile device, from the Termux app, on the wiki. Once those three are done, I'll create a new thread to properly announce this beta; in the meantime, nothing will change with these new beta builds, so try them out.
Piping hot builds of the upcoming ldc 1.1.1 release available as both a linux/x64 -> Android/ARM cross-compiler and a native Android/ARM compiler, that you can run on your own phone or tablet: https://github.com/joakim-noah/android/releases I finally spent some time tracking down that touch bug in the sample Teapot app, think I know where it's coming from now, just need to fix it.
Feb 27 2017
next sibling parent Andre Pany <andre s-e-a-p.de> writes:
On Monday, 27 February 2017 at 17:08:26 UTC, Joakim wrote:
 Piping hot builds of the upcoming ldc 1.1.1 release available 
 as both a linux/x64 -> Android/ARM cross-compiler and a native 
 Android/ARM compiler, that you can run on your own phone or 
 tablet:

 https://github.com/joakim-noah/android/releases

 I finally spent some time tracking down that touch bug in the 
 sample Teapot app, think I know where it's coming from now, 
 just need to fix it.
Also Dockerfile is updated and using now this new version. More info https://wiki.dlang.org/Build_Android_Apps_using_LDC_in_a_Container Kind regards André
Mar 01 2017
prev sibling parent reply Joakim <dlang joakim.fea.st> writes:
On Monday, 27 February 2017 at 17:08:26 UTC, Joakim wrote:
 On Thursday, 29 December 2016 at 09:16:58 UTC, Joakim wrote:
 On Sunday, 15 May 2016 at 11:09:01 UTC, Joakim wrote:
 On Wednesday, 11 May 2016 at 19:07:10 UTC, Joakim wrote:
     [...]
I've put up three more builds, including ldc master, which uses the latest 2.071 frontend. Once I get JNI and the sample app working, I'll make a proper announcement.
I've put up the latest native and cross-compiler ldc 1.1.0 beta builds for Android, fresh from the master branch and using the 2.071 frontend: https://github.com/joakim-noah/android/releases I believe I've fixed the issue that was causing random crashes in the sample apps, a regression from porting the NDK's C wrapper to D, found by Vadim Lopatim. I've added three sample apps that demonstrate calling D code from JNI. The sample C++ Teapot app from the NDK has been ported to D and mostly works, including calling Java methods from D through JNI, but I need to track down some other touch-related bugs from the port before committing it. I'm finishing up reggae files to make building the sample apps very easy. I'd like to write up the process to build and use ldc natively on your Android mobile device, from the Termux app, on the wiki. Once those three are done, I'll create a new thread to properly announce this beta; in the meantime, nothing will change with these new beta builds, so try them out.
Piping hot builds of the upcoming ldc 1.1.1 release available as both a linux/x64 -> Android/ARM cross-compiler and a native Android/ARM compiler, that you can run on your own phone or tablet: https://github.com/joakim-noah/android/releases I finally spent some time tracking down that touch bug in the sample Teapot app, think I know where it's coming from now, just need to fix it.
Based on the recent 1.2 release of ldc, new builds for Android are up: https://github.com/joakim-noah/android/releases Notice how small the patches for ldc are, now that kinke added support for cross-compiling reals to lower-precision platforms, basically just a few additions to the CMake script to cross-compile the standard library left. Only a single assert from the stdlib tests trips, a longtime codegen issue in std.random that became visible now, and the entire compiler dmd-testsuite passes. I'll update the wiki, upload my remaining patches, post upstream PRs, and finally clean up and put out that sample Teapot app, which shows using JNI to call Java functions from your D app, this week.
May 01 2017
parent rikki cattermole <rikki cattermole.co.nz> writes:
On 01/05/2017 11:31 AM, Joakim wrote:
 On Monday, 27 February 2017 at 17:08:26 UTC, Joakim wrote:
 On Thursday, 29 December 2016 at 09:16:58 UTC, Joakim wrote:
 On Sunday, 15 May 2016 at 11:09:01 UTC, Joakim wrote:
 On Wednesday, 11 May 2016 at 19:07:10 UTC, Joakim wrote:
     [...]
I've put up three more builds, including ldc master, which uses the latest 2.071 frontend. Once I get JNI and the sample app working, I'll make a proper announcement.
I've put up the latest native and cross-compiler ldc 1.1.0 beta builds for Android, fresh from the master branch and using the 2.071 frontend: https://github.com/joakim-noah/android/releases I believe I've fixed the issue that was causing random crashes in the sample apps, a regression from porting the NDK's C wrapper to D, found by Vadim Lopatim. I've added three sample apps that demonstrate calling D code from JNI. The sample C++ Teapot app from the NDK has been ported to D and mostly works, including calling Java methods from D through JNI, but I need to track down some other touch-related bugs from the port before committing it. I'm finishing up reggae files to make building the sample apps very easy. I'd like to write up the process to build and use ldc natively on your Android mobile device, from the Termux app, on the wiki. Once those three are done, I'll create a new thread to properly announce this beta; in the meantime, nothing will change with these new beta builds, so try them out.
Piping hot builds of the upcoming ldc 1.1.1 release available as both a linux/x64 -> Android/ARM cross-compiler and a native Android/ARM compiler, that you can run on your own phone or tablet: https://github.com/joakim-noah/android/releases I finally spent some time tracking down that touch bug in the sample Teapot app, think I know where it's coming from now, just need to fix it.
Based on the recent 1.2 release of ldc, new builds for Android are up: https://github.com/joakim-noah/android/releases Notice how small the patches for ldc are, now that kinke added support for cross-compiling reals to lower-precision platforms, basically just a few additions to the CMake script to cross-compile the standard library left. Only a single assert from the stdlib tests trips, a longtime codegen issue in std.random that became visible now, and the entire compiler dmd-testsuite passes. I'll update the wiki, upload my remaining patches, post upstream PRs, and finally clean up and put out that sample Teapot app, which shows using JNI to call Java functions from your D app, this week.
Yay!
May 01 2017
prev sibling next sibling parent Chris <wendlec tcd.ie> writes:
Thank you very much!! Fantastic job!
May 05 2016
prev sibling next sibling parent Kai Nacke <kai redstar.de> writes:
On Thursday, 5 May 2016 at 08:17:07 UTC, Joakim wrote:
 After a sleepless night of trying to build the latest ldc 
 master branch 2.070.2 on my Android tablet a couple nights ago, 
 almost the full druntime/phobos standard library test suite 
 passes (only one assert in std.conv) and the same for the dmd 
 test suite, with a handful of failures across three modules 
 exclusively testing C/C++ ABI compatibility.
This is awesome! Fits very well into my vision of "D Everywhere!" Regards, Kai
May 05 2016
prev sibling next sibling parent Joseph Rushton Wakeling <joseph.wakeling webdrake.net> writes:
On Thursday, 5 May 2016 at 08:17:07 UTC, Joakim wrote:
 After a sleepless night of trying to build the latest ldc 
 master branch 2.070.2 on my Android tablet a couple nights ago, 
 almost the full druntime/phobos standard library test suite 
 passes (only one assert in std.conv) and the same for the dmd 
 test suite, with a handful of failures across three modules 
 exclusively testing C/C++ ABI compatibility.
That's really awesome news -- congratulations! :-)
May 05 2016
prev sibling next sibling parent Dan Olson <gorox comcast.net> writes:
Quite nice!
May 05 2016
prev sibling next sibling parent calex <i-fear-the-spam coreylub.in> writes:
On Thursday, 5 May 2016 at 08:17:07 UTC, Joakim wrote:
 After a sleepless night of trying to build the latest ldc 
 master branch 2.070.2 on my Android tablet a couple nights ago, 
 almost the full druntime/phobos standard library test suite 
 passes (only one assert in std.conv) and the same for the dmd 
 test suite, with a handful of failures across three modules 
 exclusively testing C/C++ ABI compatibility.

 [...]
Very nice. Thanks for sharing, Joakim. I will certainly be using this later— whenever it is that I eventually emerge from my cave.
May 07 2016
prev sibling next sibling parent reply Johan Engelen <j j.nl> writes:
Fantastic news!

I hope we can find a good way to integrate automated testing of 
github branches/PRs for Android.

cheers,
  Johan
May 07 2016
parent reply Joakim <dlang joakim.fea.st> writes:
On Saturday, 7 May 2016 at 09:58:14 UTC, Johan Engelen wrote:
 Fantastic news!

 I hope we can find a good way to integrate automated testing of 
 github branches/PRs for Android.
There is beta support for Android on Travis, perhaps it can be used to run the druntime and phobos tests in an emulator.
May 07 2016
parent reply Rory McGuire via Digitalmars-d-announce writes:
On 08 May 2016 02:21, "Joakim via Digitalmars-d-announce" <
digitalmars-d-announce puremagic.com> wrote:
 On Saturday, 7 May 2016 at 09:58:14 UTC, Johan Engelen wrote:
 Fantastic news!

 I hope we can find a good way to integrate automated testing of github
branches/PRs for Android.
 There is beta support for Android on Travis, perhaps it can be used to
run the druntime and phobos tests in an emulator. https://aws.amazon.com/device-farm/
May 07 2016
parent Joakim <dlang joakim.fea.st> writes:
On Sunday, 8 May 2016 at 05:08:32 UTC, Rory McGuire wrote:
 On 08 May 2016 02:21, "Joakim via Digitalmars-d-announce" < 
 digitalmars-d-announce puremagic.com> wrote:
 On Saturday, 7 May 2016 at 09:58:14 UTC, Johan Engelen wrote:
 Fantastic news!

 I hope we can find a good way to integrate automated testing 
 of github
branches/PRs for Android.
 There is beta support for Android on Travis, perhaps it can be 
 used to
run the druntime and phobos tests in an emulator. https://aws.amazon.com/device-farm/
I've heard of it, but it's overkill just to run command-line tests, ie an emulator is enough, and that service costs money. I think that's more for devs who want to test their app on a wide variety of devices, not open-source languages like D.
May 07 2016
prev sibling parent Walter Bright <newshound2 digitalmars.com> writes:
On 5/5/2016 1:17 AM, Joakim wrote:
 After a sleepless night of trying to build the latest ldc master branch 2.070.2
 on my Android tablet a couple nights ago, almost the full druntime/phobos
 standard library test suite passes (only one assert in std.conv) and the same
 for the dmd test suite, with a handful of failures across three modules
 exclusively testing C/C++ ABI compatibility.
This is wonderful news! Thanks to the LDC team for all their hard work on this.
Dec 29 2016