Issue building Firmware locally on Windows 10 [SOLVED]

Hello folks,

I'm new to this community. I have started working on Photon from about a week now. I primarily use Windows 10 as my development platform. I have been able to setup Particle Cli and get my Photon device up and running.

I have been facing issues building the Firmware locally on my Win 10 machine. I have the following tools installed.

  1. Particle Cli
  2. MinGW - W64-builds-4.2.0
  3. GNU ARM compiler - gcc-arm-none-eabi-4_9-2015q3-20150921-win32
  4. MSYS - v1.0.11

I have setup GIT Bash as the default shell. I followed these steps to build Firmware

I see the following error, when I tried to execute a make clean command.

Karthik@KARTHIK-PC ~/Documents/GitHub/firmware/modules (latest)
$ make clean all PLATFORM=photon -s program-dfu
clean all program-dfu
/bin/sh: line 1: stat: command not found
head: -38: invalid number of bytes
../../../build/module.mk:159: recipe for target '../../../build/target/system-part1/platform-6-m/system-part1.bin' failed
make[1]: *** [../../../build/target/system-part1/platform-6-m/system-part1.bin] Error 1
makefile:81: recipe for target 'c:/Users/Karthik/Documents/GitHub/firmware/modules/photon/system-part1/makefile' failed
make: *** [c:/Users/Karthik/Documents/GitHub/firmware/modules/photon/system-part1/makefile] Error 2

A similar error, related to stat has been previously reported by @wesner0019 on this thread .

I tried adding the MSYS bin to the System PATH variable too. Nothing seems to be working.
Should I install stat.exe separately? Isn't it part of MSYS? Any ideas? Please help me fix this issue.

-Karthik

Update:
I managed to get stat.exe from sourceforge, but I now see that stat crashes, exactly as the others have reported, during compilation.

I had the exact same behaviour with (Win10Pro 64bit - also with GIT bash) till I found out that my PATH (in bash) was not set correctly, so I cleaned up my system PATH and went to Windows’ own PowerShell (bash still didn’t like my new PATH).
I didn’t have to download stat.exe tho’.

You might have multiple instances/locations of programs in your PATH causing a muddle up :wink:

@karthikuvce, in my own experience, PATH is everything. Make sure you only have a single path for your the dependencies. In your case, MinGW and MSYS in your path may be the issue (I use only MinGW). This is the significant part of my path:

C:\Program Files\nodejs\;C:\Git\cmd;c:\Python27;C:\Python27\Scripts;C:\win32-mingw32;C:\Program Files (x86)\GNU Tools ARM Embedded\4.9 2015q2\bin;C:\Program Files(x86)\GnuWin32\bin;C:\MinGW\msys\1.0\bin;C:\Git\bin;C:\SPARK\openocd\bin-x64

You can ignore Git, Python and openocd for local compiling and debuging. Hope that helps!

Thanks @ScruffR @peekay123 @wesner0019 for helping me with the PATH related issue!

I finally managed to fix the crash issue :smile: Here is the summary of what I did.

  1. Looked at PATH and cleaned up all duplicates
  2. Following MSYS utilities were “problematic”, and I replaced them from other sources.

I had the standard MSYS version installed as part of MinGW installer, and somehow that turned out to be an issue!. I now can see that the Firmware is getting built, on GitBash. @mdma please do take a note of this, it might help you to build the particle-tool-installer :sunny:

Next step is to flash the Firmware and to play around with it :smile:

Thanks for the heads up! As to a particle-tool-installer our planned approach is to avoid ducking and diving all the difficult punches windows throws at us and use a virtual environment, such as docker. Then we can configure the build once and know it works.