www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Ever want to compile D on your Android phone? Well, now you can!

reply Joakim <dlang joakim.fea.st> writes:
An alpha release of ldc, the llvm-based D compiler, for Android 
devices is now available.  It is best used with the excellent 
Termux app 
(https://play.google.com/store/apps/details?id=com.termux&hl=en) 
and a bluetooth keyboard. ;) Updated test runners, that run most 
tests from the standard library on any Android device, are also 
available (results have been reported for everything from a 
TomTom BRIDGE GPS navigation device to a Huawei Watch):

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

You can install a test runner app or run a command-line binary.  
Please report your results in this thread in the ldc forum, which 
requires no registration, with the info and format requested 
there, particularly for Android 4.1 or earlier:

https://forum.dlang.org/thread/bafrkjfwmoyriyhmqizl forum.dlang.org

If you try out the native compiler, take a look at the README 
that comes with it for instructions.

If you have a D/OpenGL app you'd like to port to Android and 
submit to the Play Store, let me know if I can help with that 
process.
Jan 24 2016
next sibling parent Sebastiaan Koppe <mail skoppe.eu> writes:
Wow! Keep up the good work.
Jan 25 2016
prev sibling next sibling parent reply Vadim Lopatin <coolreader.org gmail.com> writes:
On Sunday, 24 January 2016 at 15:12:30 UTC, Joakim wrote:
 If you have a D/OpenGL app you'd like to port to Android and 
 submit to the Play Store, let me know if I can help with that 
 process.
I'm going to port DlangUI on Android in nearest future.
Jan 26 2016
parent Joakim <dlang joakim.fea.st> writes:
On Tuesday, 26 January 2016 at 15:54:17 UTC, Vadim Lopatin wrote:
 On Sunday, 24 January 2016 at 15:12:30 UTC, Joakim wrote:
 If you have a D/OpenGL app you'd like to port to Android and 
 submit to the Play Store, let me know if I can help with that 
 process.
I'm going to port DlangUI on Android in nearest future.
Great! Let me know if you need anything from me.
Jan 26 2016
prev sibling next sibling parent Atila Neves <atila.neves gmail.com> writes:
On Sunday, 24 January 2016 at 15:12:30 UTC, Joakim wrote:
 An alpha release of ldc, the llvm-based D compiler, for Android 
 devices is now available.  It is best used with the excellent 
 Termux app 
 (https://play.google.com/store/apps/details?id=com.termux&hl=en) and a
bluetooth keyboard. ;) Updated test runners, that run most tests from the
standard library on any Android device, are also available (results have been
reported for everything from a TomTom BRIDGE GPS navigation device to a Huawei
Watch):

 [...]
Good work! Atila
Jan 26 2016
prev sibling next sibling parent reply Laeeth Isharc <laeethnospam nospam.laeeth.com> writes:
On Sunday, 24 January 2016 at 15:12:30 UTC, Joakim wrote:
 An alpha release of ldc, the llvm-based D compiler, for Android 
 devices is now available.  It is best used with the excellent 
 Termux app 
 (https://play.google.com/store/apps/details?id=com.termux&hl=en) and a
bluetooth keyboard. ;) Updated test runners, that run most tests from the
standard library on any Android device, are also available (results have been
reported for everything from a TomTom BRIDGE GPS navigation device to a Huawei
Watch):

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

 You can install a test runner app or run a command-line binary.
  Please report your results in this thread in the ldc forum, 
 which requires no registration, with the info and format 
 requested there, particularly for Android 4.1 or earlier:

 https://forum.dlang.org/thread/bafrkjfwmoyriyhmqizl forum.dlang.org

 If you try out the native compiler, take a look at the README 
 that comes with it for instructions.

 If you have a D/OpenGL app you'd like to port to Android and 
 submit to the Play Store, let me know if I can help with that 
 process.
https://www.reddit.com/r/programming/comments/42w404/dlang_llvmbacked_compiler_alpha_release_for/
Jan 26 2016
parent reply Joakim <dlang joakim.fea.st> writes:
On Wednesday, 27 January 2016 at 06:04:43 UTC, Laeeth Isharc 
wrote:
 https://www.reddit.com/r/programming/comments/42w404/dlang_llvmbacked_compiler_alpha_release_for/
Thanks, I wondered if it had been posted, as it's the kind of oddity they might enjoy. :) On Wednesday, 27 January 2016 at 07:01:30 UTC, Vadim Lopatin wrote:
 On Sunday, 24 January 2016 at 15:12:30 UTC, Joakim wrote:
 An alpha release of ldc, the llvm-based D compiler, for 
 Android devices is now available.  It is best used with the 
 excellent Termux app 
 (https://play.google.com/store/apps/details?id=com.termux&hl=en) and a
bluetooth keyboard. ;) Updated test runners, that run most tests from the
standard library on any Android device, are also available (results have been
reported for everything from a TomTom BRIDGE GPS navigation device to a Huawei
Watch):

 https://github.com/joakim-noah/android/releases/tag/polish
