SSC9381G SDK python2与python3兼容编译报错问题
SSC9381G是星宸科技2020年10月25日发布的一款智能外设及娱乐—猫头鹰系列芯片, 搭载其自研AI处理器IPU。主要用于会议场景下广角畸变矫正、人脸签到、语音自动翻译等功能。刚好,最近在对这个平台进行预研,在此做点笔记。
在参考官方手册编译SSC9381的SDK的时候,发现了一些编译问题,基本定位是python版本不一致导致,目前已解决,在此做一下记录,以免遗忘。(如果能用python2建议最好还是用python2,目前项目才刚开始,python3虽然编译过了,但是还没有进行验证,不确定还有没有什么隐藏的坑)
编译环境: Ubuntu16.04 sdk版本:SSC9351_9381_339G_USBCamera_SDK_V00024
默认python版本:python3.8
1. 编译boot:
问题一:print用法python2与python3不兼容
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/config.h
UPD include/config.h
GEN include/autoconf.mk
GEN include/autoconf.mk.dep
GCC version: 9.1.0
MVXV
CHK include/generated/timestamp_autogenerated.h
chip_id I6E
UPD include/generated/timestamp_autogenerated.h
File "ms_gen_mvxv_h.py", line 20
print 'ERROR: must specify output header file!!'
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print('ERROR: must specify output header file!!')?
Makefile:1151: recipe for target 'include/config/uboot.release' failed
make: *** [include/config/uboot.release] Error 1
解决方法:添加print后的字符串打印用 ()
2. 编译kernel:
问题一: python读取二进制文件时出错
#update builtin DTB
IMAGE arch/arm/boot/Image
BNDTB arch/arm/boot/dts/infinity6e-ssc013a-s01a.dtb
Traceback (most recent call last):
File "scripts/ms_builtin_dtb_update.py", line 13, in <module>
dtb=dtb_file.read()
File "/usr/local/lib/python3.8/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 0: invalid continuation byte#update Image-fpga DTB
Traceback (most recent call last):
File "scripts/ms_bin_option_update_int.py", line 11, in <module>
value=long(sys.argv[3])
NameError: name 'long' is not defined
arch/arm/boot/Makefile:82: recipe for target 'arch/arm/boot/zImage' failed
make[2]: *** [arch/arm/boot/zImage] Error 1
arch/arm/Makefile:330: recipe for target 'zImage' failed
make[1]: *** [zImage] Error 2
make[1]: Leaving directory '/home/disk/fangye/setup_package/ss9381G/SSC9351_9381_339G_USBCamera_SDK_V00024/test/kernel'
makefile:17: recipe for target 'GNUmakefile' failed
make: *** [GNUmakefile] Error 2
解决办法:以二进制只读方式打开文件,查找字符串转换为二进制。
问题二:long类型转换找不到定义
#update Image-fpga DTB
Traceback (most recent call last):
File "scripts/ms_bin_option_update_int.py", line 11, in <module>
value=long(sys.argv[3])
NameError: name 'long' is not defined
arch/arm/boot/Makefile:82: recipe for target 'arch/arm/boot/zImage' failed
make[2]: *** [arch/arm/boot/zImage] Error 1
arch/arm/Makefile:330: recipe for target 'zImage' failed
make[1]: *** [zImage] Error 2
make[1]: Leaving directory '/home/disk/fangye/setup_package/ss9381G/SSC9351_9381_339G_USBCamera_SDK_V00024/test/kernel'
makefile:17: recipe for target 'GNUmakefile' failed
make: *** [GNUmakefile] Error 2
解决办法:python3不在支持long类型,直接用int类型替代即可。
问题三:字符串类型与字节类型不匹配
#update Image-fpga DTB
Traceback (most recent call last):
File "scripts/ms_bin_option_update_int.py", line 15, in <module>
offset=fmap.find(name)
TypeError: a bytes-like object is required, not 'str'
arch/arm/boot/Makefile:82: recipe for target 'arch/arm/boot/zImage' failed
make[2]: *** [arch/arm/boot/zImage] Error 1
arch/arm/Makefile:330: recipe for target 'zImage' failed
make[1]: *** [zImage] Error 2
make[1]: Leaving directory '/home/disk/fangye/setup_package/ss9381G/SSC9351_9381_339G_USBCamera_SDK_V00024/test/kernel'
makefile:17: recipe for target 'GNUmakefile' failed
make: *** [GNUmakefile] Error 2
解决办法:将str转为二进制即可
project和sdk目录的编译不需要修改什么,直接参考如下编译脚本:
#!/bin/bashARCH="arm"
CROSS_COMPILE="arm-linux-gnueabihf-9.1.0-"BOOT_CONFIG="infinity6e_ufu_spinand_defconfig"
KERNEL_CONFIG="infinity6e_ssc013a_s01a_spinand_usbcam_defconfig"
PROJECT_CONFIG="./configs/usbcam/i6e/spinand.glibc-squashfs.013a.256x256.bga"BOOT_IMAGE_PATH="./u-boot_spinand.xz.img.bin"
KERNEL_IMAGE_PATH="./arch/arm/boot/uImage.xz"BOOT_RELEASE_PATH="../project/board/i6e/boot/spinand/uboot"
KERNEL_RELEASE_PATH="../project/release/usbcam/i6e/013A/glibc/9.1.0/bin/kernel/spinand/uImage.xz"boot(){cd bootdeclare -x ARCH=$ARCHdeclare -x CROSS_COMPILE=$CROSS_COMPILE
# make $BOOT_CONFIGmake cleanmake -j8cp $BOOT_IMAGE_PATH $BOOT_RELEASE_PATHmake cleancd ..
}kernel(){cd kerneldeclare -x ARCH=$ARCHdeclare -x CROSS_COMPILE=$CROSS_COMPILE
# make $KERNEL_CONFIGmake cleanmake -j8cp $KERNEL_IMAGE_PATH $KERNEL_RELEASE_PATH
# make cleancd ..
}project(){cd project./setup_config.sh $PROJECT_CONFIGmake cleanmake imagecd ..
}sdk(){cd sdk/verify/mi_demo/source/make cleanmake uvcmake installmake cleancd ../../../../
}module(){
# cp kernel/modules/* project/release/usbcam/i6e/common/glibc/9.1.0/modules/4.9.84/cp kernel/modules/* project/kbuild/4.9.84/i6e/configs/usbcam/013A/glibc/9.1.0/spinand/modulesecho "cp kernel/modules/* project/kbuild/4.9.84/i6e/configs/usbcam/013A/glibc/9.1.0/spinand/modules"
}case "$1" in
"")boot;kernel;project;sdk;;;
"boot")boot;;
"kernel")kernel;;
"project")project;;
"sdk")sdk;;
"module")module;;
esac
PS:不要在project 和 sdk目录下创建仓库,makefile会判断.git目录,导致你无法编译。
SSC9381G SDK python2与python3兼容编译报错问题相关推荐
- map python2 python3 兼容,Python2与Python3兼容
Python2与Python3兼容 python3写的代码如何也能在pyhon2上跑?请无论如何加上这一句,python3没有啥影响 from __future__ import absolute_i ...
- 【错误记录】Android Studio 编译报错 ( SDK location not found )
文章目录 一.报错信息 二.解决方案 一.报错信息 Android Studio 编译报错 : 首次打开别人的项目 , 经常性的报错 ; Could not determine the depende ...
- python2中的unicode_python2中的unicode()函数在python3中会报错:
python2中的unicode()函数在python3中会报错:NameError: name 'unicode' is not defined There is no such name in P ...
- firefly AIO-RK3399J Linux SDK编译报错解决
Firefly AIO-RK3399J Linux SDK编译报错解决 Zhang-Zhen 2020-09-30 22:01:04 收藏 分类专栏: RK3399工作记录 文章标签: linux ...
- Vue前端npm编译报错问题总结
Vue框架可以很方便的引入各种插件,但是也因此会经常遇到种编译报错,解决起来很耗时,现在将平时遇到的一些编译报错,以及解决方法收录于此. 1.Module build failed: Error: C ...
- Python3引入ssl报错(解决方案)
Python3引入ssl报错 源码编译安装python3.6 解决ssl问题 该文章作者亲测有效,环境为云服务器centos7 步骤 [root@shuai ~]# mkdir /root/Downl ...
- 【错误记录】Android Studio 编译报错 ( A problem occurred starting process ‘command ‘ninja.exe‘ ‘ )
文章目录 一.报错信息 二.解决方案 一.报错信息 Android Studio 编译报错 : FAILURE: Build failed with an exception.* What went ...
- 【c语言 gcc9.1.0环境下编译报错】error: ‘true’ undeclared (first use in this function)
问题 网上验证一个单链表是否有环的c语言demo,放到gcc9.1.0的环境下编译,发现编译报错: error: 'true' undeclared (first use in this functi ...
- C编译报错: implicit declaration of function xxx is invalid in C99 [-Wimplicit-function-declaration]
C编译报错: implicit declaration of function xxx is invalid in C99 [-Wimplicit-function-declaration] 代码文件 ...
最新文章
- 互联网技术的主要组成
- Microsoft Windows Workflow Foundation 4.0 Cookbook
- oracle会话状态,oracle中会话的状态
- 基于xgboost 的贷款风险预测
- android fastjson漏洞_【漏洞预警】Fastjson 远程代码执行漏洞(暂无PoC)
- 【luogu P1343 地震逃生】 题解
- WebAPI(part2)--获取元素
- 区块链和区块链联盟_区块链是安全主题吗?
- .net如何获取文件夹中的文件_access递归列出文件夹中的文件
- Bootstrap treeview 添加滚动条后 搜索完成滚动条自动移动到对应位置
- 地理信息系统(汤国安)重点整理与推导(第二章)
- Centos操作系统基本介绍
- excel文件压缩 定位条件 对象
- 高德地图获取坐标距离_高德地图计算两坐标之间距离
- 计算机专业自主招生有哪些学校,自主招生的学校类型有哪些
- 黑客利用0day,从General Bytes比特币ATM盗走150万美元
- Hadoop3.x学习教程(二)
- 2021年美亚杯个人赛复盘
- Linux驱动快速入门
- Windows远程连接工具有哪些