Difference between revisions of "Build DMD for Android"

From D Wiki
Jump to: navigation, search
(First bit about building for Android/x86)
 
m (tweaks)
Line 1: Line 1:
This is a work in progress: I'm trying to get more people to pitch in to get D working on Android.  Almost all the druntime/phobos unit tests pass on Android/x86 and a sample C/OpenGLES 1.0 purely native app from the NDK has been ported to D.
+
This is a work in progress: Android/x86 is mostly done, going to work on Android/ARM next.  Almost all the druntime/phobos unit tests pass on Android/x86 and a sample C/OpenGLES 1.0 purely native app from the NDK has been ported to D.
  
 
==Prerequisites==
 
==Prerequisites==
Line 15: Line 15:
 
===To install Android/x86 in a VM===
 
===To install Android/x86 in a VM===
  
Download the Android-x86 iso and install as normal: it'll put you through a configuration process, but you can skip every step.  Go to Settings->Security and disable the Verify Apps option, or it'll ask you about that every time you install a test app.  Alt-F1 will take you to a root shell, which you'll want to do any time you're not using Android/x86 for a couple minutes or the screen will eventually go black and freeze up.  Alt-F7 takes you back to the normal GUI screen.
+
Download the Android-x86 iso and install as normal: it'll put you through a configuration process, but you can skip every step.  Go to Settings->Security and disable the Verify Apps option, or it'll ask you about that every time you install a test app.  Alt-F1 will take you to a root shell, which you'll want to do any time you're not using Android/x86 for a couple minutes or the screen will eventually go black and the VM will freeze up.  Alt-F7 takes you back to the normal GUI screen.
  
 
==Build D for Android/x86==
 
==Build D for Android/x86==

Revision as of 07:00, 17 August 2014

This is a work in progress: Android/x86 is mostly done, going to work on Android/ARM next. Almost all the druntime/phobos unit tests pass on Android/x86 and a sample C/OpenGLES 1.0 purely native app from the NDK has been ported to D.

Prerequisites

  • 32-bit linux/x86 host on which to build dmd
    • A virtual machine like VirtualBox/VMware will work fine, but you should have at least 512 MB of memory allocated and 1 GB of swap, particularly if building the phobos unit tests, and 10 GB of disk space.
  • C++ compiler and toolchain, to build dmd
  • dmd/druntime/phobos source
    • Get druntime and phobos from git, as they have Android-specific changes that are not in the release branches yet.
  • Android native toolchain, the 32-bit NDK and SDK
    • The "SDK Tools only" version of the SDK is enough, if you don't plan on using their IDE integration. I will only write about using the command-line tools.
  • Android/x86, whether a device or VM

To install Android/x86 in a VM

Download the Android-x86 iso and install as normal: it'll put you through a configuration process, but you can skip every step. Go to Settings->Security and disable the Verify Apps option, or it'll ask you about that every time you install a test app. Alt-F1 will take you to a root shell, which you'll want to do any time you're not using Android/x86 for a couple minutes or the screen will eventually go black and the VM will freeze up. Alt-F7 takes you back to the normal GUI screen.

Build D for Android/x86

Download the patch for DMD, apply it, and build normally:

git apply packed_tls_for_elf.patch
make -f posix.mak -j5

I'll stop writing now, coming back with how to build druntime/phobos and more later.