Cannot build ldc for Android according to instructions http://wiki.dlang.org/Build_LDC_for_Android git clone --recursive https://github.com/ldc-developers/ldc.git cd ldc/ git submodule update curl -O https://gist.githubusercontent.com/joakim- noah/63693ead3aa62216e1d9/raw/b89d77d66a80206b4dd3d78bb10d83a7e368f3d4/ldc_android_arm git apply ldc_android_arm Patch cannot be applied to current ~master I've tried to checkout several recent tagged versions - doesn't work too. Probably it's applicable only to some particular LDC version. What version of ldc should I checkout to apply this patch? (Building LDC on Windows)
It's not hard to figure out, as 'git apply ldc_android_arm' says it fails on dmd2/root/port.c and 'git log dmd2/root/port.c' shows this recent change to master: https://github.com/ldc-developers/ldc/commit/556e3a691f72b97cce31d85740e8dc12cafc9f53#diff-2268700876655bdfa9d178b9cc466277 I've updated the gist and wiki page to take that change into account; simply download the new gist, as shown on a reloaded wiki page. Also, I haven't tried cross-compiling from Windows, so you may run into other problems there. The main one I can think of is that the test runner targets I added to CMake may have an issue, but there could be additional incompatibilities that I simply haven't run into on linux. Hopefully, it just works. :) Anyway, this is a good reason to get all this stuff merged soon, which is what I was looking into now anyway, although that particular change is from Kai's long-unmerged longdouble2 branch.
Jan 26 2016
next sibling parent reply Vadim Lopatin <coolreader.org gmail.com> writes:
On Wednesday, 27 January 2016 at 07:48:53 UTC, Joakim wrote:
 On Wednesday, 27 January 2016 at 06:04:43 UTC, Laeeth Isharc 
 wrote:
 https://www.reddit.com/r/programming/comments/42w404/dlang_llvmbacked_compiler_alpha_release_for/
I've updated the gist and wiki page to take that change into account; simply download the new gist, as shown on a reloaded wiki page.
Thank you! I've sent pull request to fix GLES2 build errors, and to create dub.json Could you please register your project on code.dlang.org as DUB package? I'm going to use it as a dependency in DlangUI
Jan 27 2016
parent Joakim <dlang joakim.fea.st> writes:
On Wednesday, 27 January 2016 at 09:07:18 UTC, Vadim Lopatin 
wrote:
 On Wednesday, 27 January 2016 at 07:48:53 UTC, Joakim wrote:
 On Wednesday, 27 January 2016 at 06:04:43 UTC, Laeeth Isharc 
 wrote:
 https://www.reddit.com/r/programming/comments/42w404/dlang_llvmbacked_compiler_alpha_release_for/
I've updated the gist and wiki page to take that change into account; simply download the new gist, as shown on a reloaded wiki page.
Thank you! I've sent pull request to fix GLES2 build errors, and to create dub.json
Thanks, shows that I've only tested with OpenGL ES 1.0 so far. I was going to try porting one of the NDK sample apps that uses 2.0 next, shouldn't be an issue.
 Could you please register your project on code.dlang.org as DUB 
 package?

 I'm going to use it as a dependency in DlangUI
I had a dub.json written up locally, but simply never bothered to commit and register it. I'll do so now.
Jan 27 2016
prev sibling parent Laeeth Isharc <laeethnospam nospam.laeeth.com> writes:
On Wednesday, 27 January 2016 at 07:48:53 UTC, Joakim wrote:
 On Wednesday, 27 January 2016 at 06:04:43 UTC, Laeeth Isharc 
 wrote:
 https://www.reddit.com/r/programming/comments/42w404/dlang_llvmbacked_compiler_alpha_release_for/
Thanks, I wondered if it had been posted, as it's the kind of oddity they might enjoy. :)
Currently 9th with 215 upvotes. Just submitted to hacker news too.
Jan 27 2016
prev sibling next sibling parent Vadim Lopatin <coolreader.org gmail.com> writes:
On Sunday, 24 January 2016 at 15:12:30 UTC, Joakim wrote:
 An alpha release of ldc, the llvm-based D compiler, for Android 
 devices is now available.  It is best used with the excellent 
 Termux app 
 (https://play.google.com/store/apps/details?id=com.termux&hl=en) and a
bluetooth keyboard. ;) Updated test runners, that run most tests from the
standard library on any Android device, are also available (results have been
reported for everything from a TomTom BRIDGE GPS navigation device to a Huawei
Watch):

 https://github.com/joakim-noah/android/releases/tag/polish
