Andorid编译 :ninja: build stopped: subcommand failed.怎么解决

在使用:make -j4 otapackage对Android 7 进行编译的时候出错,球解决方法,下面是出错的log
LD drivers/amlogic/deinterlace/built-in.o
CC drivers/amlogic/tvin/bt656/bt656_601_in.o
In file included from /data/Amlogic/WORKING_DIRECTOR/common/drivers/amlogic/tvin/bt656/bt656_601_in.c:45:0:
/data/Amlogic/WORKING_DIRECTOR/common/drivers/amlogic/tvin/bt656/bt656_601_in.c: In function ‘reg_store’:
/data/Amlogic/WORKING_DIRECTOR/common/drivers/amlogic/tvin/bt656/bt656_601_in.h:266:9: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
return val;
^
/data/Amlogic/WORKING_DIRECTOR/common/drivers/amlogic/tvin/bt656/bt656_601_in.h:263:6: note: ‘val’ was declared here
int val;
^
/data/Amlogic/WORKING_DIRECTOR/common/drivers/amlogic/tvin/bt656/bt656_601_in.h:266:9: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
return val;
^
/data/Amlogic/WORKING_DIRECTOR/common/drivers/amlogic/tvin/bt656/bt656_601_in.h:263:6: note: ‘val’ was declared here
int val;
^
/data/Amlogic/WORKING_DIRECTOR/common/drivers/amlogic/tvin/bt656/bt656_601_in.h:266:9: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
return val;
^
/data/Amlogic/WORKING_DIRECTOR/common/drivers/amlogic/tvin/bt656/bt656_601_in.h:263:6: note: ‘val’ was declared here
int val;
^
/data/Amlogic/WORKING_DIRECTOR/common/drivers/amlogic/tvin/bt656/bt656_601_in.c: In function ‘am656in_isr’:
/data/Amlogic/WORKING_DIRECTOR/common/drivers/amlogic/tvin/bt656/bt656_601_in.h:266:9: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
return val;
^
/data/Amlogic/WORKING_DIRECTOR/common/drivers/amlogic/tvin/bt656/bt656_601_in.h:263:6: note: ‘val’ was declared here
int val;
^
cc1: all warnings being treated as errors
/data/Amlogic/WORKING_DIRECTOR/common/scripts/Makefile.build:308: recipe for target ‘drivers/amlogic/tvin/bt656/bt656_601_in.o’ failed
make[5]: *** [drivers/amlogic/tvin/bt656/bt656_601_in.o] Error 1
/data/Amlogic/WORKING_DIRECTOR/common/scripts/Makefile.build:455: recipe for target ‘drivers/amlogic/tvin/bt656’ failed
make[4]: *** [drivers/amlogic/tvin/bt656] Error 2
/data/Amlogic/WORKING_DIRECTOR/common/scripts/Makefile.build:455: recipe for target ‘drivers/amlogic/tvin’ failed
make[3]: *** [drivers/amlogic/tvin] Error 2
/data/Amlogic/WORKING_DIRECTOR/common/scripts/Makefile.build:455: recipe for target ‘drivers/amlogic’ failed
make[2]: *** [drivers/amlogic] Error 2
/data/Amlogic/WORKING_DIRECTOR/common/Makefile:857: recipe for target ‘drivers’ failed
make[1]: *** [drivers] Error 2
make[1]: *** 正在等待未完成的任务…
Makefile:133: recipe for target ‘sub-make’ failed
make: *** [sub-make] Error 2
make: Leaving directory ‘/data/Amlogic/WORKING_DIRECTOR/common’
[ 1% 276/27033] build out/target/common/obj/JAVA_LIBRARIES/sdk_v15_intermediates/classes.jack

[ 1% 276/27033] Docs droiddoc: out/target/common/docs/api-stubs
DroidDoc took 26 sec. to write docs to out/target/common/docs/api-stubs
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target ‘ninja_wrapper’ failed
make: *** [ninja_wrapper] Error 1

make failed to build some targets (03:35 (mm:ss))

我的环境是ubuntu 16.04操作系统

首先确认一下,你那边编译环境搭建了没有?

我使用的编译器是gcc-linaro-5.5.0-2017.10-x86_64_aarch64-linux-gnu,不是4.9还不行了,环境不一样的地方就这样个,不然会报其他错误,我换成4.9 试试

gcc版本越高,规则检查就越严格,应该是这个问题引起的

