title: AOSP - Android 6 Marshmallow compilation - make: *** [run_soong] Error 126
body: <p>I've tried to compile Android 6 Marshmallow for my Sony Xperia Z1 Compact.
  I've done everything what was in:</p>
  
  <p><a href="http://developer.sonymobile.com/knowledge-base/open-source/open-devices/aosp-build-instructions/how-to-build-aosp-marshmallow-for-unlocked-xperia-devices/" rel="nofollow" title="How to build AOSP Marshmallow for unlocked Xperia devices">How to build AOSP Marshmallow for unlocked Xperia devices (developer.sonymobile.com)</a></p>
  
  <p>and checking out:</p>
  
  <p><a href="http://source.android.com/source/building.html" rel="nofollow" title="Android - Downloading and Building">Android - Downloading and Building (source.android.com)</a></p>
  
  <p>on virtual machine with newest Debian (32-bit), but when I was on</p>
  
  <blockquote>
    <p>To start the build, type: make –j &lt; insert the cpu thread number of
    your computer ></p>
  </blockquote>
  
  <p>I've received an error:</p>
  
  <pre><code>root@debian:~/android# make –j 8
  ============================================
  PLATFORM_VERSION_CODENAME=REL
  PLATFORM_VERSION=6.0.1
  TARGET_PRODUCT=aosp_d5503
  TARGET_BUILD_VARIANT=userdebug
  TARGET_BUILD_TYPE=release
  TARGET_BUILD_APPS=
  TARGET_ARCH=arm
  TARGET_ARCH_VARIANT=armv7-a-neon
  TARGET_CPU_VARIANT=krait
  TARGET_2ND_ARCH=
  TARGET_2ND_ARCH_VARIANT=
  TARGET_2ND_CPU_VARIANT=
  HOST_ARCH=x86
  HOST_2ND_ARCH=
  HOST_OS=linux
  HOST_OS_EXTRA=Linux-4.5.0-2-686-pae-i686-with-debian-stretch-sid
  HOST_CROSS_OS=windows
  HOST_CROSS_ARCH=x86
  HOST_CROSS_2ND_ARCH=x86_64
  HOST_BUILD_TYPE=release
  BUILD_ID=MASTER
  OUT_DIR=out
  ============================================
  out/soong/soong: line 43: prebuilts/build-tools/linux-x86/bin/ninja: cannot execute binary file: Exec format error
  build/core/soong.mk:87: recipe for target 'run_soong' failed
  make: *** [run_soong] Error 126
  
  #### make failed to build some targets (1 seconds) ####
  </code></pre>
  
  <p>Debug info:</p>
  
  <pre><code>root@debian:~/android# make -nd –j 8
  GNU Make 4.1
  Built for i586-pc-linux-gnu
  Copyright (C) 1988-2014 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.
  Reading makefiles...
  Reading makefile 'Makefile'...
  (...)
  Reading makefile 'build/core/dumpvar.mk' (search path) (no ~ expansion)...
  ============================================
  PLATFORM_VERSION_CODENAME=REL
  PLATFORM_VERSION=6.0.1
  TARGET_PRODUCT=aosp_d5503
  TARGET_BUILD_VARIANT=userdebug
  TARGET_BUILD_TYPE=release
  TARGET_BUILD_APPS=
  TARGET_ARCH=arm
  TARGET_ARCH_VARIANT=armv7-a-neon
  TARGET_CPU_VARIANT=krait
  TARGET_2ND_ARCH=
  TARGET_2ND_ARCH_VARIANT=
  TARGET_2ND_CPU_VARIANT=
  HOST_ARCH=x86
  HOST_2ND_ARCH=
  HOST_OS=linux
  HOST_OS_EXTRA=Linux-4.5.0-2-686-pae-i686-with-debian-stretch-sid
  HOST_CROSS_OS=windows
  HOST_CROSS_ARCH=x86
  HOST_CROSS_2ND_ARCH=x86_64
  HOST_BUILD_TYPE=release
  BUILD_ID=MASTER
  OUT_DIR=out
  ============================================
  Reading makefile 'build/core/ninja.mk' (search path) (no ~ expansion)...
  Reading makefile 'build/core/soong.mk' (search path) (no ~ expansion)...
  Reading makefile 'vendor/google/build/ninja_config.mk' (search path) (do not care) (no ~ expansion)...
  Updating makefiles....
   Considering target file 'vendor/google/build/ninja_config.mk'.
    File 'vendor/google/build/ninja_config.mk' does not exist.
    Looking for an implicit rule for 'vendor/google/build/ninja_config.mk'.
    No implicit rule found for 'vendor/google/build/ninja_config.mk'.
    Finished prerequisites of target file 'vendor/google/build/ninja_config.mk'.
   Must remake target 'vendor/google/build/ninja_config.mk'.
   Failed to remake target file 'vendor/google/build/ninja_config.mk'.
   Considering target file 'build/core/soong.mk'.
    Looking for an implicit rule for 'build/core/soong.mk'.
    No implicit rule found for 'build/core/soong.mk'.
    Finished prerequisites of target file 'build/core/soong.mk'.
   No need to remake target 'build/core/soong.mk'.
   Considering target file 'build/core/ninja.mk'.
    Looking for an implicit rule for 'build/core/ninja.mk'.
    No implicit rule found for 'build/core/ninja.mk'.
    Finished prerequisites of target file 'build/core/ninja.mk'.
   No need to remake target 'build/core/ninja.mk'.
   Considering target file 'build/core/dumpvar.mk'.
    Looking for an implicit rule for 'build/core/dumpvar.mk'.
    No implicit rule found for 'build/core/dumpvar.mk'.
    Finished prerequisites of target file 'build/core/dumpvar.mk'.
   (...)
   No need to remake target 'build/core/main.mk'.
   Considering target file 'Makefile'.
    Looking for an implicit rule for 'Makefile'.
    No implicit rule found for 'Makefile'.
    Finished prerequisites of target file 'Makefile'.
   No need to remake target 'Makefile'.
  Updating goal targets....
  Considering target file '–j'.
   File '–j' does not exist.
    Considering target file 'ninja_wrapper'.
     File 'ninja_wrapper' does not exist.
      Considering target file 'out/combined-aosp_d5503.ninja'.
       File 'out/combined-aosp_d5503.ninja' does not exist.
        Considering target file 'out/build-aosp_d5503.ninja'.
         File 'out/build-aosp_d5503.ninja' does not exist.
          Considering target file 'prebuilts/build-tools/linux-x86/bin/ckati'.
           Looking for an implicit rule for 'prebuilts/build-tools/linux-x86/bin/ckati'.
           No implicit rule found for 'prebuilts/build-tools/linux-x86/bin/ckati'.
           Finished prerequisites of target file 'prebuilts/build-tools/linux-x86/bin/ckati'.
          No need to remake target 'prebuilts/build-tools/linux-x86/bin/ckati'.
          Considering target file 'prebuilts/build-tools/linux-x86/bin/makeparallel'.
           Looking for an implicit rule for 'prebuilts/build-tools/linux-x86/bin/makeparallel'.
           No implicit rule found for 'prebuilts/build-tools/linux-x86/bin/makeparallel'.
           Finished prerequisites of target file 'prebuilts/build-tools/linux-x86/bin/makeparallel'.
          No need to remake target 'prebuilts/build-tools/linux-x86/bin/makeparallel'.
          Considering target file 'out/Android.mk'.
           Finished prerequisites of target file 'out/Android.mk'.
          No need to remake target 'out/Android.mk'.
          Considering target file 'out/CleanSpec.mk'.
           Finished prerequisites of target file 'out/CleanSpec.mk'.
          No need to remake target 'out/CleanSpec.mk'.
          Considering target file 'run_soong'.
           File 'run_soong' does not exist.
            Considering target file 'out/soong/.soong.bootstrap'.
              Considering target file 'bootstrap.bash'.
               Looking for an implicit rule for 'bootstrap.bash'.
               No implicit rule found for 'bootstrap.bash'.
               Finished prerequisites of target file 'bootstrap.bash'.
              No need to remake target 'bootstrap.bash'.
             Finished prerequisites of target file 'out/soong/.soong.bootstrap'.
             Prerequisite 'bootstrap.bash' is older than target 'out/soong/.soong.bootstrap'.
            No need to remake target 'out/soong/.soong.bootstrap'.
            Considering target file 'out/soong/soong.variables'.
              Considering target file 'FORCE'.
               File 'FORCE' does not exist.
               Finished prerequisites of target file 'FORCE'.
              Must remake target 'FORCE'.
              Successfully remade target file 'FORCE'.
             Finished prerequisites of target file 'out/soong/soong.variables'.
             Prerequisite 'FORCE' of target 'out/soong/soong.variables' does not exist.
            Must remake target 'out/soong/soong.variables'.
  mkdir -p out/soong/
  (\
  echo '{'; \
  echo '    "Make_suffix": "-aosp_d5503",'; \
  echo ''; \
  echo '    "Platform_sdk_version": 23,'; \
  echo '    "Unbundled_build": false,'; \
  echo '    "Brillo": false,'; \
  echo '    "Malloc_not_svelte": true,'; \
  echo '    "Allow_missing_dependencies": false,'; \
  echo '    "SanitizeHost": [],'; \
  echo '    "SanitizeDevice": [],'; \
  echo '    "HostStaticBinaries": false,'; \
  echo ''; \
  echo '    "DeviceName": "amami",'; \
  echo '    "DeviceArch": "arm",'; \
  echo '    "DeviceArchVariant": "armv7-a-neon",'; \
  echo '    "DeviceCpuVariant": "krait",'; \
  echo '    "DeviceAbi": ["armeabi-v7a", "armeabi"],'; \
  echo '    "DeviceUsesClang": true,'; \
  echo ''; \
  echo '    "DeviceSecondaryArch": "",'; \
  echo '    "DeviceSecondaryArchVariant": "",'; \
  echo '    "DeviceSecondaryCpuVariant": "",'; \
  echo '    "DeviceSecondaryAbi": ["", ""],'; \
  echo ''; \
  echo '    "HostArch": "x86",'; \
  echo '    "HostSecondaryArch": "",'; \
  echo ''; \
  echo '    "CrossHost": "windows",'; \
  echo '    "CrossHostArch": "x86",'; \
  echo '    "CrossHostSecondaryArch": "x86_64",'; \
  echo '    "Safestack": false'; \
  echo '}') &gt; out/soong/soong.variables.$$; \
  if ! cmp -s out/soong/soong.variables.$$ out/soong/soong.variables; then \
    mv out/soong/soong.variables.$$ out/soong/soong.variables; \
  else \
    rm out/soong/soong.variables.$$; \
  fi
            Successfully remade target file 'out/soong/soong.variables'.
            Considering target file 'out/soong/.soong.in_make'.
             Finished prerequisites of target file 'out/soong/.soong.in_make'.
            No need to remake target 'out/soong/.soong.in_make'.
            Pruning file 'FORCE'.
           Finished prerequisites of target file 'run_soong'.
          Must remake target 'run_soong'.
  out/soong/soong out/soong/build.ninja  -w dupbuild=err
          Successfully remade target file 'run_soong'.
          Pruning file 'FORCE'.
         Finished prerequisites of target file 'out/build-aosp_d5503.ninja'.
        Must remake target 'out/build-aosp_d5503.ninja'.
  echo Running kati to generate build-aosp_d5503.ninja...
  prebuilts/build-tools/linux-x86/bin/ckati --ninja --ninja_dir=out --ninja_suffix=-aosp_d5503 --regen --ignore_dirty=out/% --no_ignore_dirty=out/soong/Android-aosp_d5503.mk --no_ignore_dirty=out/soong/make_vars-aosp_d5503.mk --ignore_optional_include=out/%.P --detect_android_echo --use_find_emulator -f build/core/main.mk  --gen_all_targets BUILDING_WITH_NINJA=true SOONG_ANDROID_MK=out/soong/Android-aosp_d5503.mk SOONG_MAKEVARS_MK=out/soong/make_vars-aosp_d5503.mk
  Putting child 0x94b8a18 (out/build-aosp_d5503.ninja) PID 8221 on the chain.
  Live child 0x94b8a18 (out/build-aosp_d5503.ninja) PID 8221
  /bin/bash: prebuilts/build-tools/linux-x86/bin/ckati: cannot execute binary file: Exec format error
  Reaping losing child 0x94b8a18 PID 8221
  build/core/ninja.mk:161: recipe for target 'out/build-aosp_d5503.ninja' failed
  make: *** [out/build-aosp_d5503.ninja] Error 126
  Removing child 0x94b8a18 PID 8221 from chain.
  
  #### make failed to build some targets (1 seconds) ####
  </code></pre>
  
  <p>What should I do to compile this correctly?</p>