rv1109/rv1126 编译错误记录

embedded/2024/10/18 15:28:18/

rv1109rv1126__0">rv1109/rv1126 编译错误记录

瑞芯微针对市面上的电池类IPC产品存在抓拍速度慢、识别准确性低、待机时间短、拍摄效果差及视频流畅度不佳等痛点,推出 rv1109rv1126 电池类智慧视觉方案,主要定位于人工智能(AI)边缘计算和智能硬件领域。
RV1109
定位:RV1109 主要面向智能监控、智能家居、物联网设备等应用场景。其集成了AI处理单元,能够进行实时视频分析和图像处理,适合需要边缘计算的设备。
特性:支持1080p视频编解码,具备低功耗特性,适合长时间运行的设备。
RV1126
定位:RV1126 则在性能上更强大,适用于更复杂的应用,如智能摄像头、人脸识别、语音识别等领域。它能够支持更高分辨率的视频处理和更复杂的AI算法。
特性:具备多核处理能力,支持4K视频编解码,并且集成了多个接口和丰富的外设,适合多种应用场景。

芯片介绍这么好,针对市场定制产品时会遇到各种技术问题。首先是源码编译问题,然后是运行在 rknn 的边缘算法。
解决编译错误是项目迭代的重要环节,确保每个版本的稳定性和可靠性,使得项目能够顺利向前推进。算法训练、转换、运行后续文章会继续讲解。本篇文章简单记录开发过程的编译错误。

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


提示:解决编译报错比较简单,按照日志提示,迎面直上。

文章目录

  • rv1109/rv1126 编译错误记录
  • 1. 内核编译报错
    • 1.1 缺少 bc命令
    • 1.2 缺少 lz4c 命令
    • 1.3 变量 yylloc
  • 2. ramboot 编译报错
    • 2.1 缺少 time 命令
    • 2.2 缺少 file 命令
    • 2.3 缺少 bzip2
    • 2.4 config 配置文件
  • 3 rootfs 编译报错
    • 3.1 buildroot 编译发生变更
    • 3.2 buildroot 环境变量错误
    • 3.3 代码仓错误
    • 3.4 python 缺少指定软件包
    • 3.5 g++ 错误
    • 3.6 rkisp_parser 版本不匹配
  • 3.7 打包固件报错
  • 结语


1. 内核编译报错

1.1 缺少 bc命令

-------------kernel-------------/bin/sh: 1: bc: not found
make[1]: *** [Kbuild:42: include/generated/timeconst.h] Error 127
make: *** [Makefile:1221: prepare0] Error 2
make: *** Waiting for unfinished jobs....HOSTLD  scripts/dtc/dtc
ERROR: Running build_kernel failed!
$ sudo apt install bc

1.2 缺少 lz4c 命令

/bin/sh: 1: lz4c: not found
make[2]: *** [arch/arm/boot/compressed/Makefile:191: arch/arm/boot/compressed/piggy_data] Error 1
make[1]: *** [arch/arm/boot/Makefile:71: arch/arm/boot/compressed/vmlinux] Error 2
make: *** [arch/arm/Makefile:351: zImage] Error 2
ERROR: Running build_kernel failed!
$ sudo apt install lz4

1.3 变量 yylloc

scripts/kconfig/conf  --syncconfig KconfigHOSTLD  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 编译版本

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.4.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)

开发环境 22.04,gcc version 11.4.0 符合要求。

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

extern YYLTYPE yylloc;

2. ramboot 编译报错

2.1 缺少 time 命令

processing option: ramboot
=========Start building ramboot=========
TARGET_RAMBOOT_CONFIG=rockchip_rv1126_snapshot
=====================================
./build.sh: line 565: /usr/bin/time: No such file or directory
ERROR: Running build_ramboot failed!
ERROR: exit code 127 from line 565:/usr/bin/time -f "you take %E to build ramboot" $COMMON_DIR/mk-ramdisk.sh ramboot.img $RK_CFG_RAMBOOT
$ sudo apt install time

2.2 缺少 file 命令

2024-07-31T15:30:48 umask 0022 && make -C /home/rv1126/buildroot O=/home/rv1126/buildroot/output/rockchip_rv1126_snapshot
2024-07-31T15:30:52
2024-07-31T15:30:52 You must install '/usr/bin/file' on your build machine
$ sudo apt install file

2.3 缺少 bzip2

2024-07-31T15:30:52 make[1]: *** [support/dependencies/dependencies.mk:25: core-dependencies] Error 1
2024-07-31T15:30:52 make: *** [/home/rv1126/buildroot/output/rockchip_rv1126_snapshot/Makefile:16: _all] Error 2
2024-07-31T15:37:47 umask 0022 && make -C /home/rv1126/buildroot O=/home/rv1126/buildroot/output/rockchip_rv1126_snapshot
2024-07-31T15:37:50 You must install 'rsync' on your build machine
2024-07-31T15:37:50 You must install 'bzcat' on your build machine
2024-07-31T15:37:50 bzcat is usually part of the bzip2 package in your distribution
$ sudo apt install rsync bzip2

