Search code examples
androidbuildcompiler-errors

Android Opensource Project build error `FAILED: out/soong/build.ninja`


I became interested in the Android's source code. I precisely repeated all the steps from the official guide source.android.com to compile it.

I tried to compile it and I got:

... error while loading shared libraries: libncurses.so.5: cannot open shared
object file: No such file or directory

To fix it:

Arch: Enable multilib,sudo pacman -S lib32-ncurses

Ubuntu: sudo apt install libncurses5:i386


Then i tried to compile again

Next time i got no errors messages except exit status 1

[100% 1/1] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
FAILED: out/soong/build.ninja
out/soong/.bootstrap/bin/soong_build -t -l out/.module_paths/Android.bp.list -b 
out/soong -n out -d out/soong/build.ninja.d -globFile out/soong/.bootstrap/build
-globs.ninja -o out/soong/build.ninja Android.bp
21:03:08 soong bootstrap failed with: exit status 1

#### failed to build some targets (24:14 (mm:ss)) ####

When there are no error messages, I can't guess what's the matter

But i know, what:

  • This error is independent of linux distribution
  • Deleting and downloading all sources again cannot fix this error
  • Before I get this error, my computer freezes

Solution

  • It seems that your ninja process is getting killed. That's probably because it tries to use too much RAM: we currently allow ~3.5GB RAM per workspace, so the Linux OOM-killer will kill any process that makes your workspace use more than that.

    In order to use less RAM, could you please try building with fewer processes? E.g. with:

    $ make -j2 aapt