记录android8.1编译过程中的问题
问题:
OUT_DIR=out
============================================
[2/2] bootstrap out/soong/.minibootstrap/build.ninja.in
[1/1] out/soong/.bootstrap/bin/minibp out/soong/.bootstrap/build.ninja
[1/1] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
No need to regenerate ninja file
[100% 2/2] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
[ 50% 1/2] glob art
[ 0% 6/8284] //system/tools/aidl:libaidl-common lex aidl_language_l.ll [linux]
FAILED: out/soong/.intermediates/system/tools/aidl/libaidl-common/linux_x86_64_static/gen/lex/system/tools/aidl/aidl_language_l.cpp
prebuilts/misc/linux-x86/flex/flex-2.5.39 -oout/soong/.intermediates/system/tools/aidl/libaidl-common/linux_x86_64_static/gen/lex/system/tools/aidl/aidl_language_l.cpp system/tools/aidl/aidl_language_l.ll
flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
Aborted (core dumped)
[ 0% 13/8284] build out/target/product/d38_sdm450/obj/kernel/msm-3.18/usr
make: Entering directory '/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18'
make[1]: Entering directory '/home/persist/disk2/skye-android/36AT/D38/out/target/product/d38_sdm450/obj/kernel/msm-3.18'
/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18/arch/arm64/Makefile:130: warning: overriding recipe for target 'vdso_prepare'
/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18/arch/arm64/Makefile:120: warning: ignoring old recipe for target 'vdso_prepare'
GEN ./Makefile
configuration written to .config
make[1]: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/out/target/product/d38_sdm450/obj/kernel/msm-3.18'
make: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18'
make: Entering directory '/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18'
make[1]: Entering directory '/home/persist/disk2/skye-android/36AT/D38/out/target/product/d38_sdm450/obj/kernel/msm-3.18'
/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18/arch/arm64/Makefile:130: warning: overriding recipe for target 'vdso_prepare'
/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18/arch/arm64/Makefile:120: warning: ignoring old recipe for target 'vdso_prepare'
CHK include/generated/uapi/linux/version.h
make[1]: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/out/target/product/d38_sdm450/obj/kernel/msm-3.18'
make: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18'
ninja: build stopped: subcommand failed.
02:22:14 ninja failed with: exit status 1
failed to build some targets (53 seconds)
`
解决方法:
export LC_ALL=C
在很多的shell脚本中,我们经常会看见某一句命令的前面有一句“LC_ALL=C”
SAR_CMD="LC_ALL=C sar -u -b 1 5 | grep -i average "
这到底是什么意思?
LC_ALL=C 是为了去除所有本地化的设置,让命令能正确执行
转贴:https://blog.51cto.com/potato80s/1439058
`#
configuration written to .config
make[1]: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/out/target/product/d38_sdm450/obj/kernel/msm-3.18'
make: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18'
make: Entering directory '/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18'
make[1]: Entering directory '/home/persist/disk2/skye-android/36AT/D38/out/target/product/d38_sdm450/obj/kernel/msm-3.18'
/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18/arch/arm64/Makefile:130: warning: overriding recipe for target 'vdso_prepare'
/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18/arch/arm64/Makefile:120: warning: ignoring old recipe for target 'vdso_prepare'
CHK include/generated/uapi/linux/version.h
make[1]: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/out/target/product/d38_sdm450/obj/kernel/msm-3.18'
make: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18'
ninja: build stopped: subcommand failed.
02:38:13 ninja failed with: exit status 1
failed to build some targets (02:09 (mm:ss))
`
解决:
configuration written to .config
make[1]: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/out/target/product/d38_sdm450/obj/kernel/msm-3.18'
make: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18'
make: Entering directory '/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18'
make[1]: Entering directory '/home/persist/disk2/skye-android/36AT/D38/out/target/product/d38_sdm450/obj/kernel/msm-3.18'
/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18/arch/arm64/Makefile:130: warning: overriding recipe for target 'vdso_prepare'
/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18/arch/arm64/Makefile:120: warning: ignoring old recipe for target 'vdso_prepare'
CHK include/generated/uapi/linux/version.h
make[1]: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/out/target/product/d38_sdm450/obj/kernel/msm-3.18'
make: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18'
[ 0% 399/107486] host C++: libaapt <= frameworks/base/tools/aapt/ResourceTable.cpp
ninja: build stopped: subcommand failed.
02:14:36 ninja failed with: exit status 1
failed to build some targets (01:44 (mm:ss))
执行make mrproper, 会先执行make clean, 执行make distclean之前, 会先执行make mrproper。再回到make help的结果:make clean 删除大多数的编译生成文件, 但是会保留内核的配置文件.config, 还有足够的编译支持来建立扩展模块make mrproper 删除所有的编译生成文件, 还有内核配置文件, 再加上各种备份文件make distclean mrproper删除的文件, 加上编辑备份文件和一些补丁文件。 其 实, 对于一个刚刚从kernel.org上下载的内核源码包, 可以不用执行make clean/make mrproper/make distclean, 因为源码包的状态本身就是clean的。 另外, 就算编译过内核之后, 需不需要clean一下, 个人觉得应该具体问题具体对待, 且看linuxsir上也有兄弟对这个问题有疑问:Q: 很多内核编译的教程都说在make之前要先make mrproper,清除以前编译的产物。但编译器/链接器本身就会检查文件的日期,并确定是否需要重新编译/链接。如果清除了,很多以前已经编译过的代码 又得重新编译。如果说这样能节省硬盘空间的话,那只有那些先前编译过而现在不再需要的模块的空间被节省了,而代价则是编译时间延长了。个人觉得得不偿失, 至少不需要每次编译都来一次make mrproper。 A: 我没有make mrproper,每次修改内核配置后很快就能编译完成,很方便,也没发现什么问题如果make不能确定那些文件要重新编译,那还要make做什 么个人观点,尽信书则不如无书,实践出真知,呵呵
看到 /home/xxx/Code/sm90/kernel/msm-4.4 is not clean, please run 'make mrproper'
回到根目录下 make mrproper,还是抱上面的错误。折腾了一下午,才搞定。
最终解决:进到 kernel/msm-4.4/ 下面执行:
make mrproper
再回到根目录,执行 make bootimage -j8 ,一切ok。
`make[1]: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/out/target/product/d38_sdm450/obj/kernel/msm-3.18'
make: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18'
make: Entering directory '/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18'
make[1]: Entering directory '/home/persist/disk2/skye-android/36AT/D38/out/target/product/d38_sdm450/obj/kernel/msm-3.18'
/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18/arch/arm64/Makefile:130: warning: overriding recipe for target 'vdso_prepare'
/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18/arch/arm64/Makefile:120: warning: ignoring old recipe for target 'vdso_prepare'
INSTALL block/test-iosched.ko
INSTALL crypto/ansi_cprng.ko
INSTALL drivers/char/rdbg.ko
INSTALL drivers/input/evbug.ko
INSTALL drivers/mmc/card/mmc_block_test.ko
INSTALL drivers/mmc/card/mmc_test.ko
INSTALL drivers/net/wireless/ath/wil6210/wil6210.ko
INSTALL drivers/scsi/ufs/ufs_test.ko
INSTALL drivers/spi/spidev.ko
INSTALL drivers/video/backlight/backlight.ko
INSTALL drivers/video/backlight/generic_bl.ko
INSTALL drivers/video/backlight/lcd.ko
INSTALL net/bridge/br_netfilter.ko
DEPMOD 3.18.71-perf
make[1]: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/out/target/product/d38_sdm450/obj/kernel/msm-3.18'
make: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18'
[100% 5/5] Target boot image: out/target/product/d38_sdm450/boot.img
out/target/prod****uct/d38_sdm450/boot.img maxsize=68395008 blocksize=135168 total=28851496 reserve=811008
build completed successfully (01:16 (mm:ss))
`
make[1]: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/out/target/product/d38_sdm450/obj/kernel/msm-3.18'
make: Leaving directory '/home/persist/disk2/skye-android/36AT/D38/kernel/msm-3.18'
ninja: build stopped: subcommand failed.
03:07:23 ninja failed with: exit status 1
failed to build some targets (02:33 (mm:ss))
skye@ubuntu:/home/persist/disk2/skye-android/36AT/D38$ cd /out/target/product/d38_sdm450/obj/kernel/msm-3.18
-bash: cd: /out/target/product/d38_sdm450/obj/kernel/msm-3.18: No such file or directory
skye@ubuntu:/home/persist/disk2/skye-android/36AT/D38$ cd out/target/product/d38_sdm450/obj
skye@ubuntu:/home/persist/disk2/skye-android/36AT/D38/out/target/product/d38_sdm450/obj$ cd kernel/msm-3.18/
skye@ubuntu:/home/persist/disk2/skye-android/36AT/D38/out/target/product/d38_sdm450/obj/kernel/msm-3.18$ make mrproper
CLEAN .
CLEAN crypto/asymmetric_keys
CLEAN kernel/time
CLEAN kernel
CLEAN lib
CLEAN net/wireless
CLEAN security/selinux
CLEAN usr
CLEAN .tmp_versions
CLEAN scripts/basic
CLEAN scripts/dtc
CLEAN scripts/genksyms
CLEAN scripts/kconfig
CLEAN scripts/mod
CLEAN scripts/selinux/genheaders
CLEAN scripts/selinux/mdp
CLEAN scripts
CLEAN include/config usr/include include/generated arch/arm64/include/generated
CLEAN .config .version include/generated/uapi/linux/version.h Module.symvers signing_key.priv signing_key.x509 x509.genkey
build completed successfully (14 seconds)