2.4 config 配置文件

config=/home/rv1126/buildroot/output/rockchip_rv1126_snapshot/.rockchipconfig Config.in
#
# configuration written to /home/rv1126/buildroot/output/rockchip_rv1126_snapshot/.config
#
make: Leaving directory '/home/rv1126/buildroot'
====Start build rockchip_rv1126_snapshot====
2024-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

配置文件发生变更,需要重新配置工程。

3 rootfs 编译报错

3.1 buildroot 编译发生变更

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

重新执行./build.sh cleanall,然后再执行./build.sh

3.2 buildroot 环境变量错误

2024-07-22T10:49:05 Your PATH contains spaces, TABs, and/or newline (n) characters. 
2024-07-22T10:49:05 This doesn't work. Fix you PATH. 2024-07-22T10:49:05 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
Done in 8s  (error code: 2)
Failed to build rockchip_rv1126_evb_tb:
# 2024-07-18 11:31:24
2024-07-18T11:31:24 make: Entering directory '/home/rv1126/buildroot'
2024-07-18T11:31:31 /usr/bin/make -j1 O=/home/rv1126/buildroot/output/rockchip_rv1126_evb_tb HOSTCC="/usr/bin/gcc" HOSTCXX="/usr/bin/g++" syncconfig
2024-07-18T11:31:31 make[1]: Entering directory '/home/rv1126/buildroot'
2024-07-18T11:31:31 GEN     /home/rv1126/buildroot/output/rockchip_rv1126_evb_tb/Makefile
2024-07-18T11:31:32 make[1]: Leaving directory '/home/rv1126/buildroot'
2024-07-18T11:31:32
2024-07-18T11:31:32 Your PATH contains spaces, TABs, and/or newline (n) characters.
2024-07-18T11:31:32 This doesn't work. Fix you PATH.
2024-07-18T11:31:32 make: *** [support/dependencies/dependencies.mk:27: dependencies] Error 1
2024-07-18T11:31:32 make: Leaving directory '/home/rv1126/buildroot'
Please check details in /home/rv1126/output/log/2024-07-18_11-29-18/br-rockchip_rv1126_evb_tb_2024-07-18_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"

按照日志提示仍然需要修复环境变量。

3.3 代码仓错误