Cannot build ldc for Android according to instructions http://wiki.dlang.org/Build_LDC_for_Android git clone --recursive https://github.com/ldc-developers/ldc.git cd ldc/ git submodule update curl -O https://gist.githubusercontent.com/joakim- noah/63693ead3aa62216e1d9/raw/b89d77d66a80206b4dd3d78bb10d83a7e368f3d4/ldc_android_arm git apply ldc_android_arm Patch cannot be applied to current ~master I've tried to checkout several recent tagged versions - doesn't work too. Probably it's applicable only to some particular LDC version. What version of ldc should I checkout to apply this patch? (Building LDC on Windows)
Jan 26 2016
prev sibling next sibling parent reply Mergul <wismerchil interia.eu> writes:
On Sunday, 24 January 2016 at 15:12:30 UTC, Joakim wrote:
 An alpha release of ldc, the llvm-based D compiler, for Android 
 devices is now available.  It is best used with the excellent 
 Termux app 
 (https://play.google.com/store/apps/details?id=com.termux&hl=en) and a
bluetooth keyboard. ;) Updated test runners, that run most tests from the
standard library on any Android device, are also available (results have been
reported for everything from a TomTom BRIDGE GPS navigation device to a Huawei
Watch):

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

 You can install a test runner app or run a command-line binary.
  Please report your results in this thread in the ldc forum, 
 which requires no registration, with the info and format 
 requested there, particularly for Android 4.1 or earlier:

 https://forum.dlang.org/thread/bafrkjfwmoyriyhmqizl forum.dlang.org

 If you try out the native compiler, take a look at the README 
 that comes with it for instructions.

 If you have a D/OpenGL app you'd like to port to Android and 
 submit to the Play Store, let me know if I can help with that 
 process.
