[Build android source code fail] recipe for target 'ninja_wrapper' failed


I was tried to build android source following this guide:
I’ve made full set up before building but still got error:
build/core/ninja.mk:148: recipe for target ‘ninja_wrapper’ failed
I attached log and ninja.mk file.
Please help me to resolve this issue.
Thank you!

You need to build U-Boot before building android.
You can following this to build android for VIM2.

Build U-Boot

$ cd ~/project/khadas/nougat/uboot
$ make CROSS_COMPILE=aarch64-linux-gnu- kvim2_defconfig
$ make CROSS_COMPILE=aarch64-linux-gnu-

Build Android:

$ cd ~/project/khadas/nougat
$ source build/envsetup.sh
$ lunch kvim2-userdebug-64
$ make -jN otapackage

Hi Terry,

It’s my mistake when cd wrong destination folder. But,
I’ve already built uboot before building android source code according this guidance: http://docs.khadas.com/develop/BuildAndroid/
There is no problem when buiding uboot. But, i got an NEW another error when buiding source code.
I Attached log for uboot build:
Log for build source code:
So, help me to check this issue plz! Thank you!

Did you Establish a Build Environment for your host PC?
Can you also provide the information about PATH environment for me?

terry@Server:~$  echo $PATH

Hi Terry,

Before building android source code, i’ve already setup all requirements but i don’t remember is there any error, isn’t?
This is PATH environment info:
mike@mike-VirtualBox:~$ echo $PATH

Maybe you forgot to install some tools.You can try to check the exist of m4 exec and install it.

terry@terry:~$ m4 --help
terry@terry:~$ sudo apt-get install m4


I’ve got new exception: fatal: fork: Cannot allocate memory
Here is log: http://textuploader.com/dlxkw
How can i fix it?

What’s the size of your memory? Maybe it is too small.