Android 1.1.0 beta

@joakim-noah joakim-noah released this Dec 11, 2016

Two versions of ldc 1.1.0, the first a native compiler for use on Android/ARM devices and the second a cross-compiler from linux/x64, are available below. If you'd like to try compiling using these ldc builds or building the ldc cross-compiler from source yourself, follow these instructions from the wiki.

Source:

Patches to ldc are available as gists, applied against the master branch.

llvm: small modifications to turn off TLS and add different linker relocations.

ldc cross/native: While the cross-compiler patch looks huge, it mostly consists of Kai and kinke's PR to cross-compile to 64-bit reals, updated to HEAD. The native patch uses Android's builtin math functions, allows ldmd to accept a longer command-line, and works around the lack of std::to_string on Android. Other than that, both patches define the appropriate C and linker flags for the NDK or native toolchain and add two test-runner targets to CMake.

druntime cross/native: Both patches enable checking if fibers are migrated between threads, swap GC signals to work around an issue with running in an apk, turn off two passing test blocks because they cause problems for subsequent tests, revert a recent upstream change in the way module info is passed from the compiler, and change the test runner to run once and read in the names of all modules to be tested from test.list. The native patch changes GC signals using Ilya's upstream PR instead and doesn't bother avoiding a math function that isn't in older Android.

phobos cross/native: Both patches allow some tests to fail on older versions of Android, set the full path of the app's local folder in std.file.tempDir() (as there is no /tmp or any other global temporary folder in Android), and work around two issues in older versions of Android. The cross-compiler patch also swaps memalign for posix_memalign and replaces two math functions, as they weren't in older Android, but I didn't bother adding those workarounds to the native patch.

android app: modifies a sample D/OpenGL app from this repo to invoke the test runner from druntime.

Downloads

Android 1.0.0 beta

@joakim-noah joakim-noah released this Mar 8, 2016 · 4 commits to master since this release

Ldc cross-compilers, for either a linux/x86 or linux/x64 host to an Android/ARM target, and native Android/ARM compilers are available below. If you'd like to try cross-compiling using these ldc builds or building the ldc cross-compiler from source yourself, follow these instructions from the wiki.

Source:

Patches to ldc are available as gists, applied against the release-1.0.0 branch.

llvm: small modifications to turn off TLS and add different linker relocations.

ldc: While this looks like a large patch, the vast majority consists of Kai and kinke's in-progress work to cross-compile to 64-bit reals. Other than that, it updates the C floating-point ABI for ARM, defines the appropriate C and linker flags for the NDK, and adds two test-runner targets to CMake.

druntime: swaps GC signals to work around an issue with running in an apk, turns off two passing test blocks because they cause problems for subsequent tests, reverts a recent upstream change in the way module info is passed from the compiler, and changes the test runner to run once and read in the names of all modules to be tested from test.list.

phobos: allows some tests to fail on older versions of Android, fixes an off-by-one bug in std.conv, swaps memalign for posix_memalign as it wasn't in older Android, sets the full path of the app's local folder in std.file.tempDir() (as there is no /tmp or any other global temporary folder in Android), replaces two math functions for older Android, and works around two issues in older versions of Android.

android app: modifies the sample D/OpenGL app from this repo to invoke the test runner from druntime.

Downloads

Android test runners and compilers

@joakim-noah joakim-noah released this Jan 16, 2016 · 8 commits to master since this release

Two test runners derived from D 2.068.2 are provided below, an Android app, test-runner.apk, and a command-line binary, test-runner (available in zip or xz compressed format), along with a list of tests to run, test.list, which can be modified to remove certain tests if they hang. Ldc cross-compilers, for either a linux/x86 or linux/x64 host to an Android/ARM target, and a native Android/ARM compiler are also available.

Please run the tests and report your results in this thread in the ldc forum.

An ARMv7 device or newer is required, the runner won't work with much older ARMv5 and ARMv6 devices. Android 2.3 Gingerbread or above is required, though these tests haven't been run on any Android older than 4.1 Jelly Bean.

If you'd like to try cross-compiling using the ldc builds for linux provided below or building the ldc cross-compiler and test runner from source yourself, follow these instructions from the wiki using the patches linked below.

Instructions:

The test apk is an Android app, so it's the recommended test runner. However, it requires installing this app from outside the official Play Store and doesn't provide info about skipped tests or other issues, so if you don't like either, you can try the command-line runner.

