解决orange pi编译Linux系统时报错:[ error ] ERROR in function compile_atf的问题
编译直接报错,过程出错信息文件 out/debug/compilation.log,日志如下:
[ error ] ERROR in function compile_atf [ ./build.sh:305 -> scripts/main.sh:631 -> scripts/main.sh:515 -> scripts/compilation.sh:86 -> scripts/general.sh:0 ]
[ error ] ATF compilation failed
分析:scripts/compilation.sh +86
echo -e "\n\t== atf ==\n" >> "${DEST}"/${LOG_SUBPATH}/compilation.log
# ENABLE_BACKTRACE="0" has been added to workaround a regression in ATF.
# Check: https://github.com/armbian/build/issues/1157
eval CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${toolchain2}:${PATH}" \
'make ENABLE_BACKTRACE="0" $target_make $CTHREADS \
CROSS_COMPILE="$CCACHE $ATF_COMPILER"' 2>> "${DEST}"/${LOG_SUBPATH}/compilation.log \
${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/${LOG_SUBPATH}/compilation.log'} \
${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Compiling ATF..." $TTY_Y $TTY_X'} \
${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'}
[[ ${PIPESTATUS[0]} -ne 0 ]] && exit_with_error "ATF compilation failed"
报错位置:CROSS_COMPILE="$CCACHE A T F C O M P I L E R " ′ ,原因是 ATF_COMPILER"',原因是 ATFCOMPILER"′,原因是CCACHE的参数不对,提示-g参数不对,不熟悉这个工具,就没关注了。
全局搜索CCACHE,发现可以定义USE_CCACHE=no,来规避这个问题
yd@yd-Thurley:~/work/orange_zero_3/orangepi-build$ grep "CCACHE" -rn scripts/*
scripts/chroot-buildpackages.sh:294: export CCACHE_TEMPDIR="/tmp"
scripts/chroot-buildpackages.sh:297: #export CCACHE_PREFIX="distcc"
scripts/chroot-buildpackages.sh:299: #export CCACHE_RECACHE="true"
scripts/chroot-buildpackages.sh:300: #export CCACHE_DISABLE="true"
scripts/compilation.sh:80: eval CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${toolchain2}:${PATH}" \
scripts/compilation.sh:82: CROSS_COMPILE="$CCACHE $ATF_COMPILER"' 2>> "${DEST}"/${LOG_SUBPATH}/compilation.log \
scripts/compilation.sh:201: eval CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${toolchain2}:${PATH}" \
scripts/compilation.sh:203: CROSS_COMPILE="$CCACHE $UBOOT_COMPILER"' 2>> "${DEST}"/${LOG_SUBPATH}/compilation.log \
scripts/compilation.sh:237: cross_compile="CROSS_COMPILE=$CCACHE $UBOOT_COMPILER";
scripts/compilation.sh:241: eval CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${toolchain2}:${PATH}" \
scripts/compilation.sh:464: eval CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${PATH}" \
scripts/compilation.sh:465: 'make ARCH=$ARCHITECTURE CROSS_COMPILE="$CCACHE $KERNEL_COMPILER" silentoldconfig'
scripts/compilation.sh:468: eval CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${PATH}" \
scripts/compilation.sh:469: 'make ARCH=$ARCHITECTURE CROSS_COMPILE="$CCACHE $KERNEL_COMPILER" olddefconfig'
scripts/compilation.sh:472: eval CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${PATH}" \
scripts/compilation.sh:473: 'make $CTHREADS ARCH=$ARCHITECTURE CROSS_COMPILE="$CCACHE $KERNEL_COMPILER" oldconfig'
scripts/compilation.sh:474: eval CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${PATH}" \
scripts/compilation.sh:475: 'make $CTHREADS ARCH=$ARCHITECTURE CROSS_COMPILE="$CCACHE $KERNEL_COMPILER" ${KERNEL_MENUCONFIG:-menuconfig}'
scripts/compilation.sh:485: eval CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${PATH}" \
scripts/compilation.sh:486: 'make ARCH=$ARCHITECTURE CROSS_COMPILE="$CCACHE $KERNEL_COMPILER" savedefconfig'
scripts/compilation.sh:498: eval CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${PATH}" \
scripts/compilation.sh:500: CROSS_COMPILE="$CCACHE $KERNEL_COMPILER" \
scripts/compilation.sh:529: eval CCACHE_BASEDIR="$(pwd)" env PATH="${toolchain}:${PATH}" \
scripts/compilation.sh:539: CROSS_COMPILE="$CCACHE $KERNEL_COMPILER" 2>>$DEST/${LOG_SUBPATH}/compilation.log' \
scripts/main.sh:119:if [[ $USE_CCACHE != no ]]; then
scripts/main.sh:121: CCACHE=ccache
scripts/main.sh:125: [[ $PRIVATE_CCACHE == yes ]] && export CCACHE_DIR=$EXTER/cache/ccache
scripts/main.sh:129: CCACHE=""
在文件userpatches/config-default.conf中,添加USE_CCACHE=no就可以继续编译了。