CentOS 7: idf.py menuconfig 编译出错

Leewayz
Posts: 8
Joined: Fri Jan 07, 2022 12:23 pm

CentOS 7: idf.py menuconfig 编译出错

Postby Leewayz » Mon Jul 18, 2022 2:55 pm

[root@localhost hello_world]# idf.py menuconfig
Executing action: menuconfig
Running cmake in directory /root/esp/hello_world/build
Executing "cmake -G 'Unix Makefiles' -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32c3 -DCCACHE_ENABLE=0 /root/esp/hello_world"...
-- Found Git: /usr/bin/git (found version "1.8.3.1")
fatal: Not a git repository (or any of the parent directories): .git
CMake Error at build/CMakeFiles/git-data/grabRef.cmake:48 (file):
file failed to open for reading (No such file or directory):

/root/esp/hello_world/build/CMakeFiles/git-data/head-ref
Call Stack (most recent call first):
/root/esp/esp-idf/tools/cmake/third_party/GetGitRevisionDescription.cmake:80 (include)
/root/esp/esp-idf/tools/cmake/third_party/GetGitRevisionDescription.cmake:90 (get_git_head_revision)
/root/esp/esp-idf/tools/cmake/project.cmake:59 (git_describe)
/root/esp/esp-idf/tools/cmake/project.cmake:380 (__project_get_revision)
CMakeLists.txt:6 (project)


-- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.
-- Building ESP-IDF components for target esp32c3
-- Project sdkconfig file /root/esp/hello_world/sdkconfig
CMake Error at /root/esp/esp-idf/tools/cmake/component.cmake:300 (message):
Include directory '/root/esp/esp-idf/components/mbedtls/mbedtls/include' is
not a directory.
Call Stack (most recent call first):
/root/esp/esp-idf/tools/cmake/component.cmake:473 (__component_add_include_dirs)
/root/esp/esp-idf/components/mbedtls/CMakeLists.txt:18 (idf_component_register)


-- Configuring incomplete, errors occurred!
See also "/root/esp/hello_world/build/CMakeFiles/CMakeOutput.log".
cmake failed with exit code 1
[root@localhost hello_world]#

ESP_Gargamel
Posts: 786
Joined: Wed Nov 14, 2018 8:45 am

Re: idf.py set-target esp32 idf.py menuconfig编译出错

Postby ESP_Gargamel » Tue Jul 19, 2022 1:47 am

使用的是哪个 IDF 版本?

可以试一下以下几种方式:
1、删除 build 重新试一下
2、更新一下 git 版本,到 2.3x 版本
3、更新一下 cmake,到 3.5+ 版本

Leewayz
Posts: 8
Joined: Fri Jan 07, 2022 12:23 pm

Re: CentOS 7: idf.py menuconfig 编译出错

Postby Leewayz » Tue Jul 19, 2022 3:56 am

我安装的是4.4的版本
build之前删除试过了不行

[root@localhost hello_world]# git version
git version 2.31.1
[root@localhost hello_world]# cmake --version
cmake version 3.6.2

究竟是什么地方出了问题,麻烦您帮忙看一下,先谢了!

ESP_Gargamel
Posts: 786
Joined: Wed Nov 14, 2018 8:45 am

Re: CentOS 7: idf.py menuconfig 编译出错

Postby ESP_Gargamel » Tue Jul 19, 2022 6:26 am

从你的错误 log 上看,有两个信息:
1、

Code: Select all

fatal: Not a git repository (or any of the parent directories): .git
CMake Error at build/CMakeFiles/git-data/grabRef.cmake:48 (file):
file failed to open for reading (No such file or directory):

/root/esp/hello_world/build/CMakeFiles/git-data/head-ref
Call Stack (most recent call first):
/root/esp/esp-idf/tools/cmake/third_party/GetGitRevisionDescription.cmake:80 (include)
/root/esp/esp-idf/tools/cmake/third_party/GetGitRevisionDescription.cmake:90 (get_git_head_revision)
/root/esp/esp-idf/tools/cmake/project.cmake:59 (git_describe)
/root/esp/esp-idf/tools/cmake/project.cmake:380 (__project_get_revision)
CMakeLists.txt:6 (project)
这个看上去 esp-idf 没有 git 信息,你是怎么下载 esp-idf 的?github 上直接下的压缩包?Download zip 的方式?
你可以 ls -la /root/esp/esp-idf 看下有没有 .git 目录。

2、

Code: Select all

