问题
- 编译zephyr RTOS时,使用VM ubuntu 18.04,根据zephyr 官方的指导安装了环境,编译发现报错:
imx6@imx6-vm:~/zephyrproject/zephyr$ west build -b nucleo_h743zi samples/hello_world
[1/139] Generating include/generated/kobj-t...to-str.h, include/generated/otype-to-size.h
FAILED: zephyr/include/generated/kobj-types-enum.h zephyr/include/generated/otype-to-str.h zephyr/include/generated/otype-to-size.h /home/imx6/zephyrproject/zephyr/build/zephyr/include/generated/kobj-types-enum.h /home/imx6/zephyrproject/zephyr/build/zephyr/include/generated/otype-to-str.h /home/imx6/zephyrproject/zephyr/build/zephyr/include/generated/otype-to-size.h
cd /home/imx6/zephyrproject/zephyr/build/zephyr && /usr/bin/python3.6 /home/imx6/zephyrproject/zephyr/scripts/gen_kobject_list.py --kobj-types-output /home/imx6/zephyrproject/zephyr/build/zephyr/include/generated/kobj-types-enum.h --kobj-otype-output /home/imx6/zephyrproject/zephyr/build/zephyr/include/generated/otype-to-str.h --kobj-size-output /home/imx6/zephyrproject/zephyr/build/zephyr/include/generated/otype-to-size.h --include /home/imx6/zephyrproject/zephyr/build/zephyr/misc/generated/struct_tags.json
Traceback (most recent call last):
File "/home/imx6/zephyrproject/zephyr/scripts/gen_kobject_list.py", line 62, in <module>
import elftools
ModuleNotFoundError: No module named 'elftools'
[2/139] Generating include/generated/driver-validation.h
FAILED: zephyr/include/generated/driver-validation.h /home/imx6/zephyrproject/zephyr/build/zephyr/include/generated/driver-validation.h
cd /home/imx6/zephyrproject/zephyr/build/zephyr && /usr/bin/python3.6 /home/imx6/zephyrproject/zephyr/scripts/gen_kobject_list.py --validation-output /home/imx6/zephyrproject/zephyr/build/zephyr/include/generated/driver-validation.h --include /home/imx6/zephyrproject/zephyr/build/zephyr/misc/generated/struct_tags.json
Traceback (most recent call last):
File "/home/imx6/zephyrproject/zephyr/scripts/gen_kobject_list.py", line 62, in <module>
import elftools
ModuleNotFoundError: No module named 'elftools'
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/imx6/zephyrproject/zephyr/build
- 主要的问题是:
ModuleNotFoundError: No module named 'elftools' ,python的一个模块没有找到
解决方法
- 尝试重新安装一遍zephyr官方的组件包,发现问题不能解决
- 尝试使用python pip3 安装,发现
elftools 找不到 - 尝试搜索
elftools 相关的python软件包,找到解决方法:
imx6@imx6-vm:~/zephyrproject/zephyr$ pip3 install pyelftools
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https:
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
Collecting pyelftools
Using cached pyelftools-0.27-py2.py3-none-any.whl (151 kB)
Installing collected packages: pyelftools
Successfully installed pyelftools-0.27
- 使用:
pip3 install pyelftools 解决
再次编译
imx6@imx6-vm:~/zephyrproject/zephyr$ west build -b nucleo_h743zi samples/hello_world
[132/139] Linking C executable zephyr/zephyr_prebuilt.elf
[139/139] Linking C executable zephyr/zephyr.elf
Memory region Used Size Region Size %age Used
FLASH: 15368 B 2 MB 0.73%
SRAM: 4256 B 512 KB 0.81%
DTCM: 0 GB 128 KB 0.00%
SRAM1: 0 GB 128 KB 0.00%
SRAM2: 0 GB 128 KB 0.00%
SRAM3: 16 KB 32 KB 50.00%
SRAM4: 0 GB 64 KB 0.00%
BACKUP_SRAM: 0 GB 4 KB 0.00%
IDT_LIST: 0 GB 2 KB 0.00%
|