求助 按快速入门编译例程时报错未找到.../CMakeFiles/git-data/head-ref

bbdalao
Posts: 4
Joined: Tue Oct 05, 2021 12:47 pm

求助 按快速入门编译例程时报错未找到.../CMakeFiles/git-data/head-ref

Postby bbdalao » Sat Oct 09, 2021 7:36 am

我是按照官方教程一步步走的,但在执行idf.py set-target esp32时出现报错:
CMake Error at build/CMakeFiles/git-data/grabRef.cmake:48 (file):
file failed to open for reading (No such file or directory):

D:/Programs/esp-idf/examples/get-started/hello_world/build/CMakeFiles/git-data/head-ref
我打开git-data文件夹,确实没有找到head-ref文件,里面只有grabRef.cmake文件和HEAD文件。即使不管报错继续执行idf.py build也无法编译,出现几乎相同的报错。百度完全没有查询到相关信息,也请大家和审核大大帮帮我 :cry: 我不管是用什么教程都会遇到错误,编译不了例程 上次发的Visual Studio Code插件配置问题也没有人回复 :cry:

以下是CMD内信息:
D:\Programs\esp-idf\examples\get-started\hello_world>D:\Programs\esp-idf\export.bat
Setting IDF_PATH: D:\Programs\esp-idf

Adding ESP-IDF tools to PATH...
fatal: No names found, cannot describe anything.
WARNING: Git describe was unsuccessful: b''
D:\Programs\esp-tools\tools\xtensa-esp32s2-elf\esp-2021r1-8.4.0\xtensa-esp32s2-elf\bin
D:\Programs\esp-tools\tools\xtensa-esp32s3-elf\esp-2021r1-8.4.0\xtensa-esp32s3-elf\bin
D:\Programs\esp-tools\tools\riscv32-esp-elf\esp-2021r1-8.4.0\riscv32-esp-elf\bin
D:\Programs\esp-tools\tools\esp32ulp-elf\2.28.51-esp-20191205\esp32ulp-elf-binutils\bin
D:\Programs\esp-tools\tools\esp32s2ulp-elf\2.28.51-esp-20191205\esp32s2ulp-elf-binutils\bin
D:\Programs\esp-tools\tools\openocd-esp32\v0.10.0-esp32-20210902\openocd-esp32\bin
D:\Programs\esp-tools\tools\ninja\1.10.2\
D:\Programs\esp-tools\tools\idf-exe\1.0.1\
D:\Programs\esp-tools\tools\ccache\4.3\ccache-4.3-windows-64
D:\Programs\esp-tools\tools\dfu-util\0.9\dfu-util-0.9-win64
D:\Programs\esp-tools\python_env\idf4.4_py3.6_env\Scripts
D:\Programs\esp-idf\tools

Checking if Python packages are up to date...
Python requirements from D:\Programs\esp-idf\requirements.txt are satisfied.

Done! You can now compile ESP-IDF projects.
Go to the project directory and run:

idf.py build


D:\Programs\esp-idf\examples\get-started\hello_world>idf.py set-target esp32
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Directory 'd:\programs\esp-idf\examples\get-started\hello_world\build' doesn't seem to be a CMake build directory. Refusing to automatically delete files in this directory. Delete the directory manually to 'clean' it.

D:\Programs\esp-idf\examples\get-started\hello_world>idf.py set-target esp32
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Build directory 'd:\programs\esp-idf\examples\get-started\hello_world\build' not found. Nothing to clean.
Executing action: set-target
Set Target to: esp32, new sdkconfig created. Existing sdkconfig renamed to sdkconfig.old.
Running cmake in directory d:\programs\esp-idf\examples\get-started\hello_world\build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32 -DCCACHE_ENABLE=1 d:\programs\esp-idf\examples\get-started\hello_world"...
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.33.0.windows.2")
CMake Error at build/CMakeFiles/git-data/grabRef.cmake:48 (file):
file failed to open for reading (No such file or directory):

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


