我按照 esp-idf 指南安装并测试构建 hello world 和眨眼示例代码,但这两个代码都遇到了这个问题。
> Executing task: ninja <
ninja: error: loading 'build.ninja': The system cannot find the file specified.
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command ninja " terminated with exit code: 1.
我已经测试了所有可以找到的修复方法,但我不确定我是否错过了什么。
C:\Espressif\frameworks\esp-idf-v4.4>python -m pip install --user -r %IDF_PATH%/requirements.txt
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
这个可能的问题是Python环境存在,所以我无法执行此命令,但我尝试了很多方法来禁用或停用它仍然不能。
在尝试调试很长时间后,我制作了整个项目文件夹的备份副本,然后疯狂删除文件。我删除了几乎所有不是我创作的文件。只剩下
main/CMakeLists.txt
、main/component.mk
、main/main.c
、main/main.h
、.gitignore
、CMakeLists.txt
和Makefile
。然后我运行了 idf.py set-target esp32
和 idf.py -p /dev/ttyACM0 flash monitor
,它再次正常工作。
Ubuntu 20.04.05 LTS 上的 VS Code 和 ESP-IDF
检查编译器是否选择正确。如果您没有选择正确的 c/c++ 编译器,那么您可能会收到此错误。我的系统中有 mingw,但 VS Code 没有自动检测编译器。然后我手动添加了mingw并选择它进行编译,之后这个问题就解决了。
更新到新的稳定版本(v5.0)后对我有用的是
install.bat
及稍后的export.bat
ESP-IDF:Configure Paths
idf.py build
没有
ninja.build
存在是忍者未构建的症状,这可能是由多种原因引起的。对我来说,这发生在我运行命令之后:
git clone https://github.com/microsoft/vcpkg
cd vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg install openblas:x64-windows
Computing installation plan...
A suitable version of cmake was not found (required v3.29.0) Downloading portable cmake 3.29.0...
Downloading cmake...
https://github.com/Kitware/CMake/releases/download/v3.29.0/cmake-3.29.0-windows-i386.zip->C:\Users\Michael Currie\Desktop\GitHub\vcpkg\downloads\cmake-3.29.0-windows-i386.zip
Downloading https://github.com/Kitware/CMake/releases/download/v3.29.0/cmake-3.29.0-windows-i386.zip
Extracting cmake..
问题1:正在下载i386版本的cmake!但我的电脑是64位的!
PS C:\Users\Michael Currie> wmic os get osarchitecture
OSArchitecture
64-bit
哦,
vcpkg
,你这个可爱的夏天孩子,下载前请检查计算机的架构cmake
- 你抓错版本了!!
问题2:我路径中的cmake版本是3.26,即使在上述尝试安装3.29之后仍然在使用。因此要解决这两个问题:
cmake
3.26,并且问题3:我需要在PowerShell 7.0或更高版本中运行上述命令。所以我需要:
从 https://github.com/PowerShell/PowerShell/releases/download/v7.2.16/PowerShell-7.2.16-win-x64.msi安装 Powershell,然后
从“开始”->“运行”->“Powershell 7”手动运行它
通过命令检查您的版本是否有 Major >= 7
$PSVersionTable.PSVersion
(请注意,您无法在 C:\Windows\System32\WindowsPowerShell 1.0 中卸载 Powershell 1.0(它不在“添加或删除程序”中!),请参阅 https://superuser.com/questions/1503460/how-to-reinstall -powershell-on-windows-10)
问题4问题仍然存在,但根据https://github.com/microsoft/vcpkg/issues/29702我需要安装带有C++的Visual Studio桌面开发以及Windows 10 SDK。所以我就这么做了。
解决上述 4 个问题后,我从计算机中完全删除了 vcpkg 文件夹,然后运行上面列出的第一条命令,构建 openblas 成功了!耶。
您没有
build.ninja
文件。在项目上找到这个文件