Note: The apk will append test output to a file named /sdcard/test.log, so if you happen to have a file with that name already, move it before running these tests.
  • Running the apk

  1. Download test-runner.apk and test.list from below to your Android device.
  2. Move test.list to the /sdcard/ directory, which is where the apk will look for it.
  3. Go to Settings->Security and allow installation of apps from unknown sources.
  4. Open your Android file manager, navigate to where you saved the apk, and install it.
  5. Go to your installed apps and run the app named NativeActivity.
  6. After starting the app, the screen will stay dark for 30 seconds to a minute while the tests run, after which you should try touching the screen. If you get a message asking if you want to close the app before a minute is up, hit Wait.
  7. If the screen starts flashing a bunch of colors after a touch, that means all the tests ran. If it stays dark, that means some test likely hung. You might want to wait a little longer and if it doesn't respond to a touch after a longer wait either, the app likely hung so you can close it.
  8. Check the file /sdcard/test.log to see which tests ran and which passed or failed. All the tests should pass and the last module that passes should be std.internal.cstring.
  9. If the app hung, you can find the last test that ran in test.log. Try removing the test after that from test.list, run the apk again, and see if it makes a difference. You can also turn on USB debugging and use adb logcat to see the test results as the app runs, or a stack trace if it crashed.
  • Running from the command-line

  1. Download test.list and either test-runner.zip or test-runner.tar.xz and decompress the latter to get a binary called test-runner. Move both to your Android device.
  2. Install a terminal or SSH server app. After starting the app, typing cd will take you to a directory where you can run command-line binaries.
  3. Copy test-runner and test.list to the same directory and invoke the runner with ./test-runner.
  4. All test output will be written to the screen, examine it for any skipped tests or failures. If the runner hangs, try removing that test from test.list and running again.

Source:

Patches to ldc are available as gists, applied against the master 2.068 branch of ldc. Some of it has been upstreamed already, the rest will be cleaned up and merged soon.

llvm: small modifications to turn off TLS and add different linker relocations.

ldc: While this looks like a large patch, the vast majority consists of Kai's changes for cross-compiling to 64-bit long doubles, which was all taken from these three commits from Kai's longdouble2 branch, with patches from Dan too. Other than that, it adds some predefined versions for Android, adjusts how structs are passed by value for ARM, brackets TLS symbols similarly to dmd, and adds two test-runner targets to CMake.

druntime: turns off three test blocks across two modules, adds fixes for Android/ARM and to run in an apk, modifies TLS support for Android/ARM, reverts manual allocation of exceptions because it interferes with the current codegen for emulated TLS, and changes the test runner to run once and read in the names of all modules to be tested from test.list.

phobos: allows some tests to fail on older versions of Android, adds support for reading Android's concatenated timezone data, disables a few test cases across two modules, backports an upstreamed patch to centralize where test files are created, sets the full path of the app's local folder in std.file.tempDir() (as there is no /tmp or any other global temporary folder in Android), adds some Android fixes, and works around two issues in older versions of Android.

android app: modifies the sample D/OpenGL app from this repo to invoke the test runner from druntime.

Downloads

Android test runner

@joakim-noah joakim-noah released this Aug 22, 2014 · 9 commits to master since this release

Two test runners derived from D 2.068.2 are provided below, an Android app, NativeActivity-debug.apk, and a command-line binary, test-runner, along with a list of tests to run, test.list, which can be modified to not run certain tests if they hang. Ldc cross-compilers, for either a linux/x86 or linux/x64 host to an Android/ARM target, are also available.

Please run the tests and report your results in this thread in the ldc forum.

An ARMv7 device or newer is required, the runner won't work with much older ARMv5 and ARMv6 devices. Android 2.3 Gingerbread or above is required, though these tests haven't been run on any Android older than 4.1 Jelly Bean.

If you'd like to try cross-compiling using the ldc builds for linux provided below or building the ldc cross-compiler and test runner from source yourself, follow these instructions from the wiki using the patches linked below.

Instructions:

The test apk is an Android app, so it's the recommended test runner. However, it requires installing this app from outside the official Play Store and doesn't provide info about skipped tests or other issues, so if you don't like either, you can try the command-line runner.

