ESP32 IDF installation error (exit code=128) - esp32

I am attempting the installation of ESP-IDF toolchain for windows with the installer from here
However the installation fails with the exit-code=128.
Since I am a newbie I am not sure if I am missing something assuming the installer will take care of installation of all the dependencies
I am attaching the logs here for the reference
System Spec:
1.OS : windows 10
2. Processor : I7-8th Gen

If you have installed git and python (I think you do if you tried to use the windows installer beforehand), you can try to install the toolchain from the terminal.
Open a CMD (Win+R, cmd, Intro)
Create a new folder (be aware that ESP-IDF does not like spaces in the path)
2.1 mkdir C:\esp
2.2 cd C:\esp
Clone the repository from git into the current directory with:
git clone -b v4.2 --recursive https://github.com/espressif/esp-idf.git . <= don't forget the . at the end
Run install.bat
Once installed, you can run in the folder you project lives c:\esp\export.bat which will set the environment variables for you to use idf.py tool.

If you are trying to install ESP-IDF on Windows and still having issues, try the latest installer with some pre-install verification.
You can download here: IDF-Installer
Alternatively, you can try this tool: idf-env

Related

ninja: error: loading 'build.ninja': The system cannot find the file specified. when build hello world in Visual studio

I have followed esp-idf guideline to install and test to build the hello world and blink sample code but both the code met this problem.
Visual studio try to build 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.
I have tested all the ways I can find to fix it but I'm not sure anything I missed or not.
This is one of the way that I test but also met some problem.
cmd try to run the command below
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.
This possible problem is the python environment is exist so I cannot do this command, but I try many ways to disabled or deactivated it still cannot.
python path
system environment
After trying to debug this for a long time, I made a backup copy of the entire project folder, then just went hog-wild deleting files. I deleted almost every file I didn't author. Only left the main/CMakeLists.txt, main/component.mk, main/main.c, main/main.h, .gitignore, CMakeLists.txt, and Makefile. Then I ran idf.py set-target esp32 and idf.py -p /dev/ttyACM0 flash monitor and it worked fine again.
VS Code & ESP-IDF on Ubuntu 20.04.05 LTS
Check if the compiler is properly selected. If you don't select a proper c/c++ compiler, then you might get this error. I had mingw in my system, but vs code did not auto detect the compiler. Then I manually added mingw and selected it for compilation after which this issue was resolved.
What worked for me after updating to the new stable release (v5.0) was
Go to the folder S:\esp\esp-idf\esp-idf-v5.0
Run command prompt at this directory and execute install.bat and later export.bat
After trying to build the program in VSCode the error "ninja: error: loading 'build.ninja'" shows up.
Update the path in the ESP-IDF extension in VSCode using ESP-IDF:Configure Paths
locate your project folder e.g. "V:\simpleTest_using_EspIDF_v5_0"
Open command prompt and execute: idf.py build
Now it builds also in VSCode using the Espressif IDF extension.
You not have a build.ninja file. Find this file on proje

How to install and use "make" in Windows?

