云网牛站
所在位置:首页 > Linux编程 > 编译鸿蒙OpenHarmony 2.0源码无法通过的解决方法

编译鸿蒙OpenHarmony 2.0源码无法通过的解决方法

2020-09-12 15:48:29作者:antherseventeen稿源:中国开源社区

有位网友编译了鸿蒙OpenHarmony 2.0(HarmonyOS 2.0)的源码,按照其给出的具体步骤都无法顺利的编译通过,并且在编译过程中产生了以下错误问题,经过摸索,已解决了该问题,编译鸿蒙OpenHarmony 2.0源码顺利完成,以下分享方法。

 

错误信息

[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:

 

解决方法

以上问题大致上解决了。

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

编译鸿蒙OpenHarmony 2.0源码无法通过的解决方法

参考:华为鸿蒙HarmonyOS开放源代码OpenHarmony的地址公布,附获取方法

 

相关事项说明

1、关于升级scons的尝试

测试过几个版本了:scons-3.0.4、scons-3.1.2、scons-4.0.1,还是一样的报错内容。

2、所使用的python版本太高

官方教程搭建环境要求python3.7以上,我尝试过用python2.7搭建,但有很多模块装不上。

 

相关主题

OpenHarmony能否二次开发以推出基于OpenHarmony的操作系统

精选文章
热门文章