title: How to compile the Android runtime (ART) from source
body: <p>I am trying to compile the Android runtime using the Android NDK. First I cloned the repository and switched to the <code>marshmallow-cts-release</code> branch. Then when running <code>ndk-build</code> I get</p>
  
  <pre class="lang-sh prettyprint-override"><code>suici@HP-Pavilion-g7:~/art$ ndk-build
  Android NDK: Could not find application project directory !    
  Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.    
  /usr/local/src/android-sdk-linux_x86/ndk-bundle/build/core/build-local.mk:151: *** Android NDK: Aborting    .  Stop.
  suici@HP-Pavilion-g7:~/art$ 
  </code></pre>
  
  <p>How do I compile this ? Do I need the entire Android source tree ? Or am I doing something wrong ?</p>
  
  <p>The repository contains the <code>Android.mk</code> file. I am using elementary OS freya 64-bit (based on Ubuntu) on a HP Pavilion g7-2269wm. Latest SDK and NDK are installed.</p>
  
  <p>After freshly cloning the source for ART and compiling it by running the following.</p>
  
  <pre class="lang-sh prettyprint-override"><code>git clone https://android.googlesource.com/platform/art
  cd art
  git checkout marshmallow-cts-release
  export NDK_PROJECT_PATH=$PWD
  ndk-build APP_BUILD_SCRIPT=Android.mk
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>build/Android.common_path.mk:20: art/build/Android.common.mk: No such file or directory
  build/Android.oat.mk:24: art/build/Android.common_build.mk: No such file or directory
  build/Android.oat.mk:143: warning: overriding commands for target `/core.art'
  build/Android.oat.mk:143: warning: ignoring old commands for target `/core.art'
  build/Android.oat.mk:143: warning: overriding commands for target `/core-pic.art'
  build/Android.oat.mk:143: warning: ignoring old commands for target `/core-pic.art'
  build/Android.oat.mk:144: warning: overriding commands for target `/core-optimizing.art'
  build/Android.oat.mk:144: warning: ignoring old commands for target `/core-optimizing.art'
  build/Android.oat.mk:144: warning: overriding commands for target `/core-optimizing-pic.art'
  build/Android.oat.mk:144: warning: ignoring old commands for target `/core-optimizing-pic.art'
  build/Android.oat.mk:145: warning: overriding commands for target `/core-interpreter.art'
  build/Android.oat.mk:145: warning: ignoring old commands for target `/core-interpreter.art'
  build/Android.oat.mk:145: warning: overriding commands for target `/core-interpreter-pic.art'
  build/Android.oat.mk:145: warning: ignoring old commands for target `/core-interpreter-pic.art'
  build/Android.oat.mk:149: warning: overriding commands for target `/corevalgrind.art'
  build/Android.oat.mk:149: warning: ignoring old commands for target `/corevalgrind.art'
  build/Android.oat.mk:149: warning: overriding commands for target `/core-picvalgrind.art'
  build/Android.oat.mk:149: warning: ignoring old commands for target `/core-picvalgrind.art'
  build/Android.oat.mk:150: warning: overriding commands for target `/core-optimizingvalgrind.art'
  build/Android.oat.mk:150: warning: ignoring old commands for target `/core-optimizingvalgrind.art'
  build/Android.oat.mk:150: warning: overriding commands for target `/core-optimizing-picvalgrind.art'
  build/Android.oat.mk:150: warning: ignoring old commands for target `/core-optimizing-picvalgrind.art'
  build/Android.oat.mk:151: warning: overriding commands for target `/core-interpretervalgrind.art'
  build/Android.oat.mk:151: warning: ignoring old commands for target `/core-interpretervalgrind.art'
  build/Android.oat.mk:151: warning: overriding commands for target `/core-interpreter-picvalgrind.art'
  build/Android.oat.mk:151: warning: ignoring old commands for target `/core-interpreter-picvalgrind.art'
  build/Android.cpplint.mk:17: art/build/Android.common_build.mk: No such file or directory
  find: `art': No such file or directory
  runtime/Android.mk:19: art/build/Android.common_build.mk: No such file or directory
  compiler/Android.mk:19: art/build/Android.common_build.mk: No such file or directory
  dex2oat/Android.mk:19: art/build/Android.executable.mk: No such file or directory
  disassembler/Android.mk:19: art/build/Android.common_build.mk: No such file or directory
  oatdump/Android.mk:19: art/build/Android.executable.mk: No such file or directory
  imgdiag/Android.mk:19: art/build/Android.executable.mk: No such file or directory
  patchoat/Android.mk:19: art/build/Android.executable.mk: No such file or directory
  dalvikvm/Android.mk:19: art/build/Android.common.mk: No such file or directory
  dalvikvm/Android.mk:42: /usr/local/src/android-sdk-linux_x86/ndk-bundle/build/core/executable_prefer_symlink.mk: No such file or directory
  dalvikvm/Android.mk:72: /usr/local/src/android-sdk-linux_x86/ndk-bundle/build/core/build-host-executable.mk: No such file or directory
  dalvikvm/Android.mk:75: /usr/local/src/android-sdk-linux_x86/ndk-bundle/build/core/executable_prefer_symlink.mk: No such file or directory
  tools/Android.mk:25: /usr/local/src/android-sdk-linux_x86/ndk-bundle/build/core/base_rules.mk: No such file or directory
  tools/Android.mk:35: /usr/local/src/android-sdk-linux_x86/ndk-bundle/build/core/base_rules.mk: No such file or directory
  tools/dexfuzz/Android.mk:33: /usr/local/src/android-sdk-linux_x86/ndk-bundle/build/core/base_rules.mk: No such file or directory
  sigchainlib/Android.mk:19: art/build/Android.common_build.mk: No such file or directory
  Android NDK: Trying to define local module 'sigchain' in sigchainlib/Android.mk.    
  Android NDK: But this module was already defined by sigchainlib/Android.mk.    
  /usr/local/src/android-sdk-linux_x86/ndk-bundle/build/core/build-module.mk:34: *** Android NDK: Aborting.    .  Stop.
  </code></pre>
  
  <p>Output of <code>echo $NDK_PROJECT_PATH</code></p>
  
  <pre><code>/home/suici/AndroidRuntime/art
  </code></pre>
  
  <p>Output of <code>ls $PWD</code></p>
  
  <pre><code>Android.mk    cmdline   dex2oat       MODULE_LICENSE_APACHE2  patchoat     test
  build         compiler  disassembler  NOTICE                  runtime      tools
  CleanSpec.mk  dalvikvm  imgdiag       oatdump                 sigchainlib
  </code></pre>