Need help with setting up LDC to cross-compile to Android/ARM

Joakim dlang at joakim.fea.st
Sat Oct 20 09:51:28 UTC 2018


On Friday, 19 October 2018 at 22:19:31 UTC, H. S. Teoh wrote:
> On Fri, Oct 19, 2018 at 02:41:48PM -0700, H. S. Teoh via 
> Digitalmars-d wrote: [...]
>> In the meantime, is there a particular version of the NDK that 
>> I should use?  Currently I have 
>> android-ndk-r13b-linux-x86_64.zip installed.  Will it work?
> [...]
>
> Haha, I feel so silly now.  NDK r13b does not seem to have the 
> sysroot subdir required by the clang build command, that's why 
> it couldn't find the system headers.  So I ditched r13b and 
> installed r17b instead, and now I can build the runtime 
> successfully!

Ah, that makes sense, that NDK is ancient, ;) it came out two 
years ago:

https://developer.android.com/ndk/downloads/revision_history

Official D support for Android was added to ldc 1.4 last 
September, which was after NDK r15c came out, when they switched 
to that sysroot directory with unified headers for all Android 
versions, so that's what ldc uses. Before that, each Android 
version had its headers in a separate directory, which isn't 
supported by LDC.

> I tried ldc-build-runtime with --ninja and it
> came back with a bunch of errors about "cortex-a8"
> being an unsupported target, and then segfaulted.

That's likely because you left off the double-quotes around the 
list of semicolon-separated flags passed to ldc-build-runtime 
--dFlags: the double quotes are required, as shown in the docs.

On Saturday, 20 October 2018 at 04:01:37 UTC, H. S. Teoh wrote:
> On Fri, Oct 19, 2018 at 08:50:36PM +0000, Joakim via 
> Digitalmars-d wrote:
>> On Wednesday, 17 October 2018 at 21:23:21 UTC, H. S. Teoh 
>> wrote:
>> > I'm trying to follow the instructions on this page:
>> > 
>> > 	https://wiki.dlang.org/Build_D_for_Android
> [...]
>
> On a side note, the last section on that page mentions not 
> knowing how to create a keystore from scratch; actually, it's 
> very simple with the `keytool` utility that comes with the 
> Oracle JRE.  I added the steps on the talk page.  The only 
> thing I'm unsure about is whether keytool is available natively 
> on Android.  If not, then you'll have to generate the keystore 
> on a PC and copy it over to Android afterwards.

 From scratch meaning without using keytool, ie OpenSSL or some 
other hashing/fingerprinting tool alone, because keytool isn't 
available in the Termux app. As mentioned at the end of the wiki 
page, I used to manually edit the apk hashed manifests using 
OpenSSL alone until that apksigner tool was added later.


More information about the Digitalmars-d mailing list