CMake Warning at D:/Programs/esp-idf/tools/cmake/git_submodules.cmake:52 (message):
Git submodule is out of date. Run 'git submodule update --init
--recursive' to fix.
Call Stack (most recent call first):
D:/Programs/esp-idf/tools/cmake/build.cmake:77 (git_submodule_check)
D:/Programs/esp-idf/tools/cmake/build.cmake:174 (__build_get_idf_git_revision)
D:/Programs/esp-idf/tools/cmake/idf.cmake:50 (__build_init)
D:/Programs/esp-idf/tools/cmake/project.cmake:12 (include)
CMakeLists.txt:5 (include)


CMake Error at D:/Programs/esp-idf/tools/cmake/git_submodules.cmake:57 (get_filename_component):
get_filename_component unknown component BASE_DIR
Call Stack (most recent call first):
D:/Programs/esp-idf/tools/cmake/build.cmake:77 (git_submodule_check)
D:/Programs/esp-idf/tools/cmake/build.cmake:174 (__build_get_idf_git_revision)
D:/Programs/esp-idf/tools/cmake/idf.cmake:50 (__build_init)
D:/Programs/esp-idf/tools/cmake/project.cmake:12 (include)
CMakeLists.txt:5 (include)


-- Configuring incomplete, errors occurred!
cmake failed with exit code 1

D:\Programs\esp-idf\examples\get-started\hello_world>git submodule update --init

D:\Programs\esp-idf\examples\get-started\hello_world>

ESP_ICY
Posts: 404
Joined: Mon Aug 23, 2021 11:10 am

Re: 求助 按快速入门编译例程时报错未找到.../CMakeFiles/git-data/head-ref

Postby ESP_ICY » Sat Oct 09, 2021 12:22 pm

看LOG 信息 ,提示你需要更新子模块, 试过 git submodule update --init --recursive 这个命令了吗

bbdalao
Posts: 4
Joined: Tue Oct 05, 2021 12:47 pm

Re: 求助 按快速入门编译例程时报错未找到.../CMakeFiles/git-data/head-ref

Postby bbdalao » Tue Oct 12, 2021 6:37 am

试过了,可惜没什么变化 :( 不过我用了VS Code插件,结合一篇github帖子的修改Build成功了,希望以后别再遇到问题:D

bbdalao
Posts: 4
Joined: Tue Oct 05, 2021 12:47 pm

Re: 求助 按快速入门编译例程时报错未找到.../CMakeFiles/git-data/head-ref

Postby bbdalao » Tue Oct 12, 2021 6:38 am

我最后按照https://www.bilibili.com/video/BV17p4y167uN?fro ... 337.0.0的教程,结合一点在github上看到的修改,build成功了例程,希望不要再遇到问题 :(
如果在Build例程的时候第六百多步提示Generating x509_crt_bundle FAILED: esp-idf/mbedtls/x509_crt_bundle 然后下面写着Invalid certificate的话,按照https://github.com/espressif/esp-idf/issues/7621的回答来操作:Visual Studio里 查看-命令面板-搜索 SDK Configuration editor-在它的搜索栏里查询 Certificate-点掉Enable trusted root certificate bundle的勾 然后在它的搜索栏旁边点击保存 重新Build就可以pass掉这个错误 按照原回答所述,是因为有一些证书过期了,希望@乐鑫信息科技 能够修复一下
其他的问题我就不了解了[呆]我第一次用ESP-IDF 希望以后别遇到类似的bug了[笑哭]

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

Re: 求助 按快速入门编译例程时报错未找到.../CMakeFiles/git-data/head-ref

Postby ESP_Gargamel » Tue Oct 12, 2021 10:57 am

后面证书的 fail 和你之前的 fail 是两回事,你最好一个归一个讲。

Who is online

Users browsing this forum: No registered users and 89 guests