3

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
0

3 Answers 3

11

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

Sign up to request clarification or add additional context in comments.

3 Comments

Thakg you a lot! I just switched to tty2, killed the desktop environment and it compiles now! Yay
I am facing the same issue, but the error log is as below. ninja: no work to do. [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 error: external/cpuinfo/Android.bp:42:1: "libcpuinfo" depends on undefined module "libclog" ninja: build stopped: subcommand failed. 20:25:14 soong bootstrap failed with: exit status 1
Nice!!.....0000
3

For others who are running into this issue even after reducing the number or processes or physically adding RAM, increase swap space. I followed a "how-to" on DigitalOcean on how to do this without altering partitions:

https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-debian-11

Comments

1

If you want to build with less RAM(~16GB), you can increase the Swap memory. Make sure that you have a total of RAM + Swap memory of more than 32GB. Follow this link to increase Swap space after installation.

Also, increase the swappiness to closer to 100, so that the cache will be frequently moved to Swap, freeing RAM for processing. Of course, this will reduce the build speed because of the additional swap process(for frequently moving data between RAM and Swap), but it will keep the build alive.

sudo sysctl vm.swappiness=80

I have a hexa-core Ryzen 5 with 16GB RAM. With an additional swap, I was able to build with six threads(even though the CPU supports up to 12)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.