I'm trying to build native-activity sample in .d. I have build cross ldc compiler using your instructions. When I have build native activity its work properly on BlueStack, but on my phone (android 4.2.1) this always crash and run again. Your app test runner work perfect and every test passed. Application always crash when I'm using android_app.savedState. if (state.savedState != null) { // We are starting with a previous saved state; restore from it. engine.state = *cast(saved_state*)state.savedState; //crash! } Sorry for bad english.
Oct 29 2016
next sibling parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 30/10/2016 10:47 AM, Mergul wrote:
 On Sunday, 24 January 2016 at 15:12:30 UTC, Joakim wrote:
 An alpha release of ldc, the llvm-based D compiler, for Android
 devices is now available.  It is best used with the excellent Termux
 app (https://play.google.com/store/apps/details?id=com.termux&hl=en)
 and a bluetooth keyboard. ;) Updated test runners, that run most tests
 from the standard library on any Android device, are also available
 (results have been reported for everything from a TomTom BRIDGE GPS
 navigation device to a Huawei Watch):

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

 You can install a test runner app or run a command-line binary.
  Please report your results in this thread in the ldc forum, which
 requires no registration, with the info and format requested there,
 particularly for Android 4.1 or earlier:

 https://forum.dlang.org/thread/bafrkjfwmoyriyhmqizl forum.dlang.org

 If you try out the native compiler, take a look at the README that
 comes with it for instructions.

 If you have a D/OpenGL app you'd like to port to Android and submit to
 the Play Store, let me know if I can help with that process.
I'm trying to build native-activity sample in .d. I have build cross ldc compiler using your instructions. When I have build native activity its work properly on BlueStack, but on my phone (android 4.2.1) this always crash and run again. Your app test runner work perfect and every test passed. Application always crash when I'm using android_app.savedState. if (state.savedState != null) { // We are starting with a previous saved state; restore from it. engine.state = *cast(saved_state*)state.savedState; //crash! } Sorry for bad english.
Don't compare against null using =, compare using is. if (state.savedState !is null) {
Oct 29 2016
parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On 10/29/16 8:55 PM, rikki cattermole wrote:
 On 30/10/2016 10:47 AM, Mergul wrote:
 Application always crash when I'm using android_app.savedState.

 if (state.savedState != null) {
     // We are starting with a previous saved state; restore from it.
     engine.state = *cast(saved_state*)state.savedState; //crash!
 }
Don't compare against null using =, compare using is. if (state.savedState !is null) {
android_app.savedState appears to be defined here: https://github.com/joakim-noah/android/blob/polish/android_native_app_glue.d#L56 It's a void *. So comparing against null with != is identical to !is. There are actually cases where comparing against null with != is valid, and what you want exactly (e.g. comparing a string to null to check for empty string). In this case, fixing the comparison is not the answer. What is happening is one of several things: 1. I don't know what type `engine` is, so if it's a pointer, then dereferencing the state member may be the culprit if engine is invalid. 2. If state is a pointer, then you could be crashing at the if statement (unlikely). 3. state or state.savedState isn't being properly initialized. 4. Something else (e.g. code generation error). Hope it's not this one. -Steve
Nov 01 2016
parent Dawid Masiukiewicz <wismerchil interia.eu> writes:
On Tuesday, 1 November 2016 at 13:33:02 UTC, Steven Schveighoffer 
wrote:
 android_app.savedState appears to be defined here:

 https://github.com/joakim-noah/android/blob/polish/android_native_app_glue.d#L56

 It's a void *. So comparing against null with != is identical 
 to !is.

 There are actually cases where comparing against null with != 
 is valid, and what you want exactly (e.g. comparing a string to 
 null to check for empty string).

 In this case, fixing the comparison is not the answer. What is 
 happening is one of several things:

 1. I don't know what type `engine` is, so if it's a pointer, 
 then dereferencing the state member may be the culprit if 
 engine is invalid.
 2. If state is a pointer, then you could be crashing at the if 
 statement (unlikely).
 3. state or state.savedState isn't being properly initialized.
 4. Something else (e.g. code generation error). Hope it's not 
 this one.

 -Steve
I don't know what was bad but I start working on something different. I managed to compile project with SDL. Using SDL c++ code which call my D code. It's work. Used libraries: SDL, Assimp, FreeImage. http://imgur.com/a/aMs15
Nov 02 2016
prev sibling parent Joakim <dlang joakim.fea.st> writes:
On Saturday, 29 October 2016 at 21:47:35 UTC, Mergul wrote:
 On Sunday, 24 January 2016 at 15:12:30 UTC, Joakim wrote:
 An alpha release of ldc, the llvm-based D compiler, for 
 Android devices is now available.  It is best used with the 
 excellent Termux app 
 (https://play.google.com/store/apps/details?id=com.termux&hl=en) and a
bluetooth keyboard. ;) Updated test runners, that run most tests from the
standard library on any Android device, are also available (results have been
reported for everything from a TomTom BRIDGE GPS navigation device to a Huawei
Watch):

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

 You can install a test runner app or run a command-line binary.
  Please report your results in this thread in the ldc forum, 
 which requires no registration, with the info and format 
 requested there, particularly for Android 4.1 or earlier:

 https://forum.dlang.org/thread/bafrkjfwmoyriyhmqizl forum.dlang.org

 If you try out the native compiler, take a look at the README 
 that comes with it for instructions.

 If you have a D/OpenGL app you'd like to port to Android and 
 submit to the Play Store, let me know if I can help with that 
 process.
I'm trying to build native-activity sample in .d. I have build cross ldc compiler using your instructions. When I have build native activity its work properly on BlueStack, but on my phone (android 4.2.1) this always crash and run again. Your app test runner work perfect and every test passed. Application always crash when I'm using android_app.savedState. if (state.savedState != null) { // We are starting with a previous saved state; restore from it. engine.state = *cast(saved_state*)state.savedState; //crash! } Sorry for bad english.
Hmm, I am unable to reproduce the crash with that sample app on my tablet running Marshmallow. Can you try the prebuilt cross-compilers at https://github.com/joakim-noah/android/releases and see if the problem crops up with those too? If you are able to reproduce consistently with some compiler, please file an issue with more info, such as which ldc version you built and what commands you used to build the app, either at the github repo for the sample app, https://github.com/joakim-noah/android/, or if you can reproduce with the pre-built ldc compilers, at the ldc github, https://github.com/ldc-developers/ldc/.
Nov 02 2016
prev sibling parent Daniel9 <andreikovalsa mail.ru> writes:
On Sunday, 24 January 2016 at 15:12:30 UTC, Joakim wrote:
 An alpha release of ldc, the llvm-based D compiler, for Android 
 devices is now available.  It is best used with the excellent 
 Termux app 
 (https://play.google.com/store/apps/details?id=com.termux&hl=en) and a
bluetooth keyboard. ;) Updated test runners, that run most tests from the
standard library on any Android device, are also available (results have been
reported for everything from a TomTom BRIDGE GPS navigation device to a Huawei
Watch):

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

 You can install a test runner app or run a command-line binary.
  Please report your results in this thread in the ldc forum, 
 which requires no registration, with the info and format 
 requested there, particularly for Android 4.1 or earlier:

 https://forum.dlang.org/thread/bafrkjfwmoyriyhmqizl forum.dlang.org

 If you try out the native compiler, take a look at the README 
 that comes with it for instructions.

 If you have a D/OpenGL app you'd like to port to Android and 
 submit to the Play Store, let me know if I can help with that 
 process.
great, thanks))
Nov 01 2016