乐鑫技术交流
直播中

李娜

8年用户 1723经验值
私信 关注
[问答]

在Ubuntu20.04.2 LTS上搭建ESP-IDF环境报错怎么解决?

我在Ubuntu20.04.2 LTS上搭建ESP-IDF环境,按照编程指南快速入门进行了相关配置,但是当我在“Hello_word”执行“idf.py menuconfig
”,出现了以下报错。请问该如何解决?
[
:~/esp/esp-idf/examples/get-started/hello_world$ idf.py menuconfig
fatal: 没有发现名称,无法描述任何东西。
WARNING: Git describe was unsuccessful: b''
Executing action: menuconfig
Running cmake in directory /home/carlton/esp/esp-idf/examples/get-started/hello_world/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DCCACHE_ENABLE=0 /home/carlton/esp/esp-idf/examples/get-started/hello_world"...
-- IDF_TARGET not set, using default target: esp32
-- Found Git: /usr/bin/git (found version "2.25.1")
CMake Error at build/CMakeFiles/git-data/grabRef.cmake:48 (file):
  file failed to open for reading (No such file or directory):

    /home/carlton/esp/esp-idf/examples/get-started/hello_world/build/CMakeFiles/git-data/head-ref
Call Stack (most recent call first):
  /home/carlton/esp/esp-idf/tools/cmake/third_party/GetGitRevisionDescription.cmake:80 (include)
  /home/carlton/esp/esp-idf/tools/cmake/third_party/GetGitRevisionDescription.cmake:90 (get_git_head_revision)
  /home/carlton/esp/esp-idf/tools/cmake/build.cmake:67 (git_describe)
  /home/carlton/esp/esp-idf/tools/cmake/build.cmake:171 (__build_get_idf_git_revision)
  /home/carlton/esp/esp-idf/tools/cmake/idf.cmake:51 (__build_init)
  /home/carlton/esp/esp-idf/tools/cmake/project.cmake:12 (include)
  CMakeLists.txt:5 (include)


-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/carlton/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /home/carlton/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /home/carlton/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/carlton/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++
-- Check for working CXX compiler: /home/carlton/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at build/CMakeFiles/git-data/grabRef.cmake:48 (file):
  file failed to open for reading (No such file or directory):

    /home/carlton/esp/esp-idf/examples/get-started/hello_world/build/CMakeFiles/git-data/head-ref
Call Stack (most recent call first):
  /home/carlton/esp/esp-idf/tools/cmake/third_party/GetGitRevisionDescription.cmake:80 (include)
  /home/carlton/esp/esp-idf/tools/cmake/third_party/GetGitRevisionDescription.cmake:90 (get_git_head_revision)
  /home/carlton/esp/esp-idf/tools/cmake/project.cmake:53 (git_describe)
  /home/carlton/esp/esp-idf/tools/cmake/project.cmake:418 (__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 esp32
-- Project sdkconfig file /home/carlton/esp/esp-idf/examples/get-started/hello_world/sdkconfig
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of time_t
-- Check size of time_t - done
CMake Error at ../../../tools/cmake/component.cmake:304 (message):
  Include directory
  '/home/carlton/esp/esp-idf/components/mbedtls/mbedtls/include' is not a
  directory.
Call Stack (most recent call first):
  ../../../tools/cmake/component.cmake:477 (__component_add_include_dirs)
  ../../../components/mbedtls/CMakeLists.txt:10 (idf_component_register)


-- Configuring incomplete, errors occurred!
See also "/home/carlton/esp/esp-idf/examples/get-started/hello_world/build/CMakeFiles/CMakeOutput.log".
cmake failed with exit code 1
]
                                                                                                                                                      

回帖(1)

王强

2024-6-18 16:29:25
根据您提供的错误信息,这个问题可能是由于Git版本描述失败导致的。为了解决这个问题,请按照以下步骤操作:

1. 首先,确保您已经安装了Git。在终端中输入以下命令来检查Git是否已安装:

```
git --version
```

如果未安装,请使用以下命令安装Git:

```
sudo apt update
sudo apt install git
```

2. 确保您的Git配置正确。在终端中输入以下命令来检查您的Git配置:

```
git config --list
```

如果您看到一些配置信息,那么您的Git配置应该是正确的。如果没有,请根据您的需求配置Git。

3. 检查您的ESP-IDF版本。在终端中输入以下命令来检查您的ESP-IDF版本:

```
python -m pip show espidf
```

如果您看到版本信息,那么您的ESP-IDF应该已经安装好了。如果没有,请按照官方文档安装ESP-IDF。

4. 确保您的ESP-IDF环境变量设置正确。在终端中输入以下命令来检查您的环境变量:

```
echo $IDF_PATH
```

如果返回的路径是您的ESP-IDF安装路径,那么您的环境变量设置应该是正确的。如果不是,请按照官方文档设置环境变量。

5. 尝试重新运行`idf.py menuconfig`命令。在终端中输入以下命令:

```
cd ~/esp/esp-idf/examples/get-started/hello_world
idf.py menuconfig
```

如果问题仍然存在,请尝试以下命令来清理并重新构建项目:

```
idf.py fullclean
idf.py menuconfig
```

6. 如果以上步骤都无法解决问题,您可以尝试重新安装ESP-IDF。请按照官方文档的安装指南进行操作。

希望这些步骤能帮助您解决问题。如果问题仍然存在,请提供更多详细信息,以便我们更好地帮助您。
举报

更多回帖

发帖
×
20
完善资料,
赚取积分