CMake Error at /root/esp/esp-idf/tools/cmake/component.cmake:300 (message):
Include directory '/root/esp/esp-idf/components/mbedtls/mbedtls/include' is
not a directory.
这个看上去是一些 component 不全。你可以看下 ls -la /root/esp/esp-idf/components/mbedtls/mbedtls/ 有没有东西。

所以猜测你是用类似 https://github.com/espressif/esp-idf/ar ... v4.4.1.zip 这样的链接下载的。如果你要下载 zip,那需要到 https://github.com/espressif/esp-idf/re ... tag/v4.4.1 页面最下面,Assets 选第一个下载。链接类似 https://github.com/espressif/esp-idf/re ... v4.4.1.zip,这个会包含完整的 git 信息和完整的 components。

建议你用 git 的方式拉取整个仓库,因为国内访问 github 比较慢,你可以参看 https://gitee.com/EspressifSystems/esp-gitee-tools 的方式。如果你需要使用 v4.4 版本,可以如下操作:

Code: Select all

git clone https://gitee.com/EspressifSystems/esp-gitee-tools.git
git clone --single-branch --branch release/v4.4 https://gitee.com/EspressifSystems/esp-idf.git
cd esp-gitee-tools
./submodule-update.sh ../esp-idf

Leewayz
Posts: 8
Joined: Fri Jan 07, 2022 12:23 pm

Re: CentOS 7: idf.py menuconfig 编译出错

Postby Leewayz » Tue Jul 19, 2022 12:39 pm

是的,因为在linux环境下载idf非常慢,导致下载超时,没有办法我只用windows平台在官网上下载linux版本的zip文件idf,然后解压拷贝到linux平台里面安装

我按照你的提供的方法去操作,有一个错误,我在百度上搜找不到解决的办法,麻烦您再帮忙看看,谢了!

[root@localhost esp-idf]# . /root/esp/esp-idf/export.sh
Detecting the Python interpreter
Checking "python" ...
Python 3.6.8
"python" has been detected
Adding ESP-IDF tools to PATH...
fatal: not a git repository (or any of the parent directories): .git
WARNING: Git describe was unsuccessful: b''
Using Python interpreter in /root/.espressif/python_env/idf4.4_py3.6_env/bin/python
Checking if Python packages are up to date...
Python requirements from /root/esp/esp-idf/requirements.txt are satisfied.
Added the following directories to PATH:
/root/esp/esp-idf/components/esptool_py/esptool
/root/esp/esp-idf/components/espcoredump
/root/esp/esp-idf/components/partition_table
/root/esp/esp-idf/components/app_update
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:

idf.py build

Traceback (most recent call last):
File "/root/esp/esp-idf/tools/idf.py", line 816, in <module>
main()
File "/root/esp/esp-idf/tools/idf.py", line 734, in main
cli(sys.argv[1:], prog_name=PROG, complete_var='_IDF.PY_COMPLETE')
File "/root/.espressif/python_env/idf4.4_py3.6_env/lib/python3.6/site-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/root/.espressif/python_env/idf4.4_py3.6_env/lib/python3.6/site-packages/click/core.py", line 1048, in main
self._main_shell_completion(extra, prog_name, complete_var)
File "/root/.espressif/python_env/idf4.4_py3.6_env/lib/python3.6/site-packages/click/core.py", line 1123, in _main_shell_completion
rv = shell_complete(self, ctx_args, prog_name, complete_var, instruction)
File "/root/.espressif/python_env/idf4.4_py3.6_env/lib/python3.6/site-packages/click/shell_completion.py", line 45, in shell_complete
echo(comp.source())
File "/root/.espressif/python_env/idf4.4_py3.6_env/lib/python3.6/site-packages/click/shell_completion.py", line 326, in source
self._check_version()
File "/root/.espressif/python_env/idf4.4_py3.6_env/lib/python3.6/site-packages/click/shell_completion.py", line 316, in _check_version
"Shell completion is not supported for Bash"
RuntimeError: Shell completion is not supported for Bash versions older than 4.4.

ESP_Gargamel
Posts: 786
Joined: Wed Nov 14, 2018 8:45 am

Re: CentOS 7: idf.py menuconfig 编译出错

Postby ESP_Gargamel » Wed Jul 20, 2022 2:17 am

这个是小问题了,是 CentOS 7 的 bash 的版本比较低。你可以参看下 https://korwah.com/77.html 升级 bash。
另外,用 Ubuntu 在环境上会省点事,推荐使用。

Who is online

Users browsing this forum: No registered users and 65 guests