编译 buildroot 错误录

编译 buildroot 错误录

为什么要记录编译过程的错误?

  1. 问题定位和诊断
    明确错误来源:编译错误记录提供了错误发生的位置和性质,使工程师能够迅速定位到问题的源头。日志通常会包含文件名、行号以及错误消息,帮助工程师确定出错的代码段。
    历史追踪:记录的错误信息可以帮助追踪错误的历史,从而识别是否是由于最近的代码修改引入的问题。
  2. 改进开发效率
    迅速修复:准确的错误记录可以减少调试时间,让开发人员更快地修复问题,而不必手动查找每个可能的错误点。
    减少重复错误:通过分析错误记录,开发人员可以识别出常见的错误模式,从而采取措施避免类似问题的再次出现。
  3. 代码质量提高
    代码审查:编译错误记录可以用作代码审查的依据,帮助团队识别和改正代码中的缺陷。
    学习和改进:记录的错误信息为工程师提供了学习的机会,尤其是新手工程师可以通过分析这些错误,了解常见问题及其解决方法,从而提升编程技能。
  4. 沟通和协作
    错误记录可以帮助其他人,有效的沟通。如果一个错误难以解决,别人可以将错误日志分享给需要寻求帮助的人。

作者:炭烤毛蛋 ,点击博主了解更多。


提示: 编译日志信息提示比较全面,要耐心仔细查看。


1. 内核编译错 错误

错误一

scripts/kconfig/conf --syncconfig Kconfig
HOSTLD scripts/dtc/dtc
/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [scripts/Makefile.host:99: scripts/dtc/dtc] Error 1
make[1]: *** [scripts/Makefile.build:637: scripts/dtc] Error 2
make: *** [Makefile:1187: scripts] Error 2
ERROR: Running build_kernel failed!
ERROR: exit code 2 from line 501:
make ARCH=$RK_ARCH $RK_KERNEL_DTS.img -j$RK_JOBS

检查 gcc 编译版本。开发环境 22.04,gcc version 11.4.0 符合要求。

gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

根据提示 修改 scripts/dtc/dtc-lexer.lex.c 中错误位置进行屏蔽,或者增加外部变量引用。

-YYLTYPE yylloc;
+extern YYLTYPE yylloc;

错误二

config=/home/1126/buildroot/output/rv1126/.rockchipconfig Config.in
#
# configuration written to /home/1126/buildroot/output/rv1126/.config
#
make: Leaving directory '/home/1126/buildroot'
====Start build rv1126====
2022-07-17T17:13:30 >>> host-m4 1.4.18 Building
Done in 7s (error code: 2)
Command exited with non-zero status 2
you take 0:08.57 to build ramboot
ERROR: Running build_ramboot failed!
ERROR: exit code 2 from line 565:
/usr/bin/time -f "you take %E to build ramboot" $COMMON_DIR/mk-ramdisk.sh ramboot.img $RK_CFG_RAMBOOT

builtroot 编译错误

错误一

Done in 8s (error code: 2)
Failed to build rockchip_rv1126_evb_tb:
# 2022-07-17 11:31:24

2022-07-17T11:31:24 make: Entering directory '/home/rv1126/buildroot'
2022-07-17T11:31:31 /usr/bin/make -j1 O=/home/rv1126/buildroot/output/rockchip_rv1126_evb_tb HOSTCC="/usr/bin/gcc" HOSTCXX="/usr/bin/g++" syncconfig
2022-07-17T11:31:31 make[1]: Entering directory '/home/rv1126/buildroot'
2022-07-17T11:31:31 GEN /home/rv1126/buildroot/output/rockchip_rv1126_evb_tb/Makefile
2022-07-17T11:31:32 make[1]: Leaving directory '/home/rv1126/buildroot'
2022-07-17T11:31:32
2022-07-17T11:31:32 Your PATH contains spaces, TABs, and/or newline (n) characters.
2022-07-17T11:31:32 This doesn't work. Fix you PATH.
2022-07-17T11:31:32 make: *** [support/dependencies/dependencies.mk:27: dependencies] Error 1
2022-07-17T11:31:32 make: Leaving directory '/home/rv1126/buildroot'
Please check details in /home/rv1126/output/log/2022-07-17_11-29-18/br-rockchip_rv1126_evb_tb_2022-07-17_11-31-24.log
Command exited with non-zero status 1
you take 0:17.37 to build buildroot
ERROR: Running /home/rv1126/device/rockchip/common/scripts/mk-rootfs.sh - build_buildroot failed!
ERROR: exit code 1 from line 13:
/usr/bin/time -f "you take %E to build buildroot" "$SCRIPTS_DIR/mk-buildroot.sh" $RK_BUILDROOT_CFG "$ROOTFS_DIR"

摘取关键错误信息如下:

2022-07-17T11:31:32 Your PATH contains spaces, TABs, and/or newline (n) characters. 
2022-07-17T11:31:32 This doesn't work. Fix you PATH. 
2022-07-17T11:31:32 make: *** [support/dependencies/dependencies.mk:27: dependencies] Error 1

our PATH contains spaces, TABs, and/or newline (n) characters. 错误提示表明你的操作系统中的环境变量 PATH 包含了空格、制表符或换行符等非法字符,这可能导致编译时出现问题。
错误原因: WSL默认引入 windows 环境参量
修改方法:重置 PATH 环境变量。

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
make