Note: The apk will append test output to a file named /sdcard/test.log, so if you happen to have a file with that name already, move it before running these tests.
  • Running the apk

  1. Download NativeActivity-debug.apk and test.list from below to your Android device.
  2. Go to Settings->Security and allow installation of apps from unknown sources.
  3. Open your Android file manager, navigate to where you saved the apk, and install it.
  4. Move test.list to the /sdcard/ directory, which is where the apk will look for it.
  5. Go to your installed apps and run the app named NativeActivity.
  6. After starting the app, the screen will stay dark for 30 seconds to a minute while the tests run, after which you should try touching the screen. If you get a message asking if you want to close the app before a minute is up, hit Wait.
  7. If the screen starts flashing a bunch of colors after a touch, that means all the tests ran. If it stays dark, that means some test likely hung. You might want to wait a little longer and if it doesn't respond to a touch after a longer wait either, the app likely hung so you can close it.
  8. Check the file /sdcard/test.log to see which tests ran and which passed or failed. All the tests should pass and the last module that passes should be std.internal.math.gammafunction.
  9. If the app hung, you can find the last test that ran in test.log. Try removing the test after that from test.list, run the apk again, and see if it makes a difference. You can also turn on USB debugging and use adb logcat to see the test results as the app runs, or a stack trace if it crashed.
  • Running from the command-line

  1. Download test-runner and test.list from below to your Android device.
  2. Install a terminal or SSH server app. After starting the app, typing cd will take you to a directory where you can run command-line binaries.
  3. Copy test-runner and test.list to the same directory and invoke the runner with ./test-runner.
  4. All test output will be written to the screen, examine it for any skipped tests or failures. If the runner hangs, try removing that test from test.list and running again.

Source:

Patches to ldc are available as gists, applied against the master 2.068 branch of ldc. Some of it has been upstreamed already, the rest will be cleaned up and merged soon.

llvm: small modifications to add different linker relocations and turn off TLS and one optimization.

ldc: While this looks like a large patch, the vast majority is support for cross-compiling to 64-bit long doubles, which was all taken from these three commits from Kai's longdouble2 branch, with patches from Dan too. Other than that, it adds some predefined versions for Android, adjusts how structs are passed by value for ARM, brackets TLS symbols similarly to dmd, and adds a test-runner target for CMake.

druntime: turns off a handful of tests in three modules, adds fixes for Android/ARM and to run in an apk, modifies TLS support for Android/ARM, and changes the test runner to run once and read all tests to be run from test.list.

phobos: allows some tests to fail on older versions of Android, adds support for reading Android's concatenated timezone data, disables a few mostly math-related tests across three modules, backports an upstreamed patch to centralize where test files are created, hacks in the full path of the app's local folder into std.file.getcwd() (as there is no /tmp or any other global temporary folder in Android), adds some Android fixes, and disables one new math function.

android app: modifies the sample D/OpenGL app from this repo to invoke the test runner from druntime.

Downloads

Pre-release

Android test runner apk

@joakim-noah joakim-noah released this Aug 22, 2014 · 9 commits to master since this release

This Android/ARM app will run most of the unit tests for druntime and phobos that are currently working. It requires Android 5 Lollipop, because druntime calls one function, dl_iterate_phdr, that is not in earlier versions of bionic/ARM.

Note: It will append the test output to a file named /sdcard/test.log, so if you happen to have a file with that name already, move it before running these tests.
Instructions:

Download NativeActivity-debug.apk below to your Android 5 device, then go to Settings->Security and allow installation of apps from unknown sources. Open your Android file manager, navigate to where you saved the apk, and install it. After starting the app, the screen will stay dark for 30 seconds to a minute, after which you should try touching the screen. If it starts flashing a bunch of colors after a touch, that means all tests ran. If it stays dark, that means some test likely hung: you might want to wait a little longer and close the app, if it doesn't respond to a touch after a longer wait either.

Check the file /sdcard/test.log to see which tests ran and which passed or failed. All modules' tests but std.datetime should pass and the last module's tests run should be std.socket. You can also turn on USB debugging and use adb logcat to see the test results as the app runs.

Source:

I've updated the patches as github gists for now, applied against the merge-2.067 branch of ldc. Some have been upstreamed already, the rest will be once it's cleaned up. I also had to write a couple small build scripts, mostly for linking, which I'll put online upon request, as those will soon be thrown out and ldc's cmake build system used instead.

llvm: small modifications to turn off TLS and add different linker relocations.

ldc: while it looks big, the vast majority is support for cross-compiling to 64-bit long doubles, which was all taken from these three commits from Kai's longdouble2 branch, with patches from Dan too.

druntime: much of this patch was upstreamed months ago. The rest is TLS support for Android/ARM, some ARM fixes, and a few patches necessary to run the tests as part of an Android app/apk, which means compiling as a shared library.

phobos: hacks in the full path of the app's local folder into modules that need to create a local file for testing (as there is no /tmp or any other global temporary folder in Android), adds some Android fixes that have largely been upstreamed, and disables a handful of math-related tests.

android app: modifies the sample D/OpenGL app from this repo to invoke the test runner from druntime.

Downloads