openEuler embedded快速上手问题记录
目录
openEuler embedded快速上手问题记录
- 参考
快速上手 - 环境配置
wsl2 + Ubuntu 22.04
sudo apt-get install git python3 python3-pip docker docker.io
- 执行报错信息
sx@Aiknow:~$ sudo apt-get install git python3 python3-pip docker docker.io
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package docker.io is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
Package python3-pip is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python3-pip' has no installation candidate
E: Unable to locate package docker
E: Package 'docker.io' has no installation candidate
- 推测:没有配置apt-get本地源
- 解决:
在/etc/apt/sources.list文件末尾添加
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
- 参考
【1】 修改Ubuntu 22.04 apt-get系统软件源
中文终端
- 下载汉化包
sudo apt-get install language-pack-zh-hans
- 修改
/etc/bash.bashrc
export LANG="zh_CN.UTF-8"
export LANGUAGE="zh_CN:zh:en"
export LC_ALL="zh_CN.UTF-8"
- 重新打开终端
python配置
注意:以下为使用root用户进行配置,root用户在进行配置时一些二进制会拷贝至对应路径下,这些路径可能已经在PATH中,因此不再需要修改/etc/bash.bashrc使其生效。
- 安装包管理工具uv
pip install -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple uv
- 将
~/.local/bin添加到PATH中
在/etc/bash.bashrc末尾中添加下述内容
PATH=~/.local/bin:$PATH
- 配置uv镜像源
参考清华大学开源软件镜像站
在~/.config/uv/uv.toml或者/etc/uv/uv.toml填写下面的内容:
[[index]]
url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/"
default = true
- 初始化uv虚拟化环境
cd ~
uv venv
- 将
~/.venv/bin添加到PATH中
在/etc/bash.bashrc末尾中添加下述内容
PATH=~/.venv/bin:$PATH
安装oebuild工具
git clone https://gitee.com/openeuler/oebuild.git
cd oebuild
uv pip install -e ./
oebuild init <work_dir>
注:<work_dir>表示实际工作路径
- 报错
ModuleNotFoundError: No module named 'docker'
Traceback (most recent call last):
File "/home/sx/.venv/bin/oebuild", line 4, in <module>
from oebuild.app.main import main
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 20, in <module>
import oebuild.util as oebuild_util
File "/home/sx/code/src/oebuild/src/oebuild/util.py", line 23, in <module>
from docker.errors import DockerException
ModuleNotFoundError: No module named 'docker'
缺少docker包,使用uv pip install docker后解决
- 报错
ModuleNotFoundError: No module named 'ruamel'
Traceback (most recent call last):
File "/home/sx/.venv/bin/oebuild", line 4, in <module>
from oebuild.app.main import main
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 20, in <module>
import oebuild.util as oebuild_util
File "/home/sx/code/src/oebuild/src/oebuild/util.py", line 25, in <module>
from ruamel.yaml import YAML
ModuleNotFoundError: No module named 'ruamel'
缺少ruamel.yaml包,使用uv pip install ruamel.yaml后解决
- 报错
ModuleNotFoundError: No module named 'git'
Traceback (most recent call last):
File "/home/sx/.venv/bin/oebuild", line 4, in <module>
from oebuild.app.main import main
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 20, in <module>
import oebuild.util as oebuild_util
File "/home/sx/code/src/oebuild/src/oebuild/util.py", line 30, in <module>
from oebuild.ogit import OGit
File "/home/sx/code/src/oebuild/src/oebuild/ogit.py", line 15, in <module>
import git
ModuleNotFoundError: No module named 'git'
缺少GitPython包,使用uv pip install GitPython后解决
- 报错
ModuleNotFoundError: No module named 'prettytable'
Traceback (most recent call last):
File "/home/sx/code/src/oebuild/src/oebuild/spec.py", line 57, in __call__
mod = _commands_module_from_file(self.py_file, self.attr)
File "/home/sx/code/src/oebuild/src/oebuild/spec.py", line 135, in _commands_module_from_file
spec.loader.exec_module(mod)
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/sx/code/src/oebuild/src/oebuild/app/plugins/generate/generate.py", line 22, in <module>
from prettytable import PrettyTable, TableStyle, HRuleStyle, VRuleStyle
ModuleNotFoundError: No module named 'prettytable'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/sx/.venv/bin/oebuild", line 10, in <module>
sys.exit(main())
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 427, in main
app.run(argv or sys.argv[1:])
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 187, in run
self._load_extension_specs()
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 86, in _load_extension_specs
self.command_spec = extension_commands(APP, self.command_ext)
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 224, in extension_commands
specs[key] = get_spec(pre_dir, value)
File "/home/sx/code/src/oebuild/src/oebuild/spec.py", line 120, in get_spec
description=factory().description,
File "/home/sx/code/src/oebuild/src/oebuild/spec.py", line 59, in __call__
raise ExtensionCommandError(
oebuild.spec.ExtensionCommandError
缺少prettytable包,使用uv pip install prettytable后解决
- 报错
ModuleNotFoundError: No module named 'kconfiglib'
Traceback (most recent call last):
File "/home/sx/code/src/oebuild/src/oebuild/spec.py", line 57, in __call__
mod = _commands_module_from_file(self.py_file, self.attr)
File "/home/sx/code/src/oebuild/src/oebuild/spec.py", line 135, in _commands_module_from_file
spec.loader.exec_module(mod)
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/sx/code/src/oebuild/src/oebuild/app/plugins/generate/generate.py", line 38, in <module>
from oebuild.app.plugins.generate.kconfig_generator import KconfigGenerator
File "/home/sx/code/src/oebuild/src/oebuild/app/plugins/generate/kconfig_generator.py", line 21, in <module>
from kconfiglib import Kconfig
ModuleNotFoundError: No module named 'kconfiglib'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/sx/.venv/bin/oebuild", line 10, in <module>
sys.exit(main())
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 427, in main
app.run(argv or sys.argv[1:])
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 187, in run
self._load_extension_specs()
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 86, in _load_extension_specs
self.command_spec = extension_commands(APP, self.command_ext)
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 224, in extension_commands
specs[key] = get_spec(pre_dir, value)
File "/home/sx/code/src/oebuild/src/oebuild/spec.py", line 120, in get_spec
description=factory().description,
File "/home/sx/code/src/oebuild/src/oebuild/spec.py", line 59, in __call__
raise ExtensionCommandError(
oebuild.spec.ExtensionCommandError
缺少kconfiglib包,使用uv pip install kconfiglib后解决
- 报错
Traceback (most recent call last):
File "/home/sx/.venv/bin/oebuild", line 10, in <module>
sys.exit(main())
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 427, in main
app.run(argv or sys.argv[1:])
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 187, in run
self._load_extension_specs()
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 86, in _load_extension_specs
self.command_spec = extension_commands(APP, self.command_ext)
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 224, in extension_commands
specs[key] = get_spec(pre_dir, value)
File "/home/sx/code/src/oebuild/src/oebuild/spec.py", line 120, in get_spec
description=factory().description,
File "/home/sx/code/src/oebuild/src/oebuild/spec.py", line 57, in __call__
mod = _commands_module_from_file(self.py_file, self.attr)
File "/home/sx/code/src/oebuild/src/oebuild/spec.py", line 135, in _commands_module_from_file
spec.loader.exec_module(mod)
File "<frozen importlib._bootstrap_external>", line 879, in exec_module
File "<frozen importlib._bootstrap_external>", line 1016, in get_code
File "<frozen importlib._bootstrap_external>", line 1073, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/home/sx/code/src/oebuild/src/oebuild/app/plugins/neo_generate/neo_generate.py'
删除oebuild/src/oebuild/app/conf/plugins.yaml中的neo-generate内容
- name: neo-generate
class: NeoGenerate
path: plugins/neo_generate/neo_generate.py
oebuild bitbake openeuler-image
- 报错
re.error: missing ), unterminated subpattern at position 1
yocto-poky
2025-12-05 00:15:39,048 - INFO - Fetching into /home/sx/code/src/test_build/src/yocto-poky ...
2025-12-05 00:15:39,740 - INFO - Fetching into /home/sx/code/src/test_build/src/yocto-poky successful
yocto-meta-openembedded
2025-12-05 00:15:39,744 - INFO - Fetching into /home/sx/code/src/test_build/src/yocto-meta-openembedded ...
2025-12-05 00:15:40,291 - INFO - Fetching into /home/sx/code/src/test_build/src/yocto-meta-openembedded successful
2025-12-05 00:15:40,329 - INFO - Bitbake starting ...
Traceback (most recent call last):
File "/home/sx/.venv/bin/oebuild", line 10, in <module>
sys.exit(main())
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 427, in main
app.run(argv or sys.argv[1:])
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 193, in run
self.run_command(argv)
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 170, in run_command
self._run_extension(args.command, unknown)
File "/home/sx/code/src/oebuild/src/oebuild/app/main.py", line 181, in _run_extension
cmd.run(args, unknown)
File "/home/sx/code/src/oebuild/src/oebuild/command.py", line 32, in run
self.do_run(args=args, unknown=unknown)
File "/home/sx/code/src/oebuild/src/oebuild/app/plugins/bitbake/bitbake.py", line 144, in do_run
in_container.exec(
File "/home/sx/code/src/oebuild/src/oebuild/app/plugins/bitbake/in_container.py", line 61, in exec
self.exec_compile(compile_param=compile_param, command=command)
File "/home/sx/code/src/oebuild/src/oebuild/app/plugins/bitbake/in_container.py", line 81, in exec_compile
self.add_bblayers(
File "/home/sx/code/src/oebuild/src/oebuild/app/plugins/bitbake/base_build.py", line 44, in add_bblayers
bblayers.add_layer(pre_dir=pre_dir, layers=layers)
File "/home/sx/code/src/oebuild/src/oebuild/bblayers.py", line 65, in add_layer
bb_utils.edit_bblayers_conf(
File "/home/sx/code/src/oebuild/src/oebuild/bb/utils.py", line 463, in edit_bblayers_conf
(_, newlines) = edit_metadata(
File "/home/sx/code/src/oebuild/src/oebuild/bb/utils.py", line 229, in edit_metadata
var_res = _prepare_variable_regexes(variables, match_overrides)
File "/home/sx/code/src/oebuild/src/oebuild/bb/utils.py", line 75, in _prepare_variable_regexes
var_res[var] = re.compile(
File "/usr/lib/python3.10/re.py", line 251, in compile
return _compile(pattern, flags)
File "/usr/lib/python3.10/re.py", line 303, in _compile
p = sre_compile.compile(pattern, flags)
File "/usr/lib/python3.10/sre_compile.py", line 788, in compile
p = sre_parse.parse(p, flags)
File "/usr/lib/python3.10/sre_parse.py", line 955, in parse
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
File "/usr/lib/python3.10/sre_parse.py", line 444, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
File "/usr/lib/python3.10/sre_parse.py", line 843, in _parse
raise source.error("missing ), unterminated subpattern",
re.error: missing ), unterminated subpattern at position 1
让Deepseek分析了下存在语法错误,对oebuild/src/oebuild/bb/utils.py进行如下修改
diff --git a/src/oebuild/bb/utils.py b/src/oebuild/bb/utils.py
index feef341..fb4919c 100644
--- a/src/oebuild/bb/utils.py
+++ b/src/oebuild/bb/utils.py
@@ -69,11 +69,11 @@ def _prepare_variable_regexes(variables, match_overrides):
for var in variables:
if var.endswith("()"):
var_res[var] = re.compile(
- fr"^(\{var[:-2].rstrip()}\{override_re})[ \t]*\([ \t]*\)[ \t]*{{"
+ fr"^({var[:-2].rstrip()}{override_re})[ \t]*\([ \t]*\)[ \t]*{{"
)
else:
var_res[var] = re.compile(
- fr'^(\{var}\{override_re})[ \\\\\t]*[?+:.]*=[+.]*[ \\t]*(["\\])'
+ fr'^({var}{override_re})[ \\\\\t]*[?+:.]*=[+.]*[ \\t]*(["\\])'
)
return var_res

浙公网安备 33010602011771号