warning: Python 3 support is currently experimental. YMMV.
Please use Python 2.6 - 2.7 instead.
/home/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 usesimport imp
Traceback (most recent call last):File "/home/rv1126/.repo/repo/main.py", line 46, in <module>from subcmds.version import VersionFile "/home/rv1126/.repo/repo/subcmds/__init__.py", line 33, in <module>mod = __import__(__name__,File "/home/rv1126/.repo/repo/subcmds/help.py", line 19, in <module>from formatter import AbstractFormatter, DumbWriter
ModuleNotFoundError: No module named 'formatter'
ERROR: Running /home/rv1126/device/rockchip/common/build-hooks/99-all.sh - build_save failed!
ERROR: exit code 1 from line 77:${PYTHON3:-python3} .repo/repo/repo manifest -r -o "$SAVE_DIR/manifest.xml"
ERROR: call stack:

此时执行 repo status 可以发现出现问题仓库,无修改的情况下只需要执行。

repo sync -l [code path]

3.4 python 缺少指定软件包

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

解决方案:

pip install imp

3.5 g++ 错误

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

内存不足引起编译失败。解决方案:虚拟机可以多分配内存,也可以增加 swap 分区代替内存,具体参照 《Android 编译报错记录篇》 1.2 内存不足解决方案。

3.6 rkisp_parser 版本不匹配

2024-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 发现是文件无法执行。

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

发现 buildroot 目录下 rkisp_parser 确实没有执行权限,更替为正确 rkisp_parser

5521fc08dd03010db193617f2417be8a  ./buildroot/output/rockchip_rv1126_rv1126/build/camera-engine-rkaiq-1.0/rkisp_parser_demo/bin/rkisp_parser_m64
92e3971babbc7567567ee87342c057a4  ./buildroot/output/rockchip_rv1126_rv1126/build/camera-engine-rkaiq-1.0/rkisp_parser_demo/bin/rkisp_parser_m32
5521fc08dd03010db193617f2417be8a  ./external/camera_engine_rkaiq/rkisp_parser_demo/bin/rkisp_parser_m64
92e3971babbc7567567ee87342c057a4  ./external/camera_engine_rkaiq/rkisp_parser_demo/bin/rkisp_parser_m32

3.7 打包固件报错

********rkImageMaker ver 2.0********
Error:Chip is invalid!
ERROR: Running /home/rv1109/device/rockchip/common/build-hooks/90-updateimg.sh - build_updateimg failed!
ERROR: exit code 254 from line 75:"$RK_PACK_TOOL_DIR/rkImageMaker" -$TAG MiniLoaderAll.bin update.raw.img update.img -os_type:androidos
ERROR: call stack:90-updateimg.sh: build_updateimg(75)90-updateimg.sh: post_build_hook(148)build-helper: try_func(70)build-helper: try_hook(99)build-helper: source(157)90-updateimg.sh: main(157)
ERROR: Running /home/rv1109/device/rockchip/common/build-hooks/90-updateimg.sh - try_func post_build_hook updateimg failed!
ERROR: exit code 254 from line 74:post_build_hook
ERROR: call stack:build-helper: try_func(74)build-helper: try_hook(99)build-helper: source(157)90-updateimg.sh: main(157)

定位到错误行

vi device/rockchip/common/build-hooks/90-updateimg.sh +75TAG=RK$(hexdump -s 21 -n 4 -e '4 "%c"' MiniLoaderAll.bin | rev)"$RK_PACK_TOOL_DIR/afptool" -pack ./ update.raw.img"$RK_PACK_TOOL_DIR/rkImageMaker" -$TAG MiniLoaderAll.bin \update.raw.img update.img -os_type:androidos

增加参数打印信息,发现 TAG 存在异常。手动测试执行 TAG 错误如下:

TAG=RK$(hexdump -s 21 -n 4 -e '4 "%c"' MiniLoaderAll.bin | rev)
Command 'hexdump' not found, but can be installed with:
sudo apt install bsdextrautils

安装 bsdextrautils 软件包后问题解决。

结语

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


http://www.ppmy.cn/embedded/127267.html

相关文章

安装openai-whisper 失败

昨晚安装python 语音识别模型经常失败&#xff1a; pip install openai-whisper 具体原因是因为国外的源使网络不稳定造成断网 查阅资料我自己的解决办法是在自己C:\Users\用户名目录下建一个pip文件夹&#xff0c;在pip文件夹下建一个pip.ini文件 在pip.ini文件中加入自己要…

leetcode68:文本左右对齐

给定一个单词数组 words 和一个长度 maxWidth &#xff0c;重新排版单词&#xff0c;使其成为每行恰好有 maxWidth 个字符&#xff0c;且左右两端对齐的文本。 你应该使用 “贪心算法” 来放置给定的单词&#xff1b;也就是说&#xff0c;尽可能多地往每行中放置单词。必要时可…

Swift 协议:深入解析与高级应用

Swift 协议:深入解析与高级应用 Swift 协议是 Swift 编程语言中的一项核心特性,它提供了一种定义接口和实现多态的强大方式。本文将深入探讨 Swift 协议的概念、用法和高级应用,帮助读者更好地理解和运用这一特性。 什么是 Swift 协议? Swift 协议是一种用于定义方法、属…

Java | Leetcode Java题解之第477题汉明距离总和

题目&#xff1a; 题解&#xff1a; class Solution {public int totalHammingDistance(int[] nums) {int ans 0, n nums.length;for (int i 0; i < 30; i) {int c 0;for (int val : nums) {c (val >> i) & 1;}ans c * (n - c);}return ans;} }

代码训练营 day31|LeetCode 455,LeetCode 376,LeetCode 53

前言 这里记录一下陈菜菜的刷题记录&#xff0c;主要应对25秋招、春招 个人背景 211CS本CUHK计算机相关硕&#xff0c;一年车企软件开发经验 代码能力&#xff1a;有待提高 常用语言&#xff1a;C 系列文章目录 第31天 &#xff1a;第八章 贪心算法 part01 文章目录 前言系…

MySQL 读写分离、主从复制案例

场景描述 假设你有一个在线商城应用&#xff0c;数据库用于存储用户信息和商品数据。写操作包括新增用户和更新商品信息&#xff0c;而读操作包括查询用户和商品详情。 1. 数据库环境准备 1.1. 主库配置 假设你的从库服务器 IP 地址为 192.168.1.101。 修改从库的配置文件 …

前端面试题(十五)

83. ES6 中的 let 和 const let 和 const 的区别是什么&#xff1f; let 和 const 是 ES6 引入的用于声明变量的新方式&#xff0c;相比于传统的 var&#xff0c;它们具有以下特性&#xff1a; 块级作用域&#xff1a;let 和 const 声明的变量在其所在的块级作用域内有效&…

用通义灵码解决了用npm link安装的模块在vscode中不能被识别到的问题

在开发一个typescript库时&#xff0c;为了测试效果&#xff0c;用npm link将其安装到了一个本地项目中&#xff0c;结果在vscode中提示找不到这个模块。程序能正常运行&#xff0c;但是无法提供智能提示。 在vscode中调出通义灵码对话窗口&#xff0c;问了一下&#xff1a; …