'####ninja: build stopped: subcommand failed

I tried to compile the Android source code according to the official documentation, but encountered a problem, the error log is as follows. who can help me

    [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
Killed
07:00:40 soong bootstrap failed with: exit status 1
ninja: build stopped: subcommand failed.

failed to build some targets (03:06:10 (hh:mm:ss))

errors description



Solution 1:[1]

You were building on a very low ram machine, so most likely your building process was killed because of OOM occured. You can run dmesg to see if you got any Out of memory: kill process <your compile pid> log to check if that is the reason or not.

If OOM is the cause, I think the only way is to increase the swap size and change make -j4 to make -j1.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 glzlaohuai