错误二

warning: Python 3 support is currently experimental. YMMV.
Please use Python 2.6 - 2.7 instead.
rv1126/.repo/repo/main.py:19: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
import imp
Traceback (most recent call last):
File "rv1126/.repo/repo/main.py", line 46, in <module>
from subcmds.version import Version
File "rv1126/.repo/repo/subcmds/__init__.py", line 33, in <module>
mod = __import__(__name__,

尝试将 repo 脚本解释器,修改 #!/usr/bin/env python#!/usr/bin/env python2,经过测试问题解决。

vi .repo/repo/repo
-#!/usr/bin/env python
-#!/usr/bin/env python2

错误三

2022-07-24T13:34:41 g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.

查阅相关信息后,认为是虚拟机内存不足造成。参照《Android 编译报错记录篇》增加服务器交换分区内存可以解决此问题。

错误四

2022-07-24T09:44:05 g++: fatal error: Killed signal terminated program cc1plus
2022-07-24T09:44:05 compilation terminated.
2022-07-24T09:44:05 make[1]: *** [Makefile:182: cmGeneratorTarget.o] Error 1
2022-07-24T09:44:05 make[1]: *** Waiting for unfinished jobs....
2022-07-24T09:44:09 make[1]: Leaving directory '/home/rv1126/buildroot/output/rockchip_rv1126_evb_tb/build/host-cmake-3.22.3/Bootstrap.cmk'

错误三 原因相同,日志体现略有不同。解决方法嘛,就不用细说咯。

错误五

ERROR: Running build_buildroot failed!
ERROR: exit code 1 from line 556:
/usr/bin/time -f "you take %E to build builroot" $COMMON_DIR/mk-buildroot.sh $BOARD_CONFIG

问题原因:buildroot 环境变量发生变迁,无法正常执行。
解决方案:清除当前编译缓存 ./build.sh cleanall,然后重新编译 ./build.sh

错误六

2022-07-24T15:28:07 >>> camera_engine_rkaiq 1.0 Building
Done in 10min 17s (error code: 2)
Command exited with non-zero status 2
you take 10:18.63 to build ramboot
ERROR: Running build_ramboot failed!
ERROR: exit code 2 from line 565:

查看 br.log 发现是文件缺失。

2022-07-24T15:28:07 ### conver iqfile: /home/1126/buildroot/output/rv1126/build/camera_engine_rkaiq-1.0/iqfiles/os04c10_DW-RV04C_2G2P650IR-F21.xml
2022-07-24T15:28:07 /bin/bash: /home/1126/buildroot/output/rv1126/host/bin/rkisp_parser: No such file or directory
2022-07-24T15:28:07 make[1]: *** [package/pkg-generic.mk:258: /home/1126/buildroot/output/rv1126/build/camera_engine_rkaiq-1.0/.stamp_built] Error 127
2022-07-24T15:28:07 make: *** [/home/1126/buildroot/output/rv1126/Makefile:16: _all] Error 2

日志提示 rkisp_parser 命令无法正常执行,手动验证确实存在问题。

/home/1126/buildroot/output/rv1126/host/bin/rkisp_parser
No such file or directory

解决方法:更替 rkisp_parser 为当前系统可执行文件。

Tips

编译错误日志内容很详细。

结语

不枉博主详细讲解,欢迎订阅博主–炭烤毛蛋

  • 11
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
全志R16平台编译linux系统V1.0.txt 2017/4/11 13:36 (编译请使用编译android的lichee的选项编译生成的.config文件,不然直接编译会报错!!!!) rootroot@cm-System-Product-Name:/home/wwt/linux_r16$ tar zxvf lichee_parrotv1.1_20161202.tar.gz rootroot@cm-System-Product-Name:/home/wwt/linux_r16$ cd lichee/ rootroot@cm-System-Product-Name:/home/wwt/linux_r16/lichee$ ./build.sh config Welcome to mkscript setup progress All available chips: 0. sun8iw5p1 Choice: 0 All available platforms: 0. android 1. dragonboard 2. linux 3. tina Choice: 2 All available kernel: 0. linux-3.4 Choice: 0 All available boards: 0. bell-one 1. evb 2. evb-20 3. evb-30 4. evb-rtl8723bs 5. sc3813r Choice: 3 rootroot@cm-System-Product-Name:/home/wwt/linux_r16/lichee$ ./build.sh 错误1: KCONFIG_AUTOCONFIG=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/auto.conf KCONFIG_AUTOHEADER=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/autoconf.h KCONFIG_TRISTATE=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/tristate.config BUILDROOT_CONFIG=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/.config /home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/conf --silentoldconfig Config.in # # make dependencies written to .auto.deps # ATTENTION buildroot devels! # See top of this file before playing with this auto-preprequisites! # make[1]:正在离开目 `/home/wwt/linux_r16/lichee/buildroot' You must install 'makeinfo' on your build machine makeinfo is usually part of the texinfo package in your distribution make: *** [dependencies] 错误 1 make:离开目“/home/wwt/linux_r16/lichee/buildroot” ERROR: build buildroot Failed rootroot@cm-System-Product-Name:/home/wwt/linux_r16/lichee$ d/buildroot-config/conf.o /home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/zconf.tab.o -o /home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buil
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值