鸿蒙2.0源码编译问题

antherseventeen 发布于 09/12 09:42
阅读 15K+
收藏 2

昨天折腾了鸿蒙的源码编译,按照官网的步骤编译发现有这道地方无法编译通过,看看哪位大神能帮忙解决,感谢

具体错误如下:

[196/197] ACTION //vendor/hisi/hi3861/hi3861:run_wifiiot_scons(//build/lite/toolchain:linux_x86_64_riscv32_gcc)
FAILED: obj/vendor/hisi/hi3861/hi3861/run_wifiiot_scons_build_ext_components.txt
python ../../build/lite/build_ext_components.py --path=../../vendor/hisi/hi3861/hi3861 --command=sh\ hm_build.sh
execute ota_builder with python...
Traceback (most recent call last):
File "/usr/local/lib/scons/SCons/Script/Main.py", line 1381, in main
_exec_main(parser, values)
File "/usr/local/lib/scons/SCons/Script/Main.py", line 1344, in _exec_main
_main(parser)
File "/usr/local/lib/scons/SCons/Script/Main.py", line 1022, in _main
SCons.Script._SConscript._SConscript(fs, script)
File "/usr/local/lib/scons/SCons/Script/SConscript.py", line 286, in _SConscript
exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
File "/root/code/vendor/hisi/hi3861/hi3861/SConstruct", line 211, in <module>
File "/usr/local/lib/scons/SCons/Script/SConscript.py", line 597, in SConscript
return _SConscript(self.fs, *files, **subst_kw)
File "/usr/local/lib/scons/SCons/Script/SConscript.py", line 286, in _SConscript
exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
File "/root/code/vendor/hisi/hi3861/hi3861/boot/flashboot/SConscript", line 104, in <module>
objs += env.SConscript(os.path.join(src, 'SConscript'), {'env':env,}, variant_dir = os.path.join('#', obj_path, "flashboot", path)
, duplicate=0)
File "/usr/local/lib/scons/SCons/Script/SConscript.py", line 597, in SConscript
return _SConscript(self.fs, *files, **subst_kw)
File "/usr/local/lib/scons/SCons/Script/SConscript.py", line 297, in _SConscript
handle_missing_SConscript(f, kw.get('must_exist', None))
File "/usr/local/lib/scons/SCons/Script/SConscript.py", line 179, in handle_missing_SConscript
SCons.Warnings.warn(SCons.Warnings.MissingSConscriptWarning, msg)
File "/usr/local/lib/scons/SCons/Warnings.py", line 174, in warn
_warningOut(warning)
File "/usr/local/lib/scons/SCons/Script/Main.py", line 613, in _scons_internal_warning
filename, lineno, routine, dummy = find_deepest_user_frame(traceback.extract_stack())
File "/usr/local/lib/python3.8/traceback.py", line 211, in extract_stack
stack = StackSummary.extract(walk_stack(f), limit=limit)
File "/usr/local/lib/python3.8/traceback.py", line 366, in extract
f.line
File "/usr/local/lib/python3.8/traceback.py", line 288, in line
self._line = linecache.getline(self.filename, self.lineno).strip()
File "/usr/local/lib/python3.8/linecache.py", line 16, in getline
lines = getlines(filename, module_globals)
File "/usr/local/lib/python3.8/linecache.py", line 47, in getlines
return updatecache(filename, module_globals)
File "/usr/local/lib/python3.8/linecache.py", line 137, in updatecache
lines = fp.readlines()
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 0xca in position 699: invalid continuation byte

During handling of the above exception, another exception occurred:

 

 

加载中
9
antherseventeen
antherseventeen

问题大致上解决了 我的解决办法是编译 先把官方鸿蒙全量代码下载到本地,从gitee下对应的vendor替换就可以编译通过了。(目测全量下载有一定的差异)

0
shuaytao
shuaytao

升级一下scons试试

antherseventeen
antherseventeen
我测试过几个版本了( scons-3.0.4、 scons-3.1.2 、 scons-4.0.1 ) 还是一样的报错
0
春梦鸟留痕
春梦鸟留痕

python版本太高?降到2.7试试

i
ila
默认是2.7的
antherseventeen
antherseventeen
官方教程搭建环境要求python3.7以上,我尝试过用python2.7搭建,有很多模块装不上
0
xu4v
xu4v

错误是:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xca in position 699: invalid continuation byte

文件是:/root/code/vendor/hisi/hi3861/hi3861/boot/flashboot/SConscript

antherseventeen
antherseventeen
回复 @xu4v : 感谢,转码后问题是解决了,后面还有别的问题,看起来我下载的代码有问题。
xu4v
xu4v
回复 @antherseventeen : 对,这个 can't decode byte 一般都是文件编码没识别的问题,要解决的话一般是把文本文件的编码格式转换一下
antherseventeen
antherseventeen
是的,可能是我下载的代码有问题,这个文件是用gbk编码,后面再gitee上下载的就没有这个问题了
0
思维特无敌
思维特无敌

字符集问题,用GBK字符集试试

0
shouyong
shouyong

应该是相关源码文件编码没有统一到utf-8

0
大盘
大盘

编译完,装上啥界面?有SHELL 不 ?搞些截图来看看

0
嘎吱船长
嘎吱船长

这一看就是字符编码和解码的问题,你看一下源码的encoding和你解析使用的encoding是不是有差异。

antherseventeen
antherseventeen
是字符问题,vendor目录下SConscript文件编码是GBK字符集,对比过下载最新的代码最新的代码应该是改回来了
0
-个俗人
-个俗人

这个我编译时候也看到了, 应该还是环境没有配置好,https://my.oschina.net/u/169565/blog/4566379 ​​​​​​​

antherseventeen
antherseventeen
官方也给出了几个常见的问题,我编译的时候或多或少都遇到,而我这个问题官方里面没有给出来,环境问题我这边也排查了好久,最后定位是vendor目录下的代码有差异,后面在gitee上重新拿到最新的vendor代码替换原来的目录即可。
0
hardisk0
hardisk0

请教博主,全量代码下下来叫code-1.0.tar.gz,这个是鸿蒙2.0源码吗?

antherseventeen
antherseventeen
是的,解压以后搭建环境就可以进行编译了,可以对比一下gitee上鸿蒙公开的代码,code里面就是所有代码的集合,每个目录应该是独立维护。
返回顶部
顶部