[ 81% 23647/29042] Copy xml: out/target/product/kvim/system/etc/fonts.xml
FAILED: /bin/bash -c “(xmllint frameworks/base/data/fonts/fonts.xml >/dev/null ) && (mkdir -p out/target/product/kvim/system/etc/ ) && (out/host/linux-x86/bin/acp -fp frameworks/base/data/fonts/fonts.xml out/target/product/kvim/system/etc/fonts.xml )”
/bin/bash: xmllint: 未找到命令
[ 81% 23647/29042] target Package: Settings (out/target/product/kvim/obj/APPS/Settings_intermediates/package.apk)
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xxhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xxhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xxhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xxhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xxhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xxhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xxhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xxhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xxhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xxhdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c hdpi-v4. Use --preferred-density instead.
warning: ignoring flag -c xhdpi-v4. Use --preferred-density instead.
nothing matches overlay file suw_navbar_ic_back.xml, for flavor anydpi-v21
nothing matches overlay file suw_navbar_ic_more.xml, for flavor anydpi-v21
nothing matches overlay file suw_navbar_ic_next.xml, for flavor anydpi-v21
nothing matches overlay file suw_progress_bar.xml, for flavor v21
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target ‘ninja_wrapper’ failed
make: *** [ninja_wrapper] Error 1

make failed to build some targets (47:18 (mm:ss))

编译了81%diy还是出现了类似的问题,
Copy xml: out/target/product/kvim/system/etc/fonts.xml
失败

只能搜索安装: sudo apt-get install libxml2-utils
不知道能不能解决

这样就编译成功了,也真是的,编译时间太长了

Hallo @Terry,

I tried to build the source code of the Nougata and I got the error below:

make: Leaving directory /home/doelmann/AOSP_7/out/target/product/kvim/obj/KERNEL_OBJ' make wifi module KERNEL_ARCH is arm64 make -C /home/doelmann/AOSP_7/out/target/product/kvim/obj/KERNEL_OBJ M=/home/doelmann/AOSP_7/hardware/wifi/broadcom/drivers/ap6xxx/bcmdhd.1.363.59.144.x.cn ARCH=arm64 CROSS_COMPILE=/opt/toolchains/gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux/bin/aarch64-linux-gnu- CONFIG_DHD_USE_STATIC_BUF=y modules make[1]: Entering directory /home/doelmann/AOSP_7/out/target/product/kvim/obj/KERNEL_OBJ’
KBUILD_CFLAGS_MODULE:-DMODULE
bcm SDIO driver configured
Building modules, stage 2.
bcm SDIO driver configured
MODPOST 1 modules
make[1]: Leaving directory /home/doelmann/AOSP_7/out/target/product/kvim/obj/KERNEL_OBJ' cp /home/doelmann/AOSP_7/hardware/wifi/broadcom/drivers/ap6xxx/bcmdhd.1.363.59.144.x.cn/dhd.ko out/target/product/kvim/system/lib/ cp /home/doelmann/AOSP_7/out/target/product/kvim/obj/KERNEL_OBJ/net/wireless/cfg80211.ko out/target/product/kvim/system/lib/ cp /home/doelmann/AOSP_7/out/target/product/kvim/obj/KERNEL_OBJ/net/mac80211/mac80211.ko out/target/product/kvim/system/lib/ make -C /home/doelmann/AOSP_7/out/target/product/kvim/obj/KERNEL_OBJ M=/home/doelmann/AOSP_7/hardware/wifi/broadcom/drivers/ap6xxx/bcmdhd-usb.1.201.88.27.x ARCH=arm64 CROSS_COMPILE=/opt/toolchains/gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux/bin/aarch64-linux-gnu- modules make[1]: Entering directory /home/doelmann/AOSP_7/out/target/product/kvim/obj/KERNEL_OBJ’
KBUILD_CFLAGS_MODULE:-DMODULE
Building modules, stage 2.
MODPOST 1 modules
make[1]: Leaving directory `/home/doelmann/AOSP_7/out/target/product/kvim/obj/KERNEL_OBJ’
cp /home/doelmann/AOSP_7/hardware/wifi/broadcom/drivers/ap6xxx/bcmdhd-usb.1.201.88.27.x/bcmdhd.ko out/target/product/kvim/system/lib/
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1

make failed to build some targets (02:34 (mm:ss))

Thank you very much for your support.