I'm following the instructions of someone whose repository I cloned to my machine. I want to use the make command as part of setting up the code environment, but I'm using Windows. I searched online, but I could only find a make.exe file, a make-4.1.tar.gz file (I don't know what to do with it next) and instructions for how to download MinGW (for GNU; but after installing it I didn't find any mention of "make").
How do I use make in Windows without a GNU compiler or related packages?
make is a GNU command so the only way you can get it on Windows is installing a Windows version like the one provided by GNUWin32. Anyway, there are several options for getting that:
The most simple choice is using Chocolatey. First you need to install this package manager. Once installed you simlpy need to install make (you may need to run it in an elevated/admin command prompt) :
choco install make
Other recommended option is installing a Windows Subsystem for Linux (WSL/WSL2), so you'll have a Linux distribution of your choice embedded in Windows 10 where you'll be able to install make, gccand all the tools you need to build C programs.
For older Windows versions (MS Windows 2000 / XP / 2003 / Vista / 2008 / 7 with msvcrt.dll) you can use GnuWin32.
An outdated alternative was MinGw, but the project seems to be abandoned so it's better to go for one of the previous choices.
GNU make is available on chocolatey.
Install chocolatey from here.
Then, choco install make.
Now you will be able to use Make on windows.
I've tried using it on MinGW, but it should work on CMD as well.
The accepted answer is a bad idea in general because the manually created make.exe will stick around and can potentially cause unexpected problems. It actually breaks RubyInstaller: https://github.com/oneclick/rubyinstaller2/issues/105
An alternative is installing make via Chocolatey (as pointed out by #Vasantha Ganesh K)
Another alternative is installing MSYS2 from Chocolatey and using make from C:\tools\msys64\usr\bin. If make isn't installed automatically with MSYS2 you need to install it manually via pacman -S make (as pointed out by #Thad Guidry and #Luke).
If you're using Windows 10, it is built into the Linux subsystem feature. Just launch a Bash prompt (press the Windows key, then type bash and choose "Bash on Ubuntu on Windows"), cd to the directory you want to make and type make.
FWIW, the Windows drives are found in /mnt, e.g. C:\ drive is /mnt/c in Bash.
If Bash isn't available from your start menu, here are instructions for turning on that Windows feature (64-bit Windows only):
https://learn.microsoft.com/en-us/windows/wsl/install-win10
Download make.exe from their official site GnuWin32
In the Download session, click
Complete package, except sources.
Follow the installation instructions.
Once finished, add the <installation directory>/bin/ to the PATH variable.
Now you will be able to use make in cmd.
Install Msys2 http://www.msys2.org
Follow installation instructions
Install make with $ pacman -S make gettext base-devel
Add C:\msys64\usr\bin\ to your path
On windows 10 or 11, you can run the command winget install GnuWin32.Make in the command line or powershell to quickly install it. Than you can use the command cmake.
There is no need to install choco anymore.
The chances are that besides GNU make, you'll also need many of the coreutils. Touch, rm, cp, sed, test, tee, echo and the like. The build system might require bash features, if for nothing else, it's popular to create temp file names from the process ID ($$$$). That won't work without bash. You can get everything with the popular POSIX emulators for Windows:
Cygwin (http://www.cygwin.org/) Probably the most popular one and the most compatible with POSIX. Has some difficulties with Windows paths and it's slow.
GNUWin (http://gnuwin32.sourceforge.net/) It was good and fast but now abandoned. No bash provided, but it's possible to use it from other packages.
ezwinports (https://sourceforge.net/projects/ezwinports) My current favorite. Fast and works well. There is no bash provided with it, that can be a problem for some build systems. It's possible to use make from ezwinports and bash from Cygwin or MSYS2 as a workaround.
MSYS 1.19 abandoned. Worked well but featured very old make (3.86 or so)
MSYS2 (https://www.msys2.org/) Works well, second fastest solution after ezwinports. Good quality, package manager (pacman), all tooling available. I'd recommend this one.
MinGW abandoned? There was usually MSYS 1.19 bundled with MinGW packages, that contained an old make.exe. Use mingw32-make.exe from the package, that's more up to date.
Note that you might not be able to select your environment. If the build system was created for Cygwin, it might not work in other environments without modifications (The make language is the same, but escaping, path conversion are working differently, $(realpath) fails on Windows paths, DOS bat files are started as shell scripts and many similar issues). If it's from Linux, you might need to use a real Linux or WSL.
If the compiler is running on Linux, there is no point in installing make for Windows, because you'll have to run both make and the compiler on Linux. In the same way, if the compiler is running on Windows, WSL won't help, because in that environment you can only execute Linux tools, not Windows executables. It's a bit tricky!
I could suggest a step by step approach.
Visit GNUwin
Download the Setup Program
Follow the instructions and install GNUWin. You should pay attention to the directory where your application is being installed. (You will need it later1)
Follow these instructions and add make to your environment variables. As I told you before, now it is time to know where your application was installed.
FYI: The default directory is C:\Program Files (x86)\GnuWin32\.
Now, update the PATH to include the bin directory of the newly installed program.
A typical example of what one might add to the path is: ...;C:\Program Files (x86)\GnuWin32\bin
Another alternative is if you already installed minGW and added the bin folder the to Path environment variable, you can use "mingw32-make" instead of "make".
You can also create a symlink from "make" to "mingw32-make", or copying and changing the name of the file. I would not recommend the options before, they will work until you do changes on the minGW.
I once had the same problem. But I am surprised not to find one particular solution here.
Installation from GnuWin32 or via winget are good and easy options. But I only found make 3.8.1 there. This version lacks the very important option -O, which handles the output correctly when compiling multithreaded.
choco appears to offer make 4.3, currently. So one could expect recent versions there.
But there is also the option of self compiling. And if you have to install make, which is used for compiling, this should be a valid option.
head to https://www.gnu.org/software/make/ and download a version of your liking
unpack the tar.gz files (use 7zip and unpack the file twice to retrieve the actual content)
navigate to the created directory
open command prompt in that directory
run build_w32.bat gcc This will start the compilation with the gcc compiler, which you would need to install in advance. When running build_w32.bat without any option they try to use the MSVC compiler. Sidenote: I found it surprising that gnu does not use gcc as default but MSVC :-)
ignore the warnings created during compilation. The result should still be fine
retrieve your fresh gnumake.exe from the directoy GccRel (when compiled with gcc)
put this file somewhere where you like and rename to make.exe
add the location to the system variable %PATH%
As others have noted: This manual installation might cause conflicts if you have various make versions installed by other programs as well.
You can also install scoop, then run:
scoop install make
One solution that may helpful if you want to use the command line emulator cmder. You can install the package installer chocately. First we install chocately in windows command prompt using the following line:
#"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
refreshenv
After chocolatey is installed the choco command can be used to install make. Once installed, you will need add an alias to /cmder/config/user_aliases.cmd. The following line should be added:
make="path_to_chocolatey\chocolatey\bin\make.exe" $*
Make will then operate in the cmder environment.
Install npm
install Node
Install Make
node install make up
node install make
If above commands displays any error then install Chocolatey(choco)
Open cmd and copy and paste the below command (command copied from chocolatey URL)
#"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command " [System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

Cygpath troubleshooting with Jenkins and Windows slave

I have a remote Windows computer with Cygwin 1.7.35 installed on it and we use it as a slave for CI testing with Jenkins.
I created a Jenkins job to build a Maven project (after cloning from repository).
The Jenkins contains Cygpath 1.5 plugin and the registry path to Cygwin is SOFTWARE/Cygwin/Setup
I use a PreStep to clone the project from a repository:
source ~/.profile > /dev/null
cd /cygdrive/c
rm -rf .$WORKSPACE/project-name
hg clone something something
The repository clone works fine.
The build fails and I get this error in the console output:
ERROR: Failed to parse POMs
hudson.util.IOException2: Failed to locate Cygwin installation. Is Cygwin installed?
at hudson.plugins.cygpath.CygpathLauncherDecorator$GetCygpathTask.getCygwinRoot(CygpathLauncherDecorator.java:138)
etc...
I tried rewriting the Path variable from C:\cygwin64\bin to C:/cygwin64/bin and back.
I tried this on Cygwin 1.7.32 first and then on 1.7.35 again.
I tried changing the path in the registry entry from C:\Cygwin64 to C:Cygwin64\bin and back.
Nothing works.
My colleague builds his project on the same Jenkins server with the same slave, but he is using an Ant project with build.xml and it works just fine.
Please, do you have any suggestions on how to solve this?
Thanks!
Peter
I found an answer.
I created a new registry entry under
SOFTWARE\Cygnus Solutions\Cygwin\
string rootdir aiming to cygwin64.
Which is strange, because in my Jenkins I use cygpath 1.5 which should find the correct path of Cygwin installation which is under registry path SOFTWARE\Cygwin\setup.
I also had to change the Jenkins slave machine configuration, because the slave machine Java SDK version is different than Java SDK version in global Jenkins settings.
I hope that someone finds this helpful!
Peter
I looked in the source code of the file which threw the exception and found out that it wants a string from the key
'HKLM/SOFTWARE/Wow6432Node/Cygwin/setup'
named 'rootdir' which has the absolute path to your Cygwin installation.
Edit: I ended up creating the key 'setup' because it didn't exist.

I can't "go get" a dependency from github

I made a golang app on my machine that uses cron. On my machine, I
"go get github.com/robfig/cron"
to download and install dependency then in my app I
"import cron "github.com/rk/go-cron""
the app works fine and runs the way I want. I then upload it to the server where it's supposed to run and try to "go get github.com/robfig/cron" as I did on my machine, but then it gave me this
I downloaded and installed github but still the same result. I'm guessing the problem is with github on my server machine
I am new to golang and andy kind of help would be greatly appreciated. Thanks.
What you need to install is git. It is the version control system (VCS) used by GitHub.
The native GitHub application does not provide the command line tools used by Go.
Git can be found and downloaded at http://git-scm.com/downloads
Once installed, make sure you have the path to the Git cmd folder in your %PATH% environment variable.
You can check this by running the command: echo %PATH%
On a Windows installation, you might find it located here:
C:\Program Files (x86)\Git\cmd

GAE Go Windows - "Cannot run program", "is not a valid Win32 application"

I've been trying to run a GAE Go project I developed on my Mac on my Windows machine with GoClipse after installing and configuring the appropriate SDKs and so forth. When attempting to run the project, I get this error:
Exception occurred executing command line. Cannot run program
"C:\GoogleAppEngine\dev_appserver.py" (in directory
"D:\Golang\workspace\Project\src\pkg"): CreateProcess
error=193, %1 is not a valid Win32 application
How can I fix that error in order to run my project?
While the below configuration works on the Mac as it has Python installed by default, Windows requires a different configuration.
On Mac the GoClipse External Tools Configuration would be:
Location: /GoogleAppEngine/dev_appserver.py
Working Directory: ${workspace_loc:/Project/src/pkg}
Arguments: .
The Windows configuration should look like:
Location: C:\Python27\Python.exe
Working Directory:
Arguments: C:\GoogleAppEngine\dev_appserver.py "${workspace_loc:/Project/src/pkg}"
Trying to run .py (Which IMO is a Python file?) wont work directly on windows. You will need to install Python and then pass the above filename to Python something like (I don't know Python so don't go by exact syntax, you might need to look around)
python "C:\GoogleAppEngine\dev_appserver.py
The reason it's working on Mac is because Python comes pre-installed on mac as cited here But on windows it doesn't. So you can install Python and add the Python's bin folder to path, and then run above script and